tests/test-revert-interactive.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Wed, 15 Jan 2020 15:47:40 +0100
changeset 44310 daad3aace942
parent 42566 f802a75da585
child 44724 5c2a4f37eace
permissions -rw-r--r--
nodemap: only use persistent nodemap for non-inlined revlog Revlog are inlined while they are small (to avoid having too many file to deal with). The persistent nodemap will only provides a significant boost for large enough revlog index. So it does not make sens to add an extra file to store nodemap for small revlog. We could consider inclining the nodemap data inside the revlog itself, but the benefit is unclear so let it be an adventure for another time. Differential Revision: https://phab.mercurial-scm.org/D7837
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     1
Revert interactive tests
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     2
1 add and commit file f
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     3
2 add commit file folder1/g
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     4
3 add and commit file folder2/h
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     5
4 add and commit file folder1/i
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     6
5 commit change to file f
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     7
6 commit changes to files folder1/g folder2/h
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     8
7 commit changes to files folder1/g folder2/h
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
     9
8 revert interactive to commit id 2 (line 3 above), check that folder1/i is removed and
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    10
9 make workdir match 7
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    11
10 run the same test than 8 from within folder1 and check same expectations
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    12
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    13
  $ cat <<EOF >> $HGRCPATH
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    14
  > [ui]
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    15
  > interactive = true
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    16
  > [extensions]
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    17
  > record =
27985
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
    18
  > purge = 
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    19
  > EOF
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    20
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    21
24389
93d3e1a8bfb0 test-revert-interactive: eliminate bashism in wildcard pattern
Yuya Nishihara <yuya@tcha.org>
parents: 24361
diff changeset
    22
  $ mkdir -p a/folder1 a/folder2
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    23
  $ cd a
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    24
  $ hg init
38086
b95a6fb7ae66 py3: fix .write() calls in few tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36194
diff changeset
    25
  >>> open('f', 'wb').write(b"1\n2\n3\n4\n5\n") and None
24434
f169405c03ab test-interactive: use stable EOL in various file generating routines
Matt Harbison <matt_harbison@yahoo.com>
parents: 24389
diff changeset
    26
  $ hg add f ; hg commit -m "adding f"
24361
8de8cd34f2e3 tests: replace uses of 'seq' with portable 'seq.py'
Matt Harbison <matt_harbison@yahoo.com>
parents: 24359
diff changeset
    27
  $ cat f > folder1/g ; hg add folder1/g ; hg commit -m "adding folder1/g"
8de8cd34f2e3 tests: replace uses of 'seq' with portable 'seq.py'
Matt Harbison <matt_harbison@yahoo.com>
parents: 24359
diff changeset
    28
  $ cat f > folder2/h ; hg add folder2/h ; hg commit -m "adding folder2/h"
8de8cd34f2e3 tests: replace uses of 'seq' with portable 'seq.py'
Matt Harbison <matt_harbison@yahoo.com>
parents: 24359
diff changeset
    29
  $ cat f > folder1/i ; hg add folder1/i ; hg commit -m "adding folder1/i"
38086
b95a6fb7ae66 py3: fix .write() calls in few tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36194
diff changeset
    30
  >>> open('f', 'wb').write(b"a\n1\n2\n3\n4\n5\nb\n") and None
24434
f169405c03ab test-interactive: use stable EOL in various file generating routines
Matt Harbison <matt_harbison@yahoo.com>
parents: 24389
diff changeset
    31
  $ hg commit -m "modifying f"
38086
b95a6fb7ae66 py3: fix .write() calls in few tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36194
diff changeset
    32
  >>> open('folder1/g', 'wb').write(b"c\n1\n2\n3\n4\n5\nd\n") and None
24434
f169405c03ab test-interactive: use stable EOL in various file generating routines
Matt Harbison <matt_harbison@yahoo.com>
parents: 24389
diff changeset
    33
  $ hg commit -m "modifying folder1/g"
38086
b95a6fb7ae66 py3: fix .write() calls in few tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36194
diff changeset
    34
  >>> open('folder2/h', 'wb').write(b"e\n1\n2\n3\n4\n5\nf\n") and None
24434
f169405c03ab test-interactive: use stable EOL in various file generating routines
Matt Harbison <matt_harbison@yahoo.com>
parents: 24389
diff changeset
    35
  $ hg commit -m "modifying folder2/h"
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    36
  $ hg tip
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    37
  changeset:   6:59dd6e4ab63a
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    38
  tag:         tip
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    39
  user:        test
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    40
  date:        Thu Jan 01 00:00:00 1970 +0000
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    41
  summary:     modifying folder2/h
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    42
  
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    43
  $ hg revert -i -r 2 --all -- << EOF
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    44
  > y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    45
  > y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    46
  > y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    47
  > y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    48
  > y
32068
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
    49
  > ?
30532
66b162fa3ffa revert: prompt before removing files in interactive mode
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 30531
diff changeset
    50
  > y
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    51
  > n
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    52
  > n
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    53
  > EOF
39405
cb70501d8b71 revert: fix the inconsistency of status msgs in --interactive mode
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38086
diff changeset
    54
  remove added file folder1/i (Yn)? y
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34968
diff changeset
    55
  removing folder1/i
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
    56
  diff --git a/f b/f
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    57
  2 hunks, 2 lines changed
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
    58
  examine changes to 'f'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
    59
  (enter ? for help) [Ynesfdaq?] y
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    60
  
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
    61
  @@ -1,6 +1,5 @@
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
    62
  -a
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    63
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    64
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    65
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    66
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    67
   5
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
    68
  apply change 1/6 to 'f'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
    69
  (enter ? for help) [Ynesfdaq?] y
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    70
  
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
    71
  @@ -2,6 +1,5 @@
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    72
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    73
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    74
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    75
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    76
   5
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
    77
  -b
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
    78
  apply change 2/6 to 'f'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
    79
  (enter ? for help) [Ynesfdaq?] y
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    80
  
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
    81
  diff --git a/folder1/g b/folder1/g
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    82
  2 hunks, 2 lines changed
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
    83
  examine changes to 'folder1/g'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
    84
  (enter ? for help) [Ynesfdaq?] y
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    85
  
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
    86
  @@ -1,6 +1,5 @@
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
    87
  -c
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    88
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    89
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    90
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    91
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    92
   5
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
    93
  apply change 3/6 to 'folder1/g'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
    94
  (enter ? for help) [Ynesfdaq?] ?
32068
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
    95
  
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
    96
  y - yes, apply this change
32068
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
    97
  n - no, skip this change
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
    98
  e - edit this change manually
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
    99
  s - skip remaining changes to this file
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   100
  f - apply remaining changes to this file
32068
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
   101
  d - done, skip remaining changes and files
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   102
  a - apply all changes to all remaining files
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   103
  q - quit, applying no changes
32068
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
   104
  ? - ? (display help)
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   105
  apply change 3/6 to 'folder1/g'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   106
  (enter ? for help) [Ynesfdaq?] y
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   107
  
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   108
  @@ -2,6 +1,5 @@
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   109
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   110
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   111
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   112
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   113
   5
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   114
  -d
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   115
  apply change 4/6 to 'folder1/g'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   116
  (enter ? for help) [Ynesfdaq?] n
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   117
  
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   118
  diff --git a/folder2/h b/folder2/h
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   119
  2 hunks, 2 lines changed
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   120
  examine changes to 'folder2/h'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   121
  (enter ? for help) [Ynesfdaq?] n
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   122
  
39414
1cbe19eb496d revert: stabilize status message of chunks selected interactively
Yuya Nishihara <yuya@tcha.org>
parents: 39405
diff changeset
   123
  reverting f
39405
cb70501d8b71 revert: fix the inconsistency of status msgs in --interactive mode
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38086
diff changeset
   124
  reverting folder1/g
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   125
  $ cat f
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   126
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   127
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   128
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   129
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   130
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   131
  $ cat folder1/g
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   132
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   133
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   134
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   135
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   136
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   137
  d
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   138
  $ cat folder2/h
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   139
  e
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   140
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   141
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   142
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   143
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   144
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   145
  f
24698
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   146
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   147
Test that --interactive lift the need for --all
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   148
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   149
  $ echo q | hg revert -i -r 2
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   150
  diff --git a/folder1/g b/folder1/g
24698
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   151
  1 hunks, 1 lines changed
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   152
  examine changes to 'folder1/g'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   153
  (enter ? for help) [Ynesfdaq?] q
24698
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   154
  
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   155
  abort: user quit
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   156
  [255]
29498
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   157
  $ ls folder1/
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   158
  g
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   159
30332
318a24b52eeb spelling: fixes of non-dictionary words
Mads Kiilerich <madski@unity3d.com>
parents: 29498
diff changeset
   160
Test that a noop revert doesn't do an unnecessary backup
42071
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   161
  $ (echo n) | hg revert -i -r 2 folder1/g
29498
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   162
  diff --git a/folder1/g b/folder1/g
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   163
  1 hunks, 1 lines changed
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   164
  @@ -3,4 +3,3 @@
29498
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   165
   3
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   166
   4
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   167
   5
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   168
  -d
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   169
  apply this change to 'folder1/g'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   170
  (enter ? for help) [Ynesfdaq?] n
29498
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   171
  
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   172
  $ ls folder1/
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   173
  g
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   174
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   175
Test --no-backup
42071
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   176
  $ (echo y) | hg revert -i -C -r 2 folder1/g
29498
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   177
  diff --git a/folder1/g b/folder1/g
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   178
  1 hunks, 1 lines changed
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   179
  @@ -3,4 +3,3 @@
29498
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   180
   3
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   181
   4
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   182
   5
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   183
  -d
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   184
  apply this change to 'folder1/g'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   185
  (enter ? for help) [Ynesfdaq?] y
29498
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   186
  
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   187
  $ ls folder1/
1b38cfde9530 revert: don't backup if no files reverted in interactive mode (issue4793)
skarlage <skarlage@fb.com>
parents: 29283
diff changeset
   188
  g
38086
b95a6fb7ae66 py3: fix .write() calls in few tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 36194
diff changeset
   189
  >>> open('folder1/g', 'wb').write(b"1\n2\n3\n4\n5\nd\n") and None
24698
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   190
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   191
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   192
  $ hg update -C 6
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   193
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   194
  $ hg revert -i -r 2 --all -- << EOF
30532
66b162fa3ffa revert: prompt before removing files in interactive mode
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 30531
diff changeset
   195
  > n
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   196
  > y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   197
  > y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   198
  > y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   199
  > y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   200
  > y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   201
  > n
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   202
  > n
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   203
  > EOF
30532
66b162fa3ffa revert: prompt before removing files in interactive mode
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 30531
diff changeset
   204
  remove added file folder1/i (Yn)? n
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   205
  diff --git a/f b/f
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   206
  2 hunks, 2 lines changed
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   207
  examine changes to 'f'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   208
  (enter ? for help) [Ynesfdaq?] y
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   209
  
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   210
  @@ -1,6 +1,5 @@
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   211
  -a
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   212
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   213
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   214
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   215
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   216
   5
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   217
  apply change 1/6 to 'f'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   218
  (enter ? for help) [Ynesfdaq?] y
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   219
  
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   220
  @@ -2,6 +1,5 @@
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   221
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   222
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   223
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   224
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   225
   5
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   226
  -b
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   227
  apply change 2/6 to 'f'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   228
  (enter ? for help) [Ynesfdaq?] y
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   229
  
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   230
  diff --git a/folder1/g b/folder1/g
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   231
  2 hunks, 2 lines changed
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   232
  examine changes to 'folder1/g'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   233
  (enter ? for help) [Ynesfdaq?] y
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   234
  
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   235
  @@ -1,6 +1,5 @@
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   236
  -c
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   237
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   238
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   239
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   240
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   241
   5
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   242
  apply change 3/6 to 'folder1/g'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   243
  (enter ? for help) [Ynesfdaq?] y
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   244
  
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   245
  @@ -2,6 +1,5 @@
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   246
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   247
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   248
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   249
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   250
   5
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   251
  -d
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   252
  apply change 4/6 to 'folder1/g'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   253
  (enter ? for help) [Ynesfdaq?] n
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   254
  
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   255
  diff --git a/folder2/h b/folder2/h
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   256
  2 hunks, 2 lines changed
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   257
  examine changes to 'folder2/h'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   258
  (enter ? for help) [Ynesfdaq?] n
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   259
  
39414
1cbe19eb496d revert: stabilize status message of chunks selected interactively
Yuya Nishihara <yuya@tcha.org>
parents: 39405
diff changeset
   260
  reverting f
39405
cb70501d8b71 revert: fix the inconsistency of status msgs in --interactive mode
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38086
diff changeset
   261
  reverting folder1/g
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   262
  $ cat f
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   263
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   264
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   265
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   266
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   267
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   268
  $ cat folder1/g
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   269
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   270
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   271
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   272
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   273
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   274
  d
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   275
  $ cat folder2/h
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   276
  e
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   277
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   278
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   279
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   280
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   281
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   282
  f
24475
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   283
  $ hg st
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   284
  M f
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   285
  M folder1/g
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   286
  $ hg revert --interactive f << EOF
32068
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
   287
  > ?
24475
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   288
  > y
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   289
  > n
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   290
  > n
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   291
  > EOF
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   292
  diff --git a/f b/f
24475
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   293
  2 hunks, 2 lines changed
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   294
  @@ -1,6 +1,5 @@
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   295
  -a
24475
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   296
   1
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   297
   2
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   298
   3
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   299
   4
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   300
   5
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   301
  discard change 1/2 to 'f'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   302
  (enter ? for help) [Ynesfdaq?] ?
32068
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
   303
  
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
   304
  y - yes, discard this change
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
   305
  n - no, skip this change
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
   306
  e - edit this change manually
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
   307
  s - skip remaining changes to this file
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
   308
  f - discard remaining changes to this file
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
   309
  d - done, skip remaining changes and files
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
   310
  a - discard all changes to all remaining files
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
   311
  q - quit, discarding no changes
51fdedd29b0a record: update help message to use operation instead of "record" (issue5432)
Boris Feld <boris.feld@octobus.net>
parents: 31196
diff changeset
   312
  ? - ? (display help)
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   313
  discard change 1/2 to 'f'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   314
  (enter ? for help) [Ynesfdaq?] y
24475
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   315
  
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   316
  @@ -2,6 +1,5 @@
24475
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   317
   1
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   318
   2
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   319
   3
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   320
   4
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   321
   5
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   322
  -b
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   323
  discard change 2/2 to 'f'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   324
  (enter ? for help) [Ynesfdaq?] n
24475
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   325
  
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   326
  $ hg st
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   327
  M f
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   328
  M folder1/g
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   329
  ? f.orig
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   330
  $ cat f
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   331
  a
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   332
  1
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   333
  2
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   334
  3
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   335
  4
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   336
  5
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   337
  $ cat f.orig
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   338
  1
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   339
  2
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   340
  3
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   341
  4
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   342
  5
25259
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   343
  $ rm f.orig
42071
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   344
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   345
Patterns
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   346
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   347
  $ hg revert -i 'glob:f*' << EOF
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   348
  > y
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   349
  > n
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   350
  > EOF
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   351
  diff --git a/f b/f
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   352
  1 hunks, 1 lines changed
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   353
  examine changes to 'f'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   354
  (enter ? for help) [Ynesfdaq?] y
42071
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   355
  
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   356
  @@ -4,4 +4,3 @@
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   357
   3
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   358
   4
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   359
   5
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   360
  -b
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   361
  discard this change to 'f'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   362
  (enter ? for help) [Ynesfdaq?] n
42071
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   363
  
db72f9f6580e interactive: do not prompt about files given in command line
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 41987
diff changeset
   364
25259
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   365
  $ hg update -C .
30532
66b162fa3ffa revert: prompt before removing files in interactive mode
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 30531
diff changeset
   366
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
25259
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   367
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   368
Check editing files newly added by a revert
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   369
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   370
1) Create a dummy editor changing 1 to 42
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   371
  $ cat > $TESTTMP/editor.sh << '__EOF__'
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   372
  > cat "$1"  | sed "s/1/42/g"  > tt
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   373
  > mv tt  "$1"
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   374
  > __EOF__
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   375
25656
88d244f4edfd revert: change a test to make the change of direction of revert -i easier
Laurent Charignon <lcharignon@fb.com>
parents: 25424
diff changeset
   376
2) Add k
88d244f4edfd revert: change a test to make the change of direction of revert -i easier
Laurent Charignon <lcharignon@fb.com>
parents: 25424
diff changeset
   377
  $ printf "1\n" > k
88d244f4edfd revert: change a test to make the change of direction of revert -i easier
Laurent Charignon <lcharignon@fb.com>
parents: 25424
diff changeset
   378
  $ hg add k
88d244f4edfd revert: change a test to make the change of direction of revert -i easier
Laurent Charignon <lcharignon@fb.com>
parents: 25424
diff changeset
   379
  $ hg commit -m "add k"
25259
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   380
25656
88d244f4edfd revert: change a test to make the change of direction of revert -i easier
Laurent Charignon <lcharignon@fb.com>
parents: 25424
diff changeset
   381
3) Use interactive revert with editing (replacing +1 with +42):
88d244f4edfd revert: change a test to make the change of direction of revert -i easier
Laurent Charignon <lcharignon@fb.com>
parents: 25424
diff changeset
   382
  $ printf "0\n2\n" > k
88d244f4edfd revert: change a test to make the change of direction of revert -i easier
Laurent Charignon <lcharignon@fb.com>
parents: 25424
diff changeset
   383
  $ HGEDITOR="\"sh\" \"${TESTTMP}/editor.sh\"" hg revert -i  <<EOF
25259
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   384
  > y
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   385
  > e
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   386
  > EOF
25656
88d244f4edfd revert: change a test to make the change of direction of revert -i easier
Laurent Charignon <lcharignon@fb.com>
parents: 25424
diff changeset
   387
  diff --git a/k b/k
88d244f4edfd revert: change a test to make the change of direction of revert -i easier
Laurent Charignon <lcharignon@fb.com>
parents: 25424
diff changeset
   388
  1 hunks, 2 lines changed
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   389
  examine changes to 'k'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   390
  (enter ? for help) [Ynesfdaq?] y
25259
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   391
  
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   392
  @@ -1,1 +1,2 @@
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   393
  -1
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   394
  +0
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   395
  +2
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   396
  discard this change to 'k'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   397
  (enter ? for help) [Ynesfdaq?] e
25259
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   398
  
39405
cb70501d8b71 revert: fix the inconsistency of status msgs in --interactive mode
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38086
diff changeset
   399
  reverting k
25656
88d244f4edfd revert: change a test to make the change of direction of revert -i easier
Laurent Charignon <lcharignon@fb.com>
parents: 25424
diff changeset
   400
  $ cat k
25259
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   401
  42
25424
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   402
27985
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   403
  $ hg update -C .
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   404
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   405
  $ hg purge
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   406
  $ touch newfile
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   407
  $ hg add newfile
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   408
  $ hg status
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   409
  A newfile
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   410
  $ hg revert -i <<EOF
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   411
  > n
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   412
  > EOF
30531
841092fd6b85 revert: indicate the default choice when prompting to forget files
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 30332
diff changeset
   413
  forget added file newfile (Yn)? n
27985
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   414
  $ hg status
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   415
  A newfile
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   416
  $ hg revert -i <<EOF
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   417
  > y
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   418
  > EOF
39405
cb70501d8b71 revert: fix the inconsistency of status msgs in --interactive mode
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38086
diff changeset
   419
  forget added file newfile (Yn)? y
27985
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   420
  forgetting newfile
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   421
  $ hg status
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   422
  ? newfile
33884
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   423
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   424
When a line without EOL is selected during "revert -i" (issue5651)
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   425
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   426
  $ hg init $TESTTMP/revert-i-eol
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   427
  $ cd $TESTTMP/revert-i-eol
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   428
  $ echo 0 > a
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   429
  $ hg ci -qAm 0
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   430
  $ printf 1 >> a
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   431
  $ hg ci -qAm 1
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   432
  $ cat a
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   433
  0
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   434
  1 (no-eol)
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   435
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   436
  $ hg revert -ir'.^' <<EOF
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   437
  > y
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   438
  > y
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   439
  > EOF
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   440
  diff --git a/a b/a
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   441
  1 hunks, 1 lines changed
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   442
  examine changes to 'a'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   443
  (enter ? for help) [Ynesfdaq?] y
33884
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   444
  
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   445
  @@ -1,2 +1,1 @@
33884
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   446
   0
34968
3649c3f2cd90 revert: do not reverse hunks in interactive when REV is not parent (issue5096)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33884
diff changeset
   447
  -1
33884
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   448
  \ No newline at end of file
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   449
  apply this change to 'a'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   450
  (enter ? for help) [Ynesfdaq?] y
33884
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   451
  
39405
cb70501d8b71 revert: fix the inconsistency of status msgs in --interactive mode
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38086
diff changeset
   452
  reverting a
33884
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   453
  $ cat a
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   454
  0
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   455
36193
a228b2f55ad6 tests: add a test demonstrate that 'revert -i' ignores nonexistent patterns
Denis Laxalde <denis@laxalde.org>
parents: 35393
diff changeset
   456
When specified pattern does not exist, we should exit early (issue5789).
a228b2f55ad6 tests: add a test demonstrate that 'revert -i' ignores nonexistent patterns
Denis Laxalde <denis@laxalde.org>
parents: 35393
diff changeset
   457
a228b2f55ad6 tests: add a test demonstrate that 'revert -i' ignores nonexistent patterns
Denis Laxalde <denis@laxalde.org>
parents: 35393
diff changeset
   458
  $ hg files
a228b2f55ad6 tests: add a test demonstrate that 'revert -i' ignores nonexistent patterns
Denis Laxalde <denis@laxalde.org>
parents: 35393
diff changeset
   459
  a
a228b2f55ad6 tests: add a test demonstrate that 'revert -i' ignores nonexistent patterns
Denis Laxalde <denis@laxalde.org>
parents: 35393
diff changeset
   460
  $ hg rev b
a228b2f55ad6 tests: add a test demonstrate that 'revert -i' ignores nonexistent patterns
Denis Laxalde <denis@laxalde.org>
parents: 35393
diff changeset
   461
  b: no such file in rev b40d1912accf
a228b2f55ad6 tests: add a test demonstrate that 'revert -i' ignores nonexistent patterns
Denis Laxalde <denis@laxalde.org>
parents: 35393
diff changeset
   462
  $ hg rev -i b
a228b2f55ad6 tests: add a test demonstrate that 'revert -i' ignores nonexistent patterns
Denis Laxalde <denis@laxalde.org>
parents: 35393
diff changeset
   463
  b: no such file in rev b40d1912accf
a228b2f55ad6 tests: add a test demonstrate that 'revert -i' ignores nonexistent patterns
Denis Laxalde <denis@laxalde.org>
parents: 35393
diff changeset
   464
33884
5707bfe04deb record: fix revert -i for lines without newline (issue5651)
Jun Wu <quark@fb.com>
parents: 32068
diff changeset
   465
  $ cd ..
41522
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   466
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   467
Prompt before undeleting file(issue6008)
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   468
  $ hg init repo
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   469
  $ cd repo
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   470
  $ echo a > a
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   471
  $ hg ci -qAm a
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   472
  $ hg rm a
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   473
  $ hg revert -i<<EOF
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   474
  > y
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   475
  > EOF
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   476
  add back removed file a (Yn)? y
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   477
  undeleting a
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   478
  $ ls
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   479
  a
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   480
  $ hg rm a
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   481
  $ hg revert -i<<EOF
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   482
  > n
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   483
  > EOF
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   484
  add back removed file a (Yn)? n
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   485
  $ ls
41987
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   486
  $ hg revert -a
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   487
  undeleting a
41522
d783c937aa53 revert: add prompt before undeleting a file in -i (issue6008)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39414
diff changeset
   488
  $ cd ..
41987
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   489
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   490
Test "keep" mode
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   491
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   492
  $ cat <<EOF >> $HGRCPATH
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   493
  > [experimental]
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   494
  > revert.interactive.select-to-keep = true
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   495
  > EOF
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   496
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   497
  $ cd repo
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   498
  $ printf "x\na\ny\n" > a
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   499
  $ hg diff
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   500
  diff -r cb9a9f314b8b a
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   501
  --- a/a	Thu Jan 01 00:00:00 1970 +0000
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   502
  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   503
  @@ -1,1 +1,3 @@
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   504
  +x
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   505
   a
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   506
  +y
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   507
  $ cat > $TESTTMP/editor.sh << '__EOF__'
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   508
  > echo "+new line" >> "$1"
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   509
  > __EOF__
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   510
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   511
  $ HGEDITOR="\"sh\" \"${TESTTMP}/editor.sh\"" hg revert -i  <<EOF
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   512
  > y
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   513
  > n
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   514
  > e
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   515
  > EOF
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   516
  diff --git a/a b/a
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   517
  2 hunks, 2 lines changed
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   518
  examine changes to 'a'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   519
  (enter ? for help) [Ynesfdaq?] y
41987
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   520
  
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   521
  @@ -1,1 +1,2 @@
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   522
  +x
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   523
   a
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   524
  keep change 1/2 to 'a'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   525
  (enter ? for help) [Ynesfdaq?] n
41987
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   526
  
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   527
  @@ -1,1 +2,2 @@
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   528
   a
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   529
  +y
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   530
  keep change 2/2 to 'a'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 42071
diff changeset
   531
  (enter ? for help) [Ynesfdaq?] e
41987
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   532
  
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   533
  reverting a
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   534
  $ cat a
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   535
  a
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   536
  y
c1d83d916e85 revert: option to choose what to keep, not what to discard
Martin von Zweigbergk <martinvonz@google.com>
parents: 41522
diff changeset
   537
  new line