tests/test-revert-interactive.t
author Matt Harbison <matt_harbison@yahoo.com>
Tue, 16 Jun 2015 23:06:57 -0400
changeset 25601 3ec8351fa6ed
parent 25424 69609f43c752
child 25656 88d244f4edfd
permissions -rw-r--r--
archive: support 'wdir()' This is a step toward replacing the extdiff internals with archive, in order to support 'extdiff -S'. Only Mercurial subrepos are supported for now. If a file is missing from the filesystem, it is silently skipped. Perhaps it should warn, but it cannot abort when working with extdiff because deleting a file is a legitimate diff.
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 =
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    18
  > EOF
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    19
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    20
24389
93d3e1a8bfb0 test-revert-interactive: eliminate bashism in wildcard pattern
Yuya Nishihara <yuya@tcha.org>
parents: 24361
diff changeset
    21
  $ mkdir -p a/folder1 a/folder2
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    22
  $ cd a
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    23
  $ hg init
24434
f169405c03ab test-interactive: use stable EOL in various file generating routines
Matt Harbison <matt_harbison@yahoo.com>
parents: 24389
diff changeset
    24
  >>> 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
    25
  $ 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
    26
  $ 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
    27
  $ 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
    28
  $ 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
    29
  >>> 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
    30
  $ 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
    31
  >>> 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
    32
  $ 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
    33
  >>> 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
    34
  $ hg commit -m "modifying folder2/h"
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    35
  $ hg tip
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    36
  changeset:   6:59dd6e4ab63a
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    37
  tag:         tip
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    38
  user:        test
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    39
  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
    40
  summary:     modifying folder2/h
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    41
  
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    42
  $ hg revert -i -r 2 --all -- << EOF
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    43
  > y
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
  > n
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
  > EOF
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    51
  reverting f
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    52
  reverting folder1/g (glob)
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    53
  removing folder1/i (glob)
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    54
  reverting folder2/h (glob)
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
    55
  diff --git a/f b/f
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    56
  2 hunks, 2 lines changed
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    57
  examine changes to 'f'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    58
  
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    59
  @@ -1,6 +1,5 @@
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    60
  -a
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    61
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    62
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    63
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    64
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    65
   5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    66
  record change 1/6 to 'f'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    67
  
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    68
  @@ -2,6 +1,5 @@
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    69
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    70
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    71
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    72
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    73
   5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    74
  -b
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    75
  record change 2/6 to 'f'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    76
  
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
    77
  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
    78
  2 hunks, 2 lines changed
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    79
  examine changes to 'folder1/g'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    80
  
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    81
  @@ -1,6 +1,5 @@
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    82
  -c
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    83
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    84
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    85
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    86
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    87
   5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    88
  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
    89
  
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    90
  @@ -2,6 +1,5 @@
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    91
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    92
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    93
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    94
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    95
   5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    96
  -d
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
    97
  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
    98
  
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
    99
  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
   100
  2 hunks, 2 lines changed
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   101
  examine changes to 'folder2/h'? [Ynesfdaq?] n
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   102
  
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   103
  $ cat f
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   104
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   105
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   106
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   107
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   108
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   109
  $ cat folder1/g
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   110
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   111
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   112
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   113
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   114
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   115
  d
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   116
  $ cat folder2/h
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   117
  e
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   118
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   119
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   120
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   121
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   122
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   123
  f
24698
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   124
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   125
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
   126
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   127
  $ 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
   128
  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
   129
  reverting folder2/h (glob)
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   130
  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
   131
  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
   132
  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
   133
  
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   134
  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
   135
  [255]
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   136
  $ 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
   137
a85c4ed1132f revert: do not requires '--all' if '--interative' is present
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24475
diff changeset
   138
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   139
  $ hg update -C 6
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   140
  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
   141
  $ hg revert -i -r 2 --all -- << EOF
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   142
  > y
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
  > n
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
  > EOF
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   150
  reverting f
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   151
  reverting folder1/g (glob)
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   152
  removing folder1/i (glob)
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   153
  reverting folder2/h (glob)
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   154
  diff --git a/f b/f
24359
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   155
  2 hunks, 2 lines changed
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   156
  examine changes to 'f'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   157
  
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   158
  @@ -1,6 +1,5 @@
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   159
  -a
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   160
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   161
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   162
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   163
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   164
   5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   165
  record change 1/6 to 'f'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   166
  
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   167
  @@ -2,6 +1,5 @@
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   168
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   169
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   170
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   171
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   172
   5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   173
  -b
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   174
  record change 2/6 to 'f'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   175
  
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   176
  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
   177
  2 hunks, 2 lines changed
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   178
  examine changes to 'folder1/g'? [Ynesfdaq?] y
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   179
  
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   180
  @@ -1,6 +1,5 @@
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   181
  -c
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   182
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   183
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   184
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   185
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   186
   5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   187
  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
   188
  
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   189
  @@ -2,6 +1,5 @@
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   190
   1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   191
   2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   192
   3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   193
   4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   194
   5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   195
  -d
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   196
  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
   197
  
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   198
  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
   199
  2 hunks, 2 lines changed
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   200
  examine changes to 'folder2/h'? [Ynesfdaq?] n
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   201
  
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   202
  $ cat f
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   203
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   204
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   205
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   206
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   207
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   208
  $ cat folder1/g
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   209
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   210
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   211
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   212
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   213
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   214
  d
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   215
  $ cat folder2/h
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   216
  e
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   217
  1
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   218
  2
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   219
  3
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   220
  4
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   221
  5
521fe8287dd5 revert: add flag to make revert interactive
Laurent Charignon <lcharignon@fb.com>
parents:
diff changeset
   222
  f
24475
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   223
  $ hg st
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   224
  M f
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   225
  M folder1/g
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   226
  R folder1/i
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   227
  $ hg revert --interactive f << EOF
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   228
  > y
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
  > n
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
  > EOF
25258
f37a69ec3f47 revert: make revert --interactive use git style diff
Laurent Charignon <lcharignon@fb.com>
parents: 24698
diff changeset
   233
  diff --git a/f b/f
24475
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   234
  2 hunks, 2 lines changed
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   235
  examine changes to 'f'? [Ynesfdaq?] y
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   236
  
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   237
  @@ -1,5 +1,6 @@
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   238
  +a
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   239
   1
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   240
   2
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   241
   3
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   242
   4
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   243
   5
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   244
  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
   245
  
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   246
  @@ -1,5 +2,6 @@
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   247
   1
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   248
   2
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   249
   3
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   250
   4
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   251
   5
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   252
  +b
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   253
  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
   254
  
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   255
  $ hg st
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   256
  M f
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   257
  M folder1/g
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   258
  R folder1/i
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   259
  ? f.orig
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   260
  $ cat f
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   261
  a
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   262
  1
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   263
  2
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   264
  3
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   265
  4
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   266
  5
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   267
  $ cat f.orig
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   268
  1
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   269
  2
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   270
  3
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   271
  4
06cbff4674a3 revert: fix --interactive on local modification (issue4576)
Laurent Charignon <lcharignon@fb.com>
parents: 24434
diff changeset
   272
  5
25259
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   273
  $ rm f.orig
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   274
  $ hg update -C .
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   275
  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
   276
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   277
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
   278
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   279
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
   280
  $ cat > $TESTTMP/editor.sh << '__EOF__'
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   281
  > 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
   282
  > mv tt  "$1"
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   283
  > __EOF__
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   284
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   285
2) Remove f
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   286
  $ hg rm f
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   287
  $ hg commit -m "remove f"
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   288
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   289
3) Do another commit on top
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   290
  $ touch k; hg add k
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   291
  $ hg commit -m "add k"
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   292
  $ hg st
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   293
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   294
4) Use interactive revert to recover f and change it on the fly
25350
48b1d8944406 revert: remove unused debug code in the test file
Laurent Charignon <lcharignon@fb.com>
parents: 25298
diff changeset
   295
  $ HGEDITOR="\"sh\" \"${TESTTMP}/editor.sh\"" hg revert -i -r ".^^"  <<EOF
25259
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   296
  > y
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   297
  > e
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   298
  > EOF
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   299
  adding f
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   300
  removing k
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   301
  diff --git a/f b/f
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   302
  new file mode 100644
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   303
  examine changes to 'f'? [Ynesfdaq?] y
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   304
  
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   305
  @@ -0,0 +1,7 @@
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   306
  +a
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   307
  +1
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   308
  +2
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   309
  +3
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   310
  +4
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   311
  +5
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   312
  +b
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   313
  record this change to 'f'? [Ynesfdaq?] e
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   314
  
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   315
  $ cat f
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   316
  a
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   317
  42
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   318
  2
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   319
  3
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   320
  4
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   321
  5
5b05f10c5024 revert: fix edition of newly added file during --interactive
Laurent Charignon <lcharignon@fb.com>
parents: 25258
diff changeset
   322
  b
25424
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   323
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   324
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
   325
  $ cat <<EOF >> $HGRCPATH
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   326
  > [experimental]
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   327
  > revertalternateinteractivemode=True
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   328
  > EOF
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   329
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   330
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   331
  $ hg up -C .
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   332
  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
   333
  $ 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
   334
  $ hg diff --nodates
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   335
  diff -r 5a858e056dc0 folder1/g
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   336
  --- a/folder1/g
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   337
  +++ b/folder1/g
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   338
  @@ -1,7 +1,9 @@
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   339
  +firstline
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   340
   c
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   341
   1
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   342
   2
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   343
   3
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   344
  -4
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   345
  + 3
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   346
   5
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   347
   d
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   348
  +lastline
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   349
  $ hg revert -i <<EOF
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   350
  > y
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   351
  > y
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   352
  > y
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   353
  > n
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   354
  > EOF
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   355
  reverting folder1/g (glob)
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   356
  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
   357
  3 hunks, 3 lines changed
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   358
  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
   359
  
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   360
  @@ -1,4 +1,5 @@
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   361
  +firstline
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   362
   c
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   363
   1
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   364
   2
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   365
   3
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   366
  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
   367
  
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   368
  @@ -1,7 +2,7 @@
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   369
   c
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   370
   1
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   371
   2
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   372
   3
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   373
  -4
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   374
  + 3
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   375
   5
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   376
   d
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   377
  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
   378
  
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   379
  @@ -6,2 +7,3 @@
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   380
   5
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   381
   d
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   382
  +lastline
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   383
  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
   384
  
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   385
  $ hg diff --nodates
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   386
  diff -r 5a858e056dc0 folder1/g
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   387
  --- a/folder1/g
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   388
  +++ b/folder1/g
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   389
  @@ -5,3 +5,4 @@
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   390
   4
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   391
   5
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   392
   d
69609f43c752 revert: add an experimental config to use inverted selection
Laurent Charignon <lcharignon@fb.com>
parents: 25350
diff changeset
   393
  +lastline