tests/test-commit-amend.t
author Matt Mackall <mpm@selenic.com>
Fri, 29 Jun 2012 00:40:52 -0500
changeset 17059 fba17a64fa49
parent 16901 5b89700cce30
parent 17049 2440822446ce
child 17060 69fa0459dd3b
permissions -rw-r--r--
merge with stable
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
     1
  $ hg init
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
     2
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
     3
Setup:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
     4
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
     5
  $ echo a >> a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
     6
  $ hg ci -Am 'base'
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
     7
  adding a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
     8
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
     9
Refuse to amend public csets:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    10
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    11
  $ hg phase -r . -p
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    12
  $ hg ci --amend
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    13
  abort: cannot amend public changesets
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    14
  [255]
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    15
  $ hg phase -r . -f -d
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    16
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    17
  $ echo a >> a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    18
  $ hg ci -Am 'base1'
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    19
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    20
Nothing to amend:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    21
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    22
  $ hg ci --amend
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    23
  nothing changed
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    24
  [1]
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    25
17049
2440822446ce amend: disable hooks when creating intermediate commit (issue3501)
Idan Kamara <idankk86@gmail.com>
parents: 16630
diff changeset
    26
  $ echo '[hooks]' >> $HGRCPATH
2440822446ce amend: disable hooks when creating intermediate commit (issue3501)
Idan Kamara <idankk86@gmail.com>
parents: 16630
diff changeset
    27
  $ echo 'pretxncommit.foo = echo "pretxncommit $HG_NODE"; hg id -r $HG_NODE' >> $HGRCPATH
2440822446ce amend: disable hooks when creating intermediate commit (issue3501)
Idan Kamara <idankk86@gmail.com>
parents: 16630
diff changeset
    28
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    29
Amending changeset with changes in working dir:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    30
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    31
  $ echo a >> a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    32
  $ hg ci --amend -m 'amend base1'
17049
2440822446ce amend: disable hooks when creating intermediate commit (issue3501)
Idan Kamara <idankk86@gmail.com>
parents: 16630
diff changeset
    33
  pretxncommit 9cd25b479c51be2f4ed2c38e7abdf7ce67d8e0dc
2440822446ce amend: disable hooks when creating intermediate commit (issue3501)
Idan Kamara <idankk86@gmail.com>
parents: 16630
diff changeset
    34
  9cd25b479c51 tip
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    35
  saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-amend-backup.hg
17049
2440822446ce amend: disable hooks when creating intermediate commit (issue3501)
Idan Kamara <idankk86@gmail.com>
parents: 16630
diff changeset
    36
  $ echo 'pretxncommit.foo = ' >> $HGRCPATH
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    37
  $ hg diff -c .
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    38
  diff -r ad120869acf0 -r 9cd25b479c51 a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    39
  --- a/a	Thu Jan 01 00:00:00 1970 +0000
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    40
  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    41
  @@ -1,1 +1,3 @@
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    42
   a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    43
  +a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    44
  +a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    45
  $ hg log
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    46
  changeset:   1:9cd25b479c51
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    47
  tag:         tip
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    48
  user:        test
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    49
  date:        Thu Jan 01 00:00:00 1970 +0000
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    50
  summary:     amend base1
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    51
  
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    52
  changeset:   0:ad120869acf0
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    53
  user:        test
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    54
  date:        Thu Jan 01 00:00:00 1970 +0000
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    55
  summary:     base
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    56
  
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    57
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    58
Add new file:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    59
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    60
  $ echo b > b
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    61
  $ hg ci --amend -Am 'amend base1 new file'
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    62
  adding b
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
    63
  saved backup bundle to $TESTTMP/.hg/strip-backup/9cd25b479c51-amend-backup.hg (glob)
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    64
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    65
Remove file that was added in amended commit:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    66
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    67
  $ hg rm b
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    68
  $ hg ci --amend -m 'amend base1 remove new file'
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
    69
  saved backup bundle to $TESTTMP/.hg/strip-backup/e2bb3ecffd2f-amend-backup.hg (glob)
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    70
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    71
  $ hg cat b
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    72
  b: no such file in rev 664a9b2d60cd
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    73
  [1]
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    74
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    75
No changes, just a different message:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    76
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    77
  $ hg ci -v --amend -m 'no changes, new message'
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    78
  amending changeset 664a9b2d60cd
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    79
  copying changeset 664a9b2d60cd to ad120869acf0
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    80
  a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    81
  stripping amended changeset 664a9b2d60cd
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    82
  1 changesets found
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
    83
  saved backup bundle to $TESTTMP/.hg/strip-backup/664a9b2d60cd-amend-backup.hg (glob)
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    84
  1 changesets found
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    85
  adding branch
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    86
  adding changesets
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    87
  adding manifests
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    88
  adding file changes
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    89
  added 1 changesets with 1 changes to 1 files
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    90
  committed changeset 1:ea6e356ff2ad
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    91
  $ hg diff -c .
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    92
  diff -r ad120869acf0 -r ea6e356ff2ad a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    93
  --- a/a	Thu Jan 01 00:00:00 1970 +0000
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    94
  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    95
  @@ -1,1 +1,3 @@
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    96
   a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    97
  +a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    98
  +a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
    99
  $ hg log
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   100
  changeset:   1:ea6e356ff2ad
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   101
  tag:         tip
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   102
  user:        test
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   103
  date:        Thu Jan 01 00:00:00 1970 +0000
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   104
  summary:     no changes, new message
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   105
  
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   106
  changeset:   0:ad120869acf0
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   107
  user:        test
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   108
  date:        Thu Jan 01 00:00:00 1970 +0000
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   109
  summary:     base
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   110
  
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   111
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   112
Disable default date on commit so when -d isn't given, the old date is preserved:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   113
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   114
  $ echo '[defaults]' >> $HGRCPATH
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   115
  $ echo 'commit=' >> $HGRCPATH
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   116
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   117
Test -u/-d:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   118
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   119
  $ hg ci --amend -u foo -d '1 0'
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   120
  saved backup bundle to $TESTTMP/.hg/strip-backup/ea6e356ff2ad-amend-backup.hg (glob)
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   121
  $ echo a >> a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   122
  $ hg ci --amend -u foo -d '1 0'
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   123
  saved backup bundle to $TESTTMP/.hg/strip-backup/377b91ce8b56-amend-backup.hg (glob)
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   124
  $ hg log -r .
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   125
  changeset:   1:2c94e4a5756f
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   126
  tag:         tip
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   127
  user:        foo
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   128
  date:        Thu Jan 01 00:00:01 1970 +0000
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   129
  summary:     no changes, new message
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   130
  
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   131
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   132
Open editor with old commit message if a message isn't given otherwise:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   133
16901
5b89700cce30 tests: consistently use a HGEDITOR pattern that works with msys on windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16900
diff changeset
   134
  $ cat > editor.sh << '__EOF__'
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   135
  > #!/bin/sh
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   136
  > cat $1
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   137
  > echo "another precious commit message" > "$1"
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   138
  > __EOF__
16901
5b89700cce30 tests: consistently use a HGEDITOR pattern that works with msys on windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16900
diff changeset
   139
  $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   140
  amending changeset 2c94e4a5756f
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   141
  copying changeset 2c94e4a5756f to ad120869acf0
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   142
  no changes, new message
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   143
  
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   144
  
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   145
  HG: Enter commit message.  Lines beginning with 'HG:' are removed.
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   146
  HG: Leave message empty to abort commit.
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   147
  HG: --
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   148
  HG: user: foo
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   149
  HG: branch 'default'
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   150
  HG: changed a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   151
  a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   152
  stripping amended changeset 2c94e4a5756f
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   153
  1 changesets found
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   154
  saved backup bundle to $TESTTMP/.hg/strip-backup/2c94e4a5756f-amend-backup.hg (glob)
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   155
  1 changesets found
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   156
  adding branch
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   157
  adding changesets
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   158
  adding manifests
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   159
  adding file changes
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   160
  added 1 changesets with 1 changes to 1 files
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   161
  committed changeset 1:ffb49186f961
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   162
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   163
Same, but with changes in working dir (different code path):
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   164
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   165
  $ echo a >> a
16901
5b89700cce30 tests: consistently use a HGEDITOR pattern that works with msys on windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16900
diff changeset
   166
  $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   167
  amending changeset ffb49186f961
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   168
  another precious commit message
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   169
  
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   170
  
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   171
  HG: Enter commit message.  Lines beginning with 'HG:' are removed.
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   172
  HG: Leave message empty to abort commit.
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   173
  HG: --
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   174
  HG: user: foo
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   175
  HG: branch 'default'
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   176
  HG: changed a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   177
  a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   178
  copying changeset 27f3aacd3011 to ad120869acf0
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   179
  a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   180
  stripping intermediate changeset 27f3aacd3011
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   181
  stripping amended changeset ffb49186f961
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   182
  2 changesets found
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   183
  saved backup bundle to $TESTTMP/.hg/strip-backup/ffb49186f961-amend-backup.hg (glob)
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   184
  1 changesets found
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   185
  adding branch
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   186
  adding changesets
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   187
  adding manifests
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   188
  adding file changes
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   189
  added 1 changesets with 1 changes to 1 files
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   190
  committed changeset 1:fb6cca43446f
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   191
16901
5b89700cce30 tests: consistently use a HGEDITOR pattern that works with msys on windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16900
diff changeset
   192
  $ rm editor.sh
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   193
  $ hg log -r .
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   194
  changeset:   1:fb6cca43446f
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   195
  tag:         tip
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   196
  user:        foo
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   197
  date:        Thu Jan 01 00:00:01 1970 +0000
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   198
  summary:     another precious commit message
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   199
  
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   200
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   201
Moving bookmarks, preserve active bookmark:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   202
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   203
  $ hg book book1
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   204
  $ hg book book2
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   205
  $ hg ci --amend -m 'move bookmarks'
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   206
  saved backup bundle to $TESTTMP/.hg/strip-backup/fb6cca43446f-amend-backup.hg (glob)
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   207
  $ hg book
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   208
     book1                     1:0cf1c7a51bcf
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   209
   * book2                     1:0cf1c7a51bcf
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   210
  $ echo a >> a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   211
  $ hg ci --amend -m 'move bookmarks'
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   212
  saved backup bundle to $TESTTMP/.hg/strip-backup/0cf1c7a51bcf-amend-backup.hg (glob)
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   213
  $ hg book
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   214
     book1                     1:7344472bd951
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   215
   * book2                     1:7344472bd951
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   216
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   217
  $ echo '[defaults]' >> $HGRCPATH
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   218
  $ echo "commit=-d '0 0'" >> $HGRCPATH
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   219
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   220
Moving branches:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   221
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   222
  $ hg branch foo
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   223
  marked working directory as branch foo
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   224
  (branches are permanent and global, did you want a bookmark?)
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   225
  $ echo a >> a
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   226
  $ hg ci -m 'branch foo'
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   227
  $ hg branch default -f
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   228
  marked working directory as branch default
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   229
  (branches are permanent and global, did you want a bookmark?)
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   230
  $ hg ci --amend -m 'back to default'
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   231
  saved backup bundle to $TESTTMP/.hg/strip-backup/1661ca36a2db-amend-backup.hg (glob)
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   232
  $ hg branches
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   233
  default                        2:f24ee5961967
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   234
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   235
Close branch:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   236
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   237
  $ hg up -q 0
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   238
  $ echo b >> b
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   239
  $ hg branch foo
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   240
  marked working directory as branch foo
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   241
  (branches are permanent and global, did you want a bookmark?)
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   242
  $ hg ci -Am 'fork'
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   243
  adding b
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   244
  $ echo b >> b
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   245
  $ hg ci -mb
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   246
  $ hg ci --amend --close-branch -m 'closing branch foo'
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   247
  saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-amend-backup.hg (glob)
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   248
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   249
Same thing, different code path:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   250
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   251
  $ echo b >> b
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   252
  $ hg ci -m 'reopen branch'
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   253
  reopening closed branch head 4
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   254
  $ echo b >> b
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   255
  $ hg ci --amend --close-branch
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   256
  saved backup bundle to $TESTTMP/.hg/strip-backup/5e302dcc12b8-amend-backup.hg (glob)
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   257
  $ hg branches
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   258
  default                        2:f24ee5961967
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   259
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   260
Refuse to amend merges:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   261
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   262
  $ hg up -q default
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   263
  $ hg merge foo
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   264
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   265
  (branch merge, don't forget to commit)
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   266
  $ hg ci --amend
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   267
  abort: cannot amend while merging
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   268
  [255]
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   269
  $ hg ci -m 'merge'
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   270
  $ hg ci --amend
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   271
  abort: cannot amend merge changesets
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   272
  [255]
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   273
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   274
Follow copies/renames:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   275
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   276
  $ hg mv b c
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   277
  $ hg ci -m 'b -> c'
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   278
  $ hg mv c d
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   279
  $ hg ci --amend -m 'b -> d'
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   280
  saved backup bundle to $TESTTMP/.hg/strip-backup/9c207120aa98-amend-backup.hg (glob)
16483
3c4910364797 tests: ^ must be quoted when used on solaris sh
Mads Kiilerich <mads@kiilerich.com>
parents: 16458
diff changeset
   281
  $ hg st --rev '.^' --copies d
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   282
  A d
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   283
    b
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   284
  $ hg cp d e
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   285
  $ hg ci -m 'e = d'
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   286
  $ hg cp e f
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   287
  $ hg ci --amend -m 'f = d'
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   288
  saved backup bundle to $TESTTMP/.hg/strip-backup/fda2b3b27b22-amend-backup.hg (glob)
16483
3c4910364797 tests: ^ must be quoted when used on solaris sh
Mads Kiilerich <mads@kiilerich.com>
parents: 16458
diff changeset
   289
  $ hg st --rev '.^' --copies f
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   290
  A f
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   291
    d
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   292
16552
90ca344a7c55 test-commit-amend: exhibit an --amend weirdness
Patrick Mezard <patrick@mezard.eu>
parents: 16539
diff changeset
   293
  $ mv f f.orig
90ca344a7c55 test-commit-amend: exhibit an --amend weirdness
Patrick Mezard <patrick@mezard.eu>
parents: 16539
diff changeset
   294
  $ hg rm -A f
90ca344a7c55 test-commit-amend: exhibit an --amend weirdness
Patrick Mezard <patrick@mezard.eu>
parents: 16539
diff changeset
   295
  $ hg ci -m removef
90ca344a7c55 test-commit-amend: exhibit an --amend weirdness
Patrick Mezard <patrick@mezard.eu>
parents: 16539
diff changeset
   296
  $ hg cp a f
90ca344a7c55 test-commit-amend: exhibit an --amend weirdness
Patrick Mezard <patrick@mezard.eu>
parents: 16539
diff changeset
   297
  $ mv f.orig f
90ca344a7c55 test-commit-amend: exhibit an --amend weirdness
Patrick Mezard <patrick@mezard.eu>
parents: 16539
diff changeset
   298
  $ hg ci --amend -m replacef
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   299
  saved backup bundle to $TESTTMP/.hg/strip-backup/20a7413547f9-amend-backup.hg (glob)
16552
90ca344a7c55 test-commit-amend: exhibit an --amend weirdness
Patrick Mezard <patrick@mezard.eu>
parents: 16539
diff changeset
   300
  $ hg st --change . --copies
90ca344a7c55 test-commit-amend: exhibit an --amend weirdness
Patrick Mezard <patrick@mezard.eu>
parents: 16539
diff changeset
   301
  $ hg log -r . --template "{file_copies}\n"
16553
9224cc2e99cc amend: fix copy records handling (issue3410)
Patrick Mezard <patrick@mezard.eu>
parents: 16552
diff changeset
   302
  
9224cc2e99cc amend: fix copy records handling (issue3410)
Patrick Mezard <patrick@mezard.eu>
parents: 16552
diff changeset
   303
9224cc2e99cc amend: fix copy records handling (issue3410)
Patrick Mezard <patrick@mezard.eu>
parents: 16552
diff changeset
   304
Move added file (issue3410):
9224cc2e99cc amend: fix copy records handling (issue3410)
Patrick Mezard <patrick@mezard.eu>
parents: 16552
diff changeset
   305
9224cc2e99cc amend: fix copy records handling (issue3410)
Patrick Mezard <patrick@mezard.eu>
parents: 16552
diff changeset
   306
  $ echo g >> g
9224cc2e99cc amend: fix copy records handling (issue3410)
Patrick Mezard <patrick@mezard.eu>
parents: 16552
diff changeset
   307
  $ hg ci -Am g
9224cc2e99cc amend: fix copy records handling (issue3410)
Patrick Mezard <patrick@mezard.eu>
parents: 16552
diff changeset
   308
  adding g
9224cc2e99cc amend: fix copy records handling (issue3410)
Patrick Mezard <patrick@mezard.eu>
parents: 16552
diff changeset
   309
  $ hg mv g h
9224cc2e99cc amend: fix copy records handling (issue3410)
Patrick Mezard <patrick@mezard.eu>
parents: 16552
diff changeset
   310
  $ hg ci --amend
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   311
  saved backup bundle to $TESTTMP/.hg/strip-backup/5daa77a5d616-amend-backup.hg (glob)
16553
9224cc2e99cc amend: fix copy records handling (issue3410)
Patrick Mezard <patrick@mezard.eu>
parents: 16552
diff changeset
   312
  $ hg st --change . --copies h
9224cc2e99cc amend: fix copy records handling (issue3410)
Patrick Mezard <patrick@mezard.eu>
parents: 16552
diff changeset
   313
  A h
9224cc2e99cc amend: fix copy records handling (issue3410)
Patrick Mezard <patrick@mezard.eu>
parents: 16552
diff changeset
   314
  $ hg log -r . --template "{file_copies}\n"
9224cc2e99cc amend: fix copy records handling (issue3410)
Patrick Mezard <patrick@mezard.eu>
parents: 16552
diff changeset
   315
  
16552
90ca344a7c55 test-commit-amend: exhibit an --amend weirdness
Patrick Mezard <patrick@mezard.eu>
parents: 16539
diff changeset
   316
16458
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   317
Can't rollback an amend:
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   318
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   319
  $ hg rollback
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   320
  no rollback information available
55982f62651f commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
   321
  [1]
16630
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   322
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   323
Preserve extra dict (issue3430):
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   324
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   325
  $ hg branch a
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   326
  marked working directory as branch a
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   327
  (branches are permanent and global, did you want a bookmark?)
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   328
  $ echo a >> a
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   329
  $ hg ci -ma
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   330
  $ hg ci --amend -m "a'"
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   331
  saved backup bundle to $TESTTMP/.hg/strip-backup/167f8e3031df-amend-backup.hg (glob)
16630
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   332
  $ hg log -r . --template "{branch}\n"
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   333
  a
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   334
  $ hg ci --amend -m "a''"
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   335
  saved backup bundle to $TESTTMP/.hg/strip-backup/ceac1a44c806-amend-backup.hg (glob)
16630
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   336
  $ hg log -r . --template "{branch}\n"
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   337
  a
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   338
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   339
Also preserve other entries in the dict that are in the old commit,
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   340
first graft something so there's an additional entry:
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   341
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   342
  $ hg up 0 -q
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   343
  $ echo z > z
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   344
  $ hg ci -Am 'fork'
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   345
  adding z
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   346
  created new head
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   347
  $ hg up 11
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   348
  5 files updated, 0 files merged, 1 files removed, 0 files unresolved
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   349
  $ hg graft 12
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   350
  grafting revision 12
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   351
  $ hg ci --amend -m 'graft amend'
16900
3f1a153daadb tests: glob the remaining 'saved backup bundle to' to prepare for windows
Mads Kiilerich <mads@kiilerich.com>
parents: 16745
diff changeset
   352
  saved backup bundle to $TESTTMP/.hg/strip-backup/18a5124daf7a-amend-backup.hg (glob)
16630
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   353
  $ hg log -r . --debug | grep extra
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   354
  extra:       branch=a
f30226b1a46a amend: preserve extra dict (issue3430)
Idan Kamara <idankk86@gmail.com>
parents: 16553
diff changeset
   355
  extra:       source=2647734878ef0236dda712fae9c1651cf694ea8a