tests/test-amend.t
author Jun Wu <quark@fb.com>
Tue, 05 Sep 2017 13:37:36 -0700
changeset 34087 5361771f9714
parent 34085 e8a7c1a0565a
child 34121 ae95853c250a
permissions -rw-r--r--
wrapfunction: use functools.partial if possible Every `extensions.bind` call inserts a frame in traceback: ... in closure return func(*(args + a), **kw) which makes traceback noisy. The Python stdlib has a `functools.partial` which is backed by C code and does not pollute traceback. However it does not support instancemethod and sets `args` attribute which could be problematic for alias handling. This patch makes `wrapfunction` use `functools.partial` if we are wrapping a function directly exported by a module (so it's impossible to be a class or instance method), and special handles `wrapfunction` results so alias handling code could handle `args` just fine. As an example, `hg rebase -s . -d . --traceback` got 6 lines removed in my setup: File "hg/mercurial/dispatch.py", line 898, in _dispatch cmdpats, cmdoptions) -File "hg/mercurial/extensions.py", line 333, in closure - return func(*(args + a), **kw) File "hg/hgext/journal.py", line 84, in runcommand return orig(lui, repo, cmd, fullargs, *args) -File "hg/mercurial/extensions.py", line 333, in closure - return func(*(args + a), **kw) File "fb-hgext/hgext3rd/fbamend/hiddenoverride.py", line 119, in runcommand result = orig(lui, repo, cmd, fullargs, *args) File "hg/mercurial/dispatch.py", line 660, in runcommand ret = _runcommand(ui, options, cmd, d) -File "hg/mercurial/extensions.py", line 333, in closure - return func(*(args + a), **kw) File "hg/hgext/pager.py", line 69, in pagecmd return orig(ui, options, cmd, cmdfunc) .... Differential Revision: https://phab.mercurial-scm.org/D632
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
     1
#testcases obsstore-off obsstore-on
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
     2
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
     3
  $ cat << EOF >> $HGRCPATH
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
     4
  > [extensions]
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
     5
  > amend=
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
     6
  > debugdrawdag=$TESTDIR/drawdag.py
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
     7
  > [diff]
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
     8
  > git=1
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
     9
  > EOF
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    10
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    11
#if obsstore-on
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    12
  $ cat << EOF >> $HGRCPATH
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    13
  > [experimental]
33773
6c1a9fd8361b test: update evolution config
Boris Feld <boris.feld@octobus.net>
parents: 33431
diff changeset
    14
  > stabilization=createmarkers
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    15
  > EOF
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    16
#endif
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    17
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    18
Basic amend
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    19
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    20
  $ hg init repo1
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    21
  $ cd repo1
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    22
  $ hg debugdrawdag <<'EOS'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    23
  > B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    24
  > |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    25
  > A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    26
  > EOS
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    27
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    28
  $ hg update B -q
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    29
  $ echo 2 >> B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    30
34053
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
    31
  $ hg amend
34085
e8a7c1a0565a cmdutil: remove the redundant commit during amend
Saurabh Singh <singhsrb@fb.com>
parents: 34053
diff changeset
    32
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-7e959a55-amend.hg (glob) (obsstore-off !)
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    33
#if obsstore-off
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    34
  $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    35
  @  1 be169c7e8dbe B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    36
  |  diff --git a/B b/B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    37
  |  new file mode 100644
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    38
  |  --- /dev/null
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    39
  |  +++ b/B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    40
  |  @@ -0,0 +1,1 @@
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    41
  |  +B2
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    42
  |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    43
  o  0 426bada5c675 A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    44
     diff --git a/A b/A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    45
     new file mode 100644
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    46
     --- /dev/null
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    47
     +++ b/A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    48
     @@ -0,0 +1,1 @@
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    49
     +A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    50
     \ No newline at end of file
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    51
  
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    52
#else
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    53
  $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n'
34085
e8a7c1a0565a cmdutil: remove the redundant commit during amend
Saurabh Singh <singhsrb@fb.com>
parents: 34053
diff changeset
    54
  @  2 be169c7e8dbe B
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    55
  |  diff --git a/B b/B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    56
  |  new file mode 100644
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    57
  |  --- /dev/null
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    58
  |  +++ b/B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    59
  |  @@ -0,0 +1,1 @@
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    60
  |  +B2
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    61
  |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    62
  | x  1 112478962961 B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    63
  |/   diff --git a/B b/B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    64
  |    new file mode 100644
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    65
  |    --- /dev/null
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    66
  |    +++ b/B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    67
  |    @@ -0,0 +1,1 @@
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    68
  |    +B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    69
  |    \ No newline at end of file
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    70
  |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    71
  o  0 426bada5c675 A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    72
     diff --git a/A b/A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    73
     new file mode 100644
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    74
     --- /dev/null
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    75
     +++ b/A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    76
     @@ -0,0 +1,1 @@
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    77
     +A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    78
     \ No newline at end of file
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    79
  
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    80
#endif
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    81
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    82
Nothing changed
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    83
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    84
  $ hg amend
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    85
  nothing changed
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    86
  [1]
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    87
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    88
Matcher and metadata options
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    89
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    90
  $ echo 3 > C
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    91
  $ echo 4 > D
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    92
  $ hg add C D
34053
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
    93
  $ hg amend -m NEWMESSAGE -I C
34085
e8a7c1a0565a cmdutil: remove the redundant commit during amend
Saurabh Singh <singhsrb@fb.com>
parents: 34053
diff changeset
    94
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/be169c7e8dbe-7684ddc5-amend.hg (glob) (obsstore-off !)
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    95
  $ hg log -r . -T '{node|short} {desc} {files}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    96
  c7ba14d9075b NEWMESSAGE B C
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    97
  $ echo 5 > E
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    98
  $ rm C
34053
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
    99
  $ hg amend -d '2000 1000' -u 'Foo <foo@example.com>' -A C D
34085
e8a7c1a0565a cmdutil: remove the redundant commit during amend
Saurabh Singh <singhsrb@fb.com>
parents: 34053
diff changeset
   100
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b3e76daa-amend.hg (glob) (obsstore-off !)
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   101
  $ hg log -r . -T '{node|short} {desc} {files} {author} {date}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   102
  14f6c4bcc865 NEWMESSAGE B D Foo <foo@example.com> 2000.01000
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   103
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   104
Amend with editor
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   105
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   106
  $ cat > $TESTTMP/prefix.sh <<'EOF'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   107
  > printf 'EDITED: ' > $TESTTMP/msg
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   108
  > cat "$1" >> $TESTTMP/msg
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   109
  > mv $TESTTMP/msg "$1"
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   110
  > EOF
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   111
  $ chmod +x $TESTTMP/prefix.sh
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   112
34053
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   113
  $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend --edit
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   114
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/14f6c4bcc865-6591f15d-amend.hg (glob) (obsstore-off !)
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   115
  $ hg log -r . -T '{node|short} {desc}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   116
  298f085230c3 EDITED: NEWMESSAGE
34053
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   117
  $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend -e -m MSG
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   118
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/298f085230c3-d81a6ad3-amend.hg (glob) (obsstore-off !)
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   119
  $ hg log -r . -T '{node|short} {desc}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   120
  974f07f28537 EDITED: MSG
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   121
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   122
  $ echo FOO > $TESTTMP/msg
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   123
  $ hg amend -l $TESTTMP/msg -m BAR
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   124
  abort: options --message and --logfile are mutually exclusive
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   125
  [255]
34053
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   126
  $ hg amend -l $TESTTMP/msg
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   127
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/974f07f28537-edb6470a-amend.hg (glob) (obsstore-off !)
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   128
  $ hg log -r . -T '{node|short} {desc}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   129
  507be9bdac71 FOO
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   130
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   131
Interactive mode
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   132
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   133
  $ touch F G
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   134
  $ hg add F G
34053
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   135
  $ cat <<EOS | hg amend -i --config ui.interactive=1
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   136
  > y
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   137
  > n
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   138
  > EOS
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   139
  diff --git a/F b/F
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   140
  new file mode 100644
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   141
  examine changes to 'F'? [Ynesfdaq?] y
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   142
  
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   143
  diff --git a/G b/G
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   144
  new file mode 100644
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   145
  examine changes to 'G'? [Ynesfdaq?] n
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   146
  
34085
e8a7c1a0565a cmdutil: remove the redundant commit during amend
Saurabh Singh <singhsrb@fb.com>
parents: 34053
diff changeset
   147
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-c8077452-amend.hg (glob) (obsstore-off !)
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   148
  $ hg log -r . -T '{files}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   149
  B D F
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   150
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   151
Amend in the middle of a stack
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   152
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   153
  $ hg init $TESTTMP/repo2
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   154
  $ cd $TESTTMP/repo2
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   155
  $ hg debugdrawdag <<'EOS'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   156
  > C
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   157
  > |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   158
  > B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   159
  > |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   160
  > A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   161
  > EOS
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   162
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   163
  $ hg update -q B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   164
  $ echo 2 >> B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   165
  $ hg amend
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   166
  abort: cannot amend changeset with children
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   167
  [255]
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   168
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   169
#if obsstore-on
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   170
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   171
With allowunstable, amend could work in the middle of a stack
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   172
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   173
  $ cat >> $HGRCPATH <<EOF
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   174
  > [experimental]
33773
6c1a9fd8361b test: update evolution config
Boris Feld <boris.feld@octobus.net>
parents: 33431
diff changeset
   175
  > stabilization=createmarkers, allowunstable
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   176
  > EOF
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   177
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   178
  $ hg amend
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   179
  $ hg log -T '{rev} {node|short} {desc}\n' -G
34085
e8a7c1a0565a cmdutil: remove the redundant commit during amend
Saurabh Singh <singhsrb@fb.com>
parents: 34053
diff changeset
   180
  @  3 be169c7e8dbe B
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   181
  |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   182
  | o  2 26805aba1e60 C
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   183
  | |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   184
  | x  1 112478962961 B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   185
  |/
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   186
  o  0 426bada5c675 A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   187
  
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   188
#endif
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   189
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   190
Cannot amend public changeset
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   191
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   192
  $ hg phase -r A --public
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   193
  $ hg update -C -q A
34053
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   194
  $ hg amend -m AMEND
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   195
  abort: cannot amend public changesets
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   196
  [255]
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   197
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   198
Amend a merge changeset
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   199
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   200
  $ hg init $TESTTMP/repo3
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   201
  $ cd $TESTTMP/repo3
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   202
  $ hg debugdrawdag <<'EOS'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   203
  >   C
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   204
  >  /|
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   205
  > A B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   206
  > EOS
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   207
  $ hg update -q C
34053
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   208
  $ hg amend -m FOO
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   209
  saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (glob) (obsstore-off !)
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   210
  $ rm .hg/localtags
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   211
  $ hg log -G -T '{desc}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   212
  @    FOO
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   213
  |\
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   214
  | o  B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   215
  |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   216
  o  A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   217