tests/test-amend.t
author Martin von Zweigbergk <martinvonz@google.com>
Tue, 11 Jul 2017 10:46:55 -0700
changeset 33497 80e1331a7fe9
parent 33431 fd6eb444f2e1
child 33773 6c1a9fd8361b
permissions -rw-r--r--
match: remove unused negatematcher This was only used by the sparse extension's dirstate._ignore override, which no longer exists. Differential Revision: https://phab.mercurial-scm.org/D60
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]
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    14
  > evolution=createmarkers
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
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    31
#if obsstore-off
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    32
  $ hg amend
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    33
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-af2c0941-amend.hg (glob)
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 amend
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    54
  $ 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
    55
  @  3 be169c7e8dbe B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    56
  |  diff --git a/B b/B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    57
  |  new file mode 100644
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    58
  |  --- /dev/null
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    59
  |  +++ b/B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    60
  |  @@ -0,0 +1,1 @@
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    61
  |  +B2
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    62
  |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    63
  | x  2 edf08988b141 temporary amend commit for 112478962961
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    64
  | |  diff --git a/B b/B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    65
  | |  --- a/B
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
  | |  @@ -1,1 +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
  | |  +B2
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    71
  | |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    72
  | x  1 112478962961 B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    73
  |/   diff --git a/B b/B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    74
  |    new file mode 100644
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    75
  |    --- /dev/null
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    76
  |    +++ b/B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    77
  |    @@ -0,0 +1,1 @@
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    78
  |    +B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    79
  |    \ No newline at end of file
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    80
  |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    81
  o  0 426bada5c675 A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    82
     diff --git a/A b/A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    83
     new file mode 100644
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    84
     --- /dev/null
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    85
     +++ b/A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    86
     @@ -0,0 +1,1 @@
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    87
     +A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    88
     \ No newline at end of file
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
#endif
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    91
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    92
Nothing changed
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    93
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    94
  $ hg amend
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    95
  nothing changed
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    96
  [1]
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    97
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    98
Matcher and metadata options
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
    99
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   100
  $ echo 3 > C
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   101
  $ echo 4 > D
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   102
  $ hg add C D
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   103
  $ hg amend -m NEWMESSAGE -I C -q
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   104
  $ 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
   105
  c7ba14d9075b NEWMESSAGE B C
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   106
  $ echo 5 > E
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   107
  $ rm C
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   108
  $ hg amend -d '2000 1000' -u 'Foo <foo@example.com>' -A C D -q
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   109
  $ 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
   110
  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
   111
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   112
Amend with editor
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   113
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   114
  $ cat > $TESTTMP/prefix.sh <<'EOF'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   115
  > printf 'EDITED: ' > $TESTTMP/msg
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   116
  > cat "$1" >> $TESTTMP/msg
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   117
  > mv $TESTTMP/msg "$1"
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   118
  > EOF
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   119
  $ chmod +x $TESTTMP/prefix.sh
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   120
33431
fd6eb444f2e1 test-amend: fix HGEDITOR shell script to run on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 33404
diff changeset
   121
  $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend --edit -q
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   122
  $ hg log -r . -T '{node|short} {desc}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   123
  298f085230c3 EDITED: NEWMESSAGE
33431
fd6eb444f2e1 test-amend: fix HGEDITOR shell script to run on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 33404
diff changeset
   124
  $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend -e -m MSG -q
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   125
  $ hg log -r . -T '{node|short} {desc}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   126
  974f07f28537 EDITED: MSG
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   127
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   128
  $ echo FOO > $TESTTMP/msg
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   129
  $ hg amend -l $TESTTMP/msg -m BAR
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   130
  abort: options --message and --logfile are mutually exclusive
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   131
  [255]
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   132
  $ hg amend -l $TESTTMP/msg -q
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   133
  $ hg log -r . -T '{node|short} {desc}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   134
  507be9bdac71 FOO
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   135
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   136
Interactive mode
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   137
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   138
  $ touch F G
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   139
  $ hg add F G
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   140
  $ cat <<EOS | hg amend -i --config ui.interactive=1 -q
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   141
  > y
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   142
  > n
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   143
  > EOS
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   144
  diff --git a/F b/F
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   145
  new file mode 100644
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   146
  examine changes to 'F'? [Ynesfdaq?] y
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   147
  
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   148
  diff --git a/G b/G
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   149
  new file mode 100644
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   150
  examine changes to 'G'? [Ynesfdaq?] n
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   151
  
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   152
  $ hg log -r . -T '{files}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   153
  B D F
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   154
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   155
Amend in the middle of a stack
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   156
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   157
  $ hg init $TESTTMP/repo2
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   158
  $ cd $TESTTMP/repo2
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   159
  $ hg debugdrawdag <<'EOS'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   160
  > C
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   161
  > |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   162
  > B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   163
  > |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   164
  > A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   165
  > EOS
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   166
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   167
  $ hg update -q B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   168
  $ echo 2 >> B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   169
  $ hg amend
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   170
  abort: cannot amend changeset with children
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   171
  [255]
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
#if obsstore-on
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   174
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   175
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
   176
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   177
  $ cat >> $HGRCPATH <<EOF
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   178
  > [experimental]
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   179
  > evolution=createmarkers, allowunstable
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   180
  > EOF
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
  $ hg amend
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   183
  $ hg log -T '{rev} {node|short} {desc}\n' -G
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   184
  @  4 be169c7e8dbe 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  2 26805aba1e60 C
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
  | x  1 112478962961 B
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
  o  0 426bada5c675 A
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
#endif
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   193
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   194
Cannot amend public changeset
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   195
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   196
  $ hg phase -r A --public
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   197
  $ hg update -C -q A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   198
  $ hg amend -m AMEND -q
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   199
  abort: cannot amend public changesets
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   200
  [255]
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   201
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   202
Amend a merge changeset
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   203
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   204
  $ hg init $TESTTMP/repo3
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   205
  $ cd $TESTTMP/repo3
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   206
  $ hg debugdrawdag <<'EOS'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   207
  >   C
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   208
  >  /|
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   209
  > A B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   210
  > EOS
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   211
  $ hg update -q C
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   212
  $ hg amend -m FOO -q
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   213
  $ rm .hg/localtags
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   214
  $ hg log -G -T '{desc}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   215
  @    FOO
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   216
  |\
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   217
  | o  B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   218
  |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   219
  o  A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   220