tests/test-revert-interactive.t
author timeless <timeless@mozdev.org>
Wed, 02 Mar 2016 15:50:34 +0000
changeset 28372 74d03766f962
parent 27985 79139c7a88bd
child 29283 14eee72c8d52
permissions -rw-r--r--
convert: monotone use absolute_import
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
24434
f169405c03ab test-interactive: use stable EOL in various file generating routines
Matt Harbison <matt_harbison@yahoo.com>
parents: 24389
diff changeset
    25
  >>> open('f', 'wb').write("1\n2\n3\n4\n5\n")
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"
24434
f169405c03ab test-interactive: use stable EOL in various file generating routines
Matt Harbison <matt_harbison@yahoo.com>
parents: 24389
diff changeset
    30
  >>> open('f', 'wb').write("a\n1\n2\n3\n4\n5\nb\n")
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"
f169405c03ab test-interactive: use stable EOL in various file generating routines
Matt Harbison <matt_harbison@yahoo.com>
parents: 24389
diff changeset
    32
  >>> open('folder1/g', 'wb').write("c\n1\n2\n3\n4\n5\nd\n")
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"
f169405c03ab test-interactive: use stable EOL in various file generating routines
Matt Harbison <matt_harbison@yahoo.com>
parents: 24389
diff changeset
    34
  >>> open('folder2/h', 'wb').write("e\n1\n2\n3\n4\n5\nf\n")
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
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    49
  > n
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    50
  > n
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    51
  > EOF
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    52
  reverting f
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    53
  reverting folder1/g (glob)
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    54
  removing folder1/i (glob)
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    55
  reverting folder2/h (glob)
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
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    58
  examine changes to 'f'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    59
  
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
    60
  @@ -1,5 +1,6 @@
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
    61
  +a
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    62
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    63
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    64
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    65
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    66
   5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    67
  record change 1/6 to 'f'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    68
  
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
    69
  @@ -1,5 +2,6 @@
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    70
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    71
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    72
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    73
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    74
   5
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
    75
  +b
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    76
  record change 2/6 to 'f'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    77
  
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
    78
  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
    79
  2 hunks, 2 lines changed
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    80
  examine changes to 'folder1/g'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    81
  
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
    82
  @@ -1,5 +1,6 @@
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
    83
  +c
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    84
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    85
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    86
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    87
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    88
   5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    89
  record change 3/6 to 'folder1/g'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    90
  
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
    91
  @@ -1,5 +2,6 @@
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    92
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    93
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    94
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    95
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    96
   5
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
    97
  +d
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    98
  record change 4/6 to 'folder1/g'? [Ynesfdaq?] n
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    99
  
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   100
  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
   101
  2 hunks, 2 lines changed
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   102
  examine changes to 'folder2/h'? [Ynesfdaq?] n
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   103
  
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   104
  $ cat f
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   105
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   106
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   107
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   108
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   109
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   110
  $ cat folder1/g
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   111
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   112
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   113
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   114
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   115
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   116
  d
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   117
  $ cat folder2/h
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   118
  e
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   119
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   120
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   121
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   122
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   123
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   124
  f
24698
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   125
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   126
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
   127
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   128
  $ echo q | hg revert -i -r 2
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   129
  reverting folder1/g (glob)
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   130
  reverting folder2/h (glob)
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   131
  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
   132
  1 hunks, 1 lines changed
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   133
  examine changes to 'folder1/g'? [Ynesfdaq?] q
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   134
  
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   135
  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
   136
  [255]
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   137
  $ rm folder1/g.orig
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   138
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   139
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   140
  $ hg update -C 6
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   141
  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
   142
  $ hg revert -i -r 2 --all -- << EOF
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   143
  > y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   144
  > y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   145
  > y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   146
  > y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   147
  > y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   148
  > n
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   149
  > n
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   150
  > EOF
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   151
  reverting f
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   152
  reverting folder1/g (glob)
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   153
  removing folder1/i (glob)
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   154
  reverting folder2/h (glob)
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   155
  diff --git a/f b/f
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   156
  2 hunks, 2 lines changed
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   157
  examine changes to 'f'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   158
  
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   159
  @@ -1,5 +1,6 @@
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   160
  +a
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   161
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   162
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   163
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   164
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   165
   5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   166
  record change 1/6 to 'f'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   167
  
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   168
  @@ -1,5 +2,6 @@
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   169
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   170
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   171
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   172
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   173
   5
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   174
  +b
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   175
  record change 2/6 to 'f'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   176
  
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   177
  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
   178
  2 hunks, 2 lines changed
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   179
  examine changes to 'folder1/g'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   180
  
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   181
  @@ -1,5 +1,6 @@
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   182
  +c
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   183
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   184
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   185
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   186
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   187
   5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   188
  record change 3/6 to 'folder1/g'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   189
  
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   190
  @@ -1,5 +2,6 @@
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   191
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   192
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   193
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   194
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   195
   5
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   196
  +d
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   197
  record change 4/6 to 'folder1/g'? [Ynesfdaq?] n
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   198
  
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   199
  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
   200
  2 hunks, 2 lines changed
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   201
  examine changes to 'folder2/h'? [Ynesfdaq?] n
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   202
  
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   203
  $ cat f
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   204
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   205
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   206
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   207
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   208
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   209
  $ cat folder1/g
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   210
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   211
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   212
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   213
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   214
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   215
  d
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   216
  $ cat folder2/h
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   217
  e
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   218
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   219
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   220
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   221
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   222
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   223
  f
24475
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   224
  $ hg st
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   225
  M f
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   226
  M folder1/g
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   227
  R folder1/i
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   228
  $ hg revert --interactive f << EOF
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   229
  > y
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   230
  > y
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   231
  > n
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   232
  > n
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   233
  > EOF
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   234
  diff --git a/f b/f
24475
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   235
  2 hunks, 2 lines changed
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   236
  examine changes to 'f'? [Ynesfdaq?] y
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   237
  
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   238
  @@ -1,6 +1,5 @@
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   239
  -a
24475
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   240
   1
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   241
   2
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   242
   3
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   243
   4
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   244
   5
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   245
  record change 1/2 to 'f'? [Ynesfdaq?] y
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   246
  
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   247
  @@ -2,6 +1,5 @@
24475
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   248
   1
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   249
   2
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   250
   3
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   251
   4
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   252
   5
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   253
  -b
24475
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   254
  record change 2/2 to 'f'? [Ynesfdaq?] n
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   255
  
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   256
  $ hg st
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   257
  M f
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   258
  M folder1/g
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   259
  R folder1/i
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   260
  ? f.orig
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   261
  $ cat f
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   262
  a
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   263
  1
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   264
  2
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   265
  3
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   266
  4
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   267
  5
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   268
  $ cat f.orig
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   269
  1
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   270
  2
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   271
  3
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   272
  4
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   273
  5
25259
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   274
  $ rm f.orig
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   275
  $ hg update -C .
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   276
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   277
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   278
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
   279
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   280
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
   281
  $ cat > $TESTTMP/editor.sh << '__EOF__'
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   282
  > 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
   283
  > mv tt  "$1"
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   284
  > __EOF__
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   285
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
   286
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
   287
  $ 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
   288
  $ 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
   289
  $ 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
   290
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
   291
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
   292
  $ 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
   293
  $ 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
   294
  > y
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   295
  > e
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   296
  > 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
   297
  reverting 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
   298
  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
   299
  1 hunks, 2 lines changed
88d244f4edfd revert: change a test to make the change of direction of revert -i easier
Laurent Charignon <lcharignon@fb.com>
parents: 25424
diff changeset
   300
  examine changes to 'k'? [Ynesfdaq?] y
25259
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   301
  
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   302
  @@ -1,1 +1,2 @@
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   303
  -1
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   304
  +0
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   305
  +2
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
   306
  record this change to 'k'? [Ynesfdaq?] e
25259
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   307
  
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
   308
  $ cat k
25259
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   309
  42
25424
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   310
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   311
Check the experimental config to invert the selection:
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   312
  $ cat <<EOF >> $HGRCPATH
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   313
  > [experimental]
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   314
  > revertalternateinteractivemode=False
25424
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   315
  > EOF
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   316
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   317
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   318
  $ hg up -C .
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   319
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   320
  $ printf 'firstline\nc\n1\n2\n3\n 3\n5\nd\nlastline\n' > folder1/g
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   321
  $ hg diff --nodates
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
   322
  diff -r a3d963a027aa folder1/g
25424
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   323
  --- a/folder1/g
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   324
  +++ b/folder1/g
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   325
  @@ -1,7 +1,9 @@
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   326
  +firstline
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   327
   c
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   328
   1
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   329
   2
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   330
   3
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   331
  -4
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   332
  + 3
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   333
   5
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   334
   d
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   335
  +lastline
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   336
  $ hg revert -i <<EOF
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   337
  > y
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   338
  > y
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   339
  > y
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   340
  > n
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   341
  > EOF
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   342
  reverting folder1/g (glob)
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   343
  diff --git a/folder1/g b/folder1/g
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   344
  3 hunks, 3 lines changed
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   345
  examine changes to 'folder1/g'? [Ynesfdaq?] y
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   346
  
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   347
  @@ -1,5 +1,4 @@
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   348
  -firstline
25424
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   349
   c
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   350
   1
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   351
   2
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   352
   3
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   353
  record change 1/3 to 'folder1/g'? [Ynesfdaq?] y
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   354
  
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   355
  @@ -2,7 +1,7 @@
25424
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   356
   c
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   357
   1
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   358
   2
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   359
   3
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   360
  - 3
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   361
  +4
25424
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   362
   5
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   363
   d
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   364
  record change 2/3 to 'folder1/g'? [Ynesfdaq?] y
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   365
  
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   366
  @@ -7,3 +6,2 @@
25424
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   367
   5
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   368
   d
25657
dcc56e10c23b revert: change the direction of revert -i
Laurent Charignon <lcharignon@fb.com>
parents: 25656
diff changeset
   369
  -lastline
25424
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   370
  record change 3/3 to 'folder1/g'? [Ynesfdaq?] n
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   371
  
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   372
  $ hg diff --nodates
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
   373
  diff -r a3d963a027aa folder1/g
25424
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   374
  --- a/folder1/g
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   375
  +++ b/folder1/g
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   376
  @@ -5,3 +5,4 @@
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   377
   4
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   378
   5
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   379
   d
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   380
  +lastline
27985
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   381
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   382
  $ hg update -C .
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   383
  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
   384
  $ hg purge
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   385
  $ touch newfile
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   386
  $ hg add newfile
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   387
  $ hg status
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   388
  A newfile
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   389
  $ hg revert -i <<EOF
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   390
  > n
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   391
  > EOF
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   392
  forgetting newfile
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   393
  forget added file newfile (yn)? n
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   394
  $ hg status
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   395
  A newfile
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   396
  $ hg revert -i <<EOF
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   397
  > y
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   398
  > EOF
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   399
  forgetting newfile
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   400
  forget added file newfile (yn)? y
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   401
  $ hg status
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   402
  ? newfile
79139c7a88bd revert: makes interactive mode ask to forget added files (issue4936)
liscju <piotr.listkiewicz@gmail.com>
parents: 25657
diff changeset
   403