tests/test-amend.t
author Matt Harbison <matt_harbison@yahoo.com>
Sun, 20 Aug 2023 01:12:26 -0400
changeset 50833 de3191c0cec9
parent 49772 e78a41686464
permissions -rw-r--r--
config: use the writefile() utility to create the sample hgrc This function uses a context manager.
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]
34866
1644623ab096 config: use 'experimental.evolution.create-markers'
Boris Feld <boris.feld@octobus.net>
parents: 34795
diff changeset
    14
  > evolution.createmarkers=True
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
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 35244
diff changeset
    32
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-7e959a55-amend.hg (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
34121
ae95853c250a cmdutil: fix amend when passing a date
Boris Feld <boris.feld@octobus.net>
parents: 34085
diff changeset
    88
  $ hg amend -d "0 0"
ae95853c250a cmdutil: fix amend when passing a date
Boris Feld <boris.feld@octobus.net>
parents: 34085
diff changeset
    89
  nothing changed
ae95853c250a cmdutil: fix amend when passing a date
Boris Feld <boris.feld@octobus.net>
parents: 34085
diff changeset
    90
  [1]
ae95853c250a cmdutil: fix amend when passing a date
Boris Feld <boris.feld@octobus.net>
parents: 34085
diff changeset
    91
ae95853c250a cmdutil: fix amend when passing a date
Boris Feld <boris.feld@octobus.net>
parents: 34085
diff changeset
    92
  $ hg amend -d "Thu Jan 01 00:00:00 1970 UTC"
ae95853c250a cmdutil: fix amend when passing a date
Boris Feld <boris.feld@octobus.net>
parents: 34085
diff changeset
    93
  nothing changed
ae95853c250a cmdutil: fix amend when passing a date
Boris Feld <boris.feld@octobus.net>
parents: 34085
diff changeset
    94
  [1]
ae95853c250a cmdutil: fix amend when passing a date
Boris Feld <boris.feld@octobus.net>
parents: 34085
diff changeset
    95
45387
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
    96
#if obsstore-on
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
    97
  $ hg init repo-merge-state
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
    98
  $ cd repo-merge-state
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
    99
  $ echo a > f
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   100
  $ hg ci -Aqm a
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   101
  $ echo b > f
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   102
  $ hg ci -Aqm b
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   103
  $ echo c > f
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   104
  $ hg co -m '.^'
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   105
  merging f
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   106
  warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   107
  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   108
  use 'hg resolve' to retry unresolved file merges
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   109
  [1]
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   110
  $ echo d > f
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   111
  $ hg resolve -m f
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   112
  (no more unresolved files)
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   113
  $ hg ci --amend --config experimental.evolution.allowunstable=True
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   114
  1 new orphan changesets
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   115
  $ hg resolve -l
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   116
  $ cd ..
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   117
#endif
cf21cda4281f tests: add test showing that merge state is not cleared by amend
Martin von Zweigbergk <martinvonz@google.com>
parents: 44377
diff changeset
   118
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   119
Matcher and metadata options
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   120
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   121
  $ echo 3 > C
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   122
  $ echo 4 > D
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   123
  $ hg add C D
34053
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   124
  $ hg amend -m NEWMESSAGE -I C
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 35244
diff changeset
   125
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/be169c7e8dbe-7684ddc5-amend.hg (obsstore-off !)
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   126
  $ 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
   127
  c7ba14d9075b NEWMESSAGE B C
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   128
  $ echo 5 > E
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   129
  $ rm C
34053
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   130
  $ hg amend -d '2000 1000' -u 'Foo <foo@example.com>' -A C D
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 35244
diff changeset
   131
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b3e76daa-amend.hg (obsstore-off !)
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   132
  $ hg log -r . -T '{node|short} {desc} {files} {author} {date}\n'
38299
88e7105b5cd9 templater: restore the original string format of {date}
Yuya Nishihara <yuya@tcha.org>
parents: 38285
diff changeset
   133
  14f6c4bcc865 NEWMESSAGE B D Foo <foo@example.com> 2000.01000
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   134
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   135
Amend with editor
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   136
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   137
  $ cat > $TESTTMP/prefix.sh <<'EOF'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   138
  > printf 'EDITED: ' > $TESTTMP/msg
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   139
  > cat "$1" >> $TESTTMP/msg
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   140
  > mv $TESTTMP/msg "$1"
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   141
  > EOF
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   142
  $ chmod +x $TESTTMP/prefix.sh
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   143
34053
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   144
  $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend --edit
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 35244
diff changeset
   145
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/14f6c4bcc865-6591f15d-amend.hg (obsstore-off !)
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   146
  $ hg log -r . -T '{node|short} {desc}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   147
  298f085230c3 EDITED: NEWMESSAGE
34053
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   148
  $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend -e -m MSG
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 35244
diff changeset
   149
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/298f085230c3-d81a6ad3-amend.hg (obsstore-off !)
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   150
  $ hg log -r . -T '{node|short} {desc}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   151
  974f07f28537 EDITED: MSG
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
  $ echo FOO > $TESTTMP/msg
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   154
  $ hg amend -l $TESTTMP/msg -m BAR
43894
774cee0e95c6 amend: use cmdutil.check_at_most_one_arg()
Martin von Zweigbergk <martinvonz@google.com>
parents: 43893
diff changeset
   155
  abort: cannot specify both --message and --logfile
45827
8d72e29ad1e0 errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 45765
diff changeset
   156
  [10]
34053
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   157
  $ hg amend -l $TESTTMP/msg
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 35244
diff changeset
   158
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/974f07f28537-edb6470a-amend.hg (obsstore-off !)
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   159
  $ hg log -r . -T '{node|short} {desc}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   160
  507be9bdac71 FOO
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
Interactive mode
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
  $ touch F G
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   165
  $ hg add F G
34053
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   166
  $ 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
   167
  > y
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   168
  > n
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   169
  > EOS
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   170
  diff --git a/F b/F
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   171
  new file mode 100644
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 41214
diff changeset
   172
  examine changes to 'F'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 41214
diff changeset
   173
  (enter ? for help) [Ynesfdaq?] y
33404
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
  diff --git a/G b/G
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   176
  new file mode 100644
42566
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 41214
diff changeset
   177
  examine changes to 'G'?
f802a75da585 patch: use a short, fixed-size message for last line of prompt (issue6158)
Kyle Lippincott <spectral@google.com>
parents: 41214
diff changeset
   178
  (enter ? for help) [Ynesfdaq?] n
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   179
  
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 35244
diff changeset
   180
  saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-c8077452-amend.hg (obsstore-off !)
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   181
  $ hg log -r . -T '{files}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   182
  B D F
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
Amend in the middle of a stack
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
  $ hg init $TESTTMP/repo2
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   187
  $ cd $TESTTMP/repo2
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   188
  $ hg debugdrawdag <<'EOS'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   189
  > C
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   190
  > |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   191
  > B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   192
  > |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   193
  > A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   194
  > EOS
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 update -q B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   197
  $ echo 2 >> B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   198
  $ hg amend
47070
d90f6237b3aa rewriteutil: say how many commits would become orphan if commit is rewritten
Martin von Zweigbergk <martinvonz@google.com>
parents: 47069
diff changeset
   199
  abort: cannot amend changeset, as that will orphan 1 descendants
47018
7a90fddb13b0 rewriteutil: point to help about instability when rewriting creates orphan
Martin von Zweigbergk <martinvonz@google.com>
parents: 45853
diff changeset
   200
  (see 'hg help evolution.instability')
45853
b4694ef45db5 errors: raise more specific errors from rewriteutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 45827
diff changeset
   201
  [10]
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   202
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   203
#if obsstore-on
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
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
   206
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   207
  $ cat >> $HGRCPATH <<EOF
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   208
  > [experimental]
34866
1644623ab096 config: use 'experimental.evolution.create-markers'
Boris Feld <boris.feld@octobus.net>
parents: 34795
diff changeset
   209
  > evolution.createmarkers=True
34867
7f183c643eb6 config: use 'experimental.evolution.allowunstable'
Boris Feld <boris.feld@octobus.net>
parents: 34866
diff changeset
   210
  > evolution.allowunstable=True
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   211
  > EOF
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   212
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   213
  $ hg amend
35709
1a09dad8b85a evolution: report new unstable changesets
Martin von Zweigbergk <martinvonz@google.com>
parents: 35508
diff changeset
   214
  1 new orphan changesets
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   215
  $ 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
   216
  @  3 be169c7e8dbe B
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   217
  |
35508
9b3f95d9783d graphlog: add another graph node type, unstable, using character "*" (BC)
Anton Shestakov <av6@dwimlabs.net>
parents: 35393
diff changeset
   218
  | *  2 26805aba1e60 C
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   219
  | |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   220
  | x  1 112478962961 B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   221
  |/
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   222
  o  0 426bada5c675 A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   223
  
34795
530b7361e3a9 amend: add a flag `-n/--note` to store note with amend
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34121
diff changeset
   224
Checking the note stored in the obsmarker
530b7361e3a9 amend: add a flag `-n/--note` to store note with amend
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34121
diff changeset
   225
530b7361e3a9 amend: add a flag `-n/--note` to store note with amend
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34121
diff changeset
   226
  $ echo foo > bar
530b7361e3a9 amend: add a flag `-n/--note` to store note with amend
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34121
diff changeset
   227
  $ hg add bar
34889
554885e10868 amend: error out if the note is greater than 255bytes
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34867
diff changeset
   228
  $ hg amend --note 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
554885e10868 amend: error out if the note is greater than 255bytes
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34867
diff changeset
   229
  abort: cannot store a note of more than 255 bytes
45827
8d72e29ad1e0 errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 45765
diff changeset
   230
  [10]
34795
530b7361e3a9 amend: add a flag `-n/--note` to store note with amend
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34121
diff changeset
   231
  $ hg amend --note "adding bar"
530b7361e3a9 amend: add a flag `-n/--note` to store note with amend
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34121
diff changeset
   232
  $ hg debugobsolete -r .
34961
a7e49a5b3e6f obsolete: activate effect-flag by default
Boris Feld <boris.feld@octobus.net>
parents: 34889
diff changeset
   233
  112478962961147124edd43549aedd1a335e44bf be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
a7e49a5b3e6f obsolete: activate effect-flag by default
Boris Feld <boris.feld@octobus.net>
parents: 34889
diff changeset
   234
  be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 16084da537dd8f84cfdb3055c633772269d62e1b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'note': 'adding bar', 'operation': 'amend', 'user': 'test'}
47020
ba6881c6a178 rewriteutil: check for divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47018
diff changeset
   235
ba6881c6a178 rewriteutil: check for divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47018
diff changeset
   236
Cannot cause divergence by default
ba6881c6a178 rewriteutil: check for divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47018
diff changeset
   237
ba6881c6a178 rewriteutil: check for divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47018
diff changeset
   238
  $ hg co --hidden 1
ba6881c6a178 rewriteutil: check for divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47018
diff changeset
   239
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
ba6881c6a178 rewriteutil: check for divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47018
diff changeset
   240
  $ hg amend -m divergent
ba6881c6a178 rewriteutil: check for divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47018
diff changeset
   241
  abort: cannot amend 112478962961, as that creates content-divergence with 16084da537dd
47271
055f7b9f2307 rewriteutil: add pointer to help text when rewrite would cause divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47070
diff changeset
   242
  (add --verbose for details or see 'hg help evolution.instability')
47020
ba6881c6a178 rewriteutil: check for divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47018
diff changeset
   243
  [10]
47375
8125bcd28a5c rewriteutil: add pointer to help text when rewrite would cause divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47271
diff changeset
   244
  $ hg amend -m divergent --verbose
8125bcd28a5c rewriteutil: add pointer to help text when rewrite would cause divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47271
diff changeset
   245
  abort: cannot amend 112478962961, as that creates content-divergence with 16084da537dd
8125bcd28a5c rewriteutil: add pointer to help text when rewrite would cause divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47271
diff changeset
   246
      changeset 112478962961 already has a successor in changeset 16084da537dd
8125bcd28a5c rewriteutil: add pointer to help text when rewrite would cause divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47271
diff changeset
   247
      rewriting changeset 112478962961 would create "content-divergence"
8125bcd28a5c rewriteutil: add pointer to help text when rewrite would cause divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47271
diff changeset
   248
      set experimental.evolution.allowdivergence=True to skip this check
8125bcd28a5c rewriteutil: add pointer to help text when rewrite would cause divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47271
diff changeset
   249
  (see 'hg help evolution.instability' for details on content-divergence)
8125bcd28a5c rewriteutil: add pointer to help text when rewrite would cause divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47271
diff changeset
   250
  [10]
47020
ba6881c6a178 rewriteutil: check for divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47018
diff changeset
   251
  $ hg amend -m divergent --config experimental.evolution.allowdivergence=true
ba6881c6a178 rewriteutil: check for divergence
Martin von Zweigbergk <martinvonz@google.com>
parents: 47018
diff changeset
   252
  2 new content-divergent changesets
47552
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   253
47554
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   254
Amending pruned part of split commit does not cause divergence (issue6262)
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   255
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   256
  $ hg debugobsolete $(hg log  -T '{node}' -r .)
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   257
  1 new obsolescence markers
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   258
  obsoleted 1 changesets
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   259
  $ hg co '.^'
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   260
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   261
  $ node_B=$(hg log -T '{node}' -r 4)
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   262
  $ hg revert -r $node_B -a
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   263
  adding B
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   264
  adding bar
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   265
  $ hg ci -m B-split1
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   266
  created new head
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   267
  $ node_B_split1=$(hg log -T '{node}' -r .)
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   268
  $ hg co '.^'
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   269
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   270
  $ hg revert -r 4 -a
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   271
  adding B
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   272
  adding bar
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   273
  $ hg ci -m B-split2
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   274
  created new head
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   275
  $ node_B_split2=$(hg log -T '{node}' -r .)
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   276
  $ hg debugobsolete $node_B $node_B_split1 $node_B_split2
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   277
  1 new obsolescence markers
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   278
  obsoleted 1 changesets
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   279
  $ hg debugobsolete $node_B_split2
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   280
  1 new obsolescence markers
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   281
  obsoleted 1 changesets
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   282
  $ hg co --hidden $node_B_split2
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   283
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   284
  $ hg amend -m 'revived B-split2'
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   285
  abort: cannot amend 809fe227532f, as that creates content-divergence with c68306a86921, from 16084da537dd (known-bad-output !)
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   286
  (add --verbose for details or see 'hg help evolution.instability') (known-bad-output !)
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   287
  [10]
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   288
47552
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   289
Hidden common predecessor of divergence does not cause crash
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   290
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   291
First create C1 as a pruned successor of C
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   292
  $ hg co C
47554
c8f8d2dba6c7 tests: add test case for issue 6262
Martin von Zweigbergk <martinvonz@google.com>
parents: 47553
diff changeset
   293
  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
47552
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   294
  $ hg amend -m C1
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   295
  $ hg tag --local C1
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   296
  $ hg debugobsolete $(hg log -T '{node}' -r C1)
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   297
  1 new obsolescence markers
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   298
  obsoleted 1 changesets
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   299
Now create C2 as other side of divergence (not actually divergent because C1 is
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   300
pruned)
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   301
  $ hg co C
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   302
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   303
  $ hg amend -m C2
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   304
  1 new orphan changesets
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   305
Make the common predecessor (C) pruned
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   306
  $ hg tag --local --remove C
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   307
  $ hg co C1
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   308
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   309
Try to cause divergence
93ca7d3278b9 tests: demonstrate crash when common predecessor of divergence is hidden
Martin von Zweigbergk <martinvonz@google.com>
parents: 47375
diff changeset
   310
  $ hg amend -m C11
47553
debc29900b97 rewriteutil: look up common predecessor on unfiltered repo
Martin von Zweigbergk <martinvonz@google.com>
parents: 47552
diff changeset
   311
  abort: cannot amend 2758767f5d17, as that creates content-divergence with bfcb433a0dea, from 26805aba1e60
debc29900b97 rewriteutil: look up common predecessor on unfiltered repo
Martin von Zweigbergk <martinvonz@google.com>
parents: 47552
diff changeset
   312
  (add --verbose for details or see 'hg help evolution.instability')
debc29900b97 rewriteutil: look up common predecessor on unfiltered repo
Martin von Zweigbergk <martinvonz@google.com>
parents: 47552
diff changeset
   313
  [10]
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   314
#endif
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   315
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   316
Cannot amend public changeset
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   317
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   318
  $ hg phase -r A --public
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   319
  $ 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
   320
  $ hg amend -m AMEND
47069
5b6dd0d9171b rewriteutil: give examples of public changesets that can't be rewritten
Martin von Zweigbergk <martinvonz@google.com>
parents: 47020
diff changeset
   321
  abort: cannot amend public changesets: 426bada5c675
35244
98f97eb20597 rewriteutil: use precheck() in uncommit and amend commands
Pulkit Goyal <7895pulkit@gmail.com>
parents: 35163
diff changeset
   322
  (see 'hg help phases' for details)
45853
b4694ef45db5 errors: raise more specific errors from rewriteutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 45827
diff changeset
   323
  [10]
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   324
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   325
Amend a merge changeset
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   326
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   327
  $ hg init $TESTTMP/repo3
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   328
  $ cd $TESTTMP/repo3
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   329
  $ hg debugdrawdag <<'EOS'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   330
  >   C
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   331
  >  /|
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   332
  > A B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   333
  > EOS
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   334
  $ hg update -q C
34053
24ce7b0edaf9 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com>
parents: 33773
diff changeset
   335
  $ hg amend -m FOO
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 35244
diff changeset
   336
  saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (obsstore-off !)
33404
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   337
  $ rm .hg/localtags
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   338
  $ hg log -G -T '{desc}\n'
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   339
  @    FOO
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   340
  |\
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   341
  | o  B
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   342
  |
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   343
  o  A
0d5afd360e9e amend: new extension providing the amend command
Jun Wu <quark@fb.com>
parents:
diff changeset
   344
  
35021
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   345
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   346
More complete test for status changes (issue5732)
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   347
-------------------------------------------------
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   348
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   349
Generates history of files having 3 states, r0_r1_wc:
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   350
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   351
 r0: ground (content/missing)
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   352
 r1: old state to be amended (content/missing, where missing means removed)
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   353
 wc: changes to be included in r1 (content/missing-tracked/untracked)
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   354
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   355
  $ hg init $TESTTMP/wcstates
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   356
  $ cd $TESTTMP/wcstates
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   357
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 38817
diff changeset
   358
  $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 1
35021
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   359
  $ hg addremove -q --similarity 0
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   360
  $ hg commit -m0
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   361
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 38817
diff changeset
   362
  $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 2
35021
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   363
  $ hg addremove -q --similarity 0
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   364
  $ hg commit -m1
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   365
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 38817
diff changeset
   366
  $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 wc
35021
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   367
  $ hg addremove -q --similarity 0
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   368
  $ hg forget *_*_*-untracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   369
  $ rm *_*_missing-*
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   370
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   371
amend r1 to include wc changes
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   372
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   373
  $ hg amend
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   374
  saved backup bundle to * (glob) (obsstore-off !)
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   375
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   376
clean/modified/removed/added states of the amended revision
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   377
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   378
  $ hg status --all --change . 'glob:content1_*_content1-tracked'
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   379
  C content1_content1_content1-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   380
  C content1_content2_content1-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   381
  C content1_missing_content1-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   382
  $ hg status --all --change . 'glob:content1_*_content[23]-tracked'
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   383
  M content1_content1_content3-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   384
  M content1_content2_content2-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   385
  M content1_content2_content3-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   386
  M content1_missing_content3-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   387
  $ hg status --all --change . 'glob:content1_*_missing-tracked'
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   388
  M content1_content2_missing-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   389
  R content1_missing_missing-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   390
  C content1_content1_missing-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   391
  $ hg status --all --change . 'glob:content1_*_*-untracked'
35022
0ba3b928f9a9 amend: do not take untracked files as modified or clean (issue5732)
Yuya Nishihara <yuya@tcha.org>
parents: 35021
diff changeset
   392
  R content1_content1_content1-untracked
0ba3b928f9a9 amend: do not take untracked files as modified or clean (issue5732)
Yuya Nishihara <yuya@tcha.org>
parents: 35021
diff changeset
   393
  R content1_content1_content3-untracked
35021
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   394
  R content1_content1_missing-untracked
35022
0ba3b928f9a9 amend: do not take untracked files as modified or clean (issue5732)
Yuya Nishihara <yuya@tcha.org>
parents: 35021
diff changeset
   395
  R content1_content2_content1-untracked
0ba3b928f9a9 amend: do not take untracked files as modified or clean (issue5732)
Yuya Nishihara <yuya@tcha.org>
parents: 35021
diff changeset
   396
  R content1_content2_content2-untracked
0ba3b928f9a9 amend: do not take untracked files as modified or clean (issue5732)
Yuya Nishihara <yuya@tcha.org>
parents: 35021
diff changeset
   397
  R content1_content2_content3-untracked
35021
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   398
  R content1_content2_missing-untracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   399
  R content1_missing_content1-untracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   400
  R content1_missing_content3-untracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   401
  R content1_missing_missing-untracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   402
  $ hg status --all --change . 'glob:missing_content2_*'
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   403
  A missing_content2_content2-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   404
  A missing_content2_content3-tracked
35023
5f40efa472db amend: do not drop missing files (issue5732)
Yuya Nishihara <yuya@tcha.org>
parents: 35022
diff changeset
   405
  A missing_content2_missing-tracked
35021
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   406
  $ hg status --all --change . 'glob:missing_missing_*'
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   407
  A missing_missing_content3-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   408
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   409
working directory should be all clean (with some missing/untracked files)
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   410
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   411
  $ hg status --all 'glob:*_content?-tracked'
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   412
  C content1_content1_content1-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   413
  C content1_content1_content3-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   414
  C content1_content2_content1-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   415
  C content1_content2_content2-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   416
  C content1_content2_content3-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   417
  C content1_missing_content1-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   418
  C content1_missing_content3-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   419
  C missing_content2_content2-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   420
  C missing_content2_content3-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   421
  C missing_missing_content3-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   422
  $ hg status --all 'glob:*_missing-tracked'
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   423
  ! content1_content1_missing-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   424
  ! content1_content2_missing-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   425
  ! content1_missing_missing-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   426
  ! missing_content2_missing-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   427
  ! missing_missing_missing-tracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   428
  $ hg status --all 'glob:*-untracked'
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   429
  ? content1_content1_content1-untracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   430
  ? content1_content1_content3-untracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   431
  ? content1_content2_content1-untracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   432
  ? content1_content2_content2-untracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   433
  ? content1_content2_content3-untracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   434
  ? content1_missing_content1-untracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   435
  ? content1_missing_content3-untracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   436
  ? missing_content2_content2-untracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   437
  ? missing_content2_content3-untracked
b69c700b6de6 tests: add more complete test for status changes on amend
Yuya Nishihara <yuya@tcha.org>
parents: 34889
diff changeset
   438
  ? missing_missing_content3-untracked
38817
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   439
41206
6acbe86c6490 repair: move ui.history-editing-backup to [rewrite] section
Yuya Nishihara <yuya@tcha.org>
parents: 41173
diff changeset
   440
=================================
6acbe86c6490 repair: move ui.history-editing-backup to [rewrite] section
Yuya Nishihara <yuya@tcha.org>
parents: 41173
diff changeset
   441
Test backup-bundle config option|
6acbe86c6490 repair: move ui.history-editing-backup to [rewrite] section
Yuya Nishihara <yuya@tcha.org>
parents: 41173
diff changeset
   442
=================================
38817
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   443
  $ hg init $TESTTMP/repo4
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   444
  $ cd $TESTTMP/repo4
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   445
  $ echo a>a
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   446
  $ hg ci -Aqma
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   447
  $ echo oops>b
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   448
  $ hg ci -Aqm "b"
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   449
  $ echo partiallyfixed > b
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   450
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   451
#if obsstore-off
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   452
  $ hg amend
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   453
  saved backup bundle to $TESTTMP/repo4/.hg/strip-backup/95e899acf2ce-f11cb050-amend.hg
41206
6acbe86c6490 repair: move ui.history-editing-backup to [rewrite] section
Yuya Nishihara <yuya@tcha.org>
parents: 41173
diff changeset
   454
When backup-bundle config option is set:
38817
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   455
  $ cat << EOF >> $HGRCPATH
41206
6acbe86c6490 repair: move ui.history-editing-backup to [rewrite] section
Yuya Nishihara <yuya@tcha.org>
parents: 41173
diff changeset
   456
  > [rewrite]
6acbe86c6490 repair: move ui.history-editing-backup to [rewrite] section
Yuya Nishihara <yuya@tcha.org>
parents: 41173
diff changeset
   457
  > backup-bundle = False
38817
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   458
  > EOF
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   459
  $ echo fixed > b
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   460
  $ hg amend
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   461
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   462
#else
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   463
  $ hg amend
41206
6acbe86c6490 repair: move ui.history-editing-backup to [rewrite] section
Yuya Nishihara <yuya@tcha.org>
parents: 41173
diff changeset
   464
When backup-bundle config option is set:
38817
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   465
  $ cat << EOF >> $HGRCPATH
41206
6acbe86c6490 repair: move ui.history-editing-backup to [rewrite] section
Yuya Nishihara <yuya@tcha.org>
parents: 41173
diff changeset
   466
  > [rewrite]
6acbe86c6490 repair: move ui.history-editing-backup to [rewrite] section
Yuya Nishihara <yuya@tcha.org>
parents: 41173
diff changeset
   467
  > backup-bundle = False
38817
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   468
  > EOF
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   469
  $ echo fixed > b
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   470
  $ hg amend
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   471
32ece991955c amend: support "history-editing-backup" config option
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 38299
diff changeset
   472
#endif
41120
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   473
==========================================
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   474
Test update-timestamp config option|
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   475
==========================================
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   476
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   477
  $ cat >> $HGRCPATH << EOF
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   478
  > [extensions]
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   479
  > amend=
41214
8633c716f908 tests: replace mockmakedate function in test-amend.t
Taapas Agrawal <taapas2897@gmail.com>
parents: 41206
diff changeset
   480
  > mockmakedate = $TESTDIR/mockmakedate.py
41120
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   481
  > EOF
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   482
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   483
  $ hg init $TESTTMP/repo5
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   484
  $ cd $TESTTMP/repo5
41122
14271b524d76 test-amend: remove uninteresting fields from log output to deduplicate tests
Yuya Nishihara <yuya@tcha.org>
parents: 41120
diff changeset
   485
  $ cat <<'EOF' >> .hg/hgrc
45765
ed84a4d48910 config: add a new [command-templates] section for templates defined by hg
Martin von Zweigbergk <martinvonz@google.com>
parents: 45388
diff changeset
   486
  > [command-templates]
ed84a4d48910 config: add a new [command-templates] section for templates defined by hg
Martin von Zweigbergk <martinvonz@google.com>
parents: 45388
diff changeset
   487
  > log = 'user:        {user}
ed84a4d48910 config: add a new [command-templates] section for templates defined by hg
Martin von Zweigbergk <martinvonz@google.com>
parents: 45388
diff changeset
   488
  >        date:        {date|date}
ed84a4d48910 config: add a new [command-templates] section for templates defined by hg
Martin von Zweigbergk <martinvonz@google.com>
parents: 45388
diff changeset
   489
  >        summary:     {desc|firstline}\n'
41122
14271b524d76 test-amend: remove uninteresting fields from log output to deduplicate tests
Yuya Nishihara <yuya@tcha.org>
parents: 41120
diff changeset
   490
  > EOF
14271b524d76 test-amend: remove uninteresting fields from log output to deduplicate tests
Yuya Nishihara <yuya@tcha.org>
parents: 41120
diff changeset
   491
41120
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   492
  $ echo a>a
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   493
  $ hg ci -Am 'commit 1'
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   494
  adding a
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   495
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   496
When updatetimestamp is False
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   497
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   498
  $ hg amend --date '1997-1-1 0:1'
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   499
  $ hg log --limit 1
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   500
  user:        test
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   501
  date:        Wed Jan 01 00:01:00 1997 +0000
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   502
  summary:     commit 1
41122
14271b524d76 test-amend: remove uninteresting fields from log output to deduplicate tests
Yuya Nishihara <yuya@tcha.org>
parents: 41120
diff changeset
   503
41120
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   504
 When update-timestamp is True and no other change than the date
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   505
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   506
  $ hg amend --config rewrite.update-timestamp=True
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   507
  nothing changed
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   508
  [1]
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   509
  $ hg log --limit 1
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   510
  user:        test
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   511
  date:        Wed Jan 01 00:01:00 1997 +0000
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   512
  summary:     commit 1
41122
14271b524d76 test-amend: remove uninteresting fields from log output to deduplicate tests
Yuya Nishihara <yuya@tcha.org>
parents: 41120
diff changeset
   513
41120
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   514
When update-timestamp is True and there is other change than the date
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   515
  $ hg amend --user foobar --config rewrite.update-timestamp=True
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   516
  $ hg log --limit 1
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   517
  user:        foobar
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   518
  date:        Thu Jan 01 00:00:02 1970 +0000
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   519
  summary:     commit 1
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   520
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   521
When date option is applicable and update-timestamp is True
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   522
  $ hg amend  --date '1998-1-1 0:1' --config rewrite.update-timestamp=True
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   523
  $ hg log --limit 1
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   524
  user:        foobar
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   525
  date:        Thu Jan 01 00:01:00 1998 +0000
79f8f032c706 amend: add config option to update time to current in hg amend (issue5828)
Taapas Agrawal <taapas2897@gmail.com>
parents: 39707
diff changeset
   526
  summary:     commit 1
41125
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   527
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   528
Unlike rewrite.update-timestamp, -D/--currentdate always updates the timestamp
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   529
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   530
  $ hg amend -D
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   531
  $ hg log --limit 1
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   532
  user:        foobar
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   533
  date:        Thu Jan 01 00:00:04 1970 +0000
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   534
  summary:     commit 1
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   535
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   536
  $ hg amend -D --config rewrite.update-timestamp=True
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   537
  $ hg log --limit 1
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   538
  user:        foobar
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   539
  date:        Thu Jan 01 00:00:05 1970 +0000
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   540
  summary:     commit 1
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   541
41173
4145fd3569c3 amend: turn currentdate into tri-state bool so config option can be negated
Yuya Nishihara <yuya@tcha.org>
parents: 41125
diff changeset
   542
rewrite.update-timestamp can be negated by --no-currentdate
4145fd3569c3 amend: turn currentdate into tri-state bool so config option can be negated
Yuya Nishihara <yuya@tcha.org>
parents: 41125
diff changeset
   543
4145fd3569c3 amend: turn currentdate into tri-state bool so config option can be negated
Yuya Nishihara <yuya@tcha.org>
parents: 41125
diff changeset
   544
  $ hg amend --config rewrite.update-timestamp=True --no-currentdate -u baz
4145fd3569c3 amend: turn currentdate into tri-state bool so config option can be negated
Yuya Nishihara <yuya@tcha.org>
parents: 41125
diff changeset
   545
  $ hg log --limit 1
4145fd3569c3 amend: turn currentdate into tri-state bool so config option can be negated
Yuya Nishihara <yuya@tcha.org>
parents: 41125
diff changeset
   546
  user:        baz
4145fd3569c3 amend: turn currentdate into tri-state bool so config option can be negated
Yuya Nishihara <yuya@tcha.org>
parents: 41125
diff changeset
   547
  date:        Thu Jan 01 00:00:05 1970 +0000
4145fd3569c3 amend: turn currentdate into tri-state bool so config option can be negated
Yuya Nishihara <yuya@tcha.org>
parents: 41125
diff changeset
   548
  summary:     commit 1
4145fd3569c3 amend: turn currentdate into tri-state bool so config option can be negated
Yuya Nishihara <yuya@tcha.org>
parents: 41125
diff changeset
   549
41125
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   550
Bad combination of date options:
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   551
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   552
  $ hg amend -D --date '0 0'
43893
2e672ccc2220 commit: use cmdutil.check_at_most_one_arg()
Martin von Zweigbergk <martinvonz@google.com>
parents: 43828
diff changeset
   553
  abort: cannot specify both --date and --currentdate
45827
8d72e29ad1e0 errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 45765
diff changeset
   554
  [10]
41125
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   555
42934
09d46b90f6f9 amend: enable support for closing the branch
Matt Harbison <matt_harbison@yahoo.com>
parents: 42643
diff changeset
   556
Close branch
09d46b90f6f9 amend: enable support for closing the branch
Matt Harbison <matt_harbison@yahoo.com>
parents: 42643
diff changeset
   557
42935
f10a0f5eedae amend: enable support for using the secret phase
Matt Harbison <matt_harbison@yahoo.com>
parents: 42934
diff changeset
   558
  $ hg amend --secret --close-branch
f10a0f5eedae amend: enable support for using the secret phase
Matt Harbison <matt_harbison@yahoo.com>
parents: 42934
diff changeset
   559
  $ hg log --limit 1 -T 'close={get(extras, "close")}\nphase={phase}\n'
42934
09d46b90f6f9 amend: enable support for closing the branch
Matt Harbison <matt_harbison@yahoo.com>
parents: 42643
diff changeset
   560
  close=1
42935
f10a0f5eedae amend: enable support for using the secret phase
Matt Harbison <matt_harbison@yahoo.com>
parents: 42934
diff changeset
   561
  phase=secret
42934
09d46b90f6f9 amend: enable support for closing the branch
Matt Harbison <matt_harbison@yahoo.com>
parents: 42643
diff changeset
   562
49772
e78a41686464 amend: add a --draft option to set phase to draft
Martin von Zweigbergk <martinvonz@google.com>
parents: 49179
diff changeset
   563
`hg amend --draft` sets phase to draft
e78a41686464 amend: add a --draft option to set phase to draft
Martin von Zweigbergk <martinvonz@google.com>
parents: 49179
diff changeset
   564
e78a41686464 amend: add a --draft option to set phase to draft
Martin von Zweigbergk <martinvonz@google.com>
parents: 49179
diff changeset
   565
  $ hg amend --draft -m declassified
e78a41686464 amend: add a --draft option to set phase to draft
Martin von Zweigbergk <martinvonz@google.com>
parents: 49179
diff changeset
   566
  $ hg log --limit 1 -T 'phase={phase}\n'
e78a41686464 amend: add a --draft option to set phase to draft
Martin von Zweigbergk <martinvonz@google.com>
parents: 49179
diff changeset
   567
  phase=draft
e78a41686464 amend: add a --draft option to set phase to draft
Martin von Zweigbergk <martinvonz@google.com>
parents: 49179
diff changeset
   568
41125
126101284e04 amend: add -D/--currentdate option
Yuya Nishihara <yuya@tcha.org>
parents: 41122
diff changeset
   569
  $ cd ..
42642
464aa857c717 amend: add a test for a simplified version of issue6157
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42566
diff changeset
   570
464aa857c717 amend: add a test for a simplified version of issue6157
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42566
diff changeset
   571
Corner case of amend from issue6157:
464aa857c717 amend: add a test for a simplified version of issue6157
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42566
diff changeset
   572
- working copy parent has a change to file `a`
464aa857c717 amend: add a test for a simplified version of issue6157
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42566
diff changeset
   573
- working copy has the inverse change
464aa857c717 amend: add a test for a simplified version of issue6157
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42566
diff changeset
   574
- we amend the working copy parent for files other than `a`
42643
ce52377102db amend: stop committing unrequested file reverts (issue6157)
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42642
diff changeset
   575
hg used to include the changes to `a` anyway.
42642
464aa857c717 amend: add a test for a simplified version of issue6157
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42566
diff changeset
   576
464aa857c717 amend: add a test for a simplified version of issue6157
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42566
diff changeset
   577
  $ hg init 6157; cd 6157
464aa857c717 amend: add a test for a simplified version of issue6157
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42566
diff changeset
   578
  $ echo a > a; echo b > b; hg commit -qAm_
464aa857c717 amend: add a test for a simplified version of issue6157
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42566
diff changeset
   579
  $ echo a2 > a; hg commit -qm_
464aa857c717 amend: add a test for a simplified version of issue6157
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42566
diff changeset
   580
  $ hg diff --stat -c .
464aa857c717 amend: add a test for a simplified version of issue6157
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42566
diff changeset
   581
   a |  2 +-
464aa857c717 amend: add a test for a simplified version of issue6157
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42566
diff changeset
   582
   1 files changed, 1 insertions(+), 1 deletions(-)
464aa857c717 amend: add a test for a simplified version of issue6157
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42566
diff changeset
   583
  $ echo a > a; echo b2 > b; hg amend -q b
464aa857c717 amend: add a test for a simplified version of issue6157
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42566
diff changeset
   584
  $ hg diff --stat -c .
42643
ce52377102db amend: stop committing unrequested file reverts (issue6157)
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42642
diff changeset
   585
   a |  2 +-
42642
464aa857c717 amend: add a test for a simplified version of issue6157
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42566
diff changeset
   586
   b |  2 +-
42643
ce52377102db amend: stop committing unrequested file reverts (issue6157)
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42642
diff changeset
   587
   2 files changed, 2 insertions(+), 2 deletions(-)
43799
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   588
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   589
Modifying a file while the editor is open can cause dirstate corruption
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   590
(issue6233)
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   591
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   592
  $ cd $TESTTMP
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   593
  $ hg init modify-during-amend; cd modify-during-amend
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   594
  $ echo r0 > foo; hg commit -qAm "r0"
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   595
  $ echo alpha > foo; hg commit -qm "alpha"
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   596
  $ echo beta >> foo
44259
141ceec06b55 test: simplify test-amend.t to avoid race condition
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43894
diff changeset
   597
  $ cat > $TESTTMP/touchy_editor.sh <<EOF
141ceec06b55 test: simplify test-amend.t to avoid race condition
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43894
diff changeset
   598
  > sleep 1
44377
1813f79017ac tests: stabilize test-amend.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 44259
diff changeset
   599
  > echo delta >> "$TESTTMP/modify-during-amend/foo"
44259
141ceec06b55 test: simplify test-amend.t to avoid race condition
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43894
diff changeset
   600
  > sleep 1
43799
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   601
  > echo hi > "\$1"
44259
141ceec06b55 test: simplify test-amend.t to avoid race condition
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43894
diff changeset
   602
  > sleep 1
43799
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   603
  > EOF
44259
141ceec06b55 test: simplify test-amend.t to avoid race condition
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43894
diff changeset
   604
  $ HGEDITOR="sh $TESTTMP/touchy_editor.sh" hg commit --amend
43828
36444dddaeb4 tests: replace [[]] bashism with portable [] invocation
Augie Fackler <augie@google.com>
parents: 43799
diff changeset
   605
  $ if (hg diff -c . | grep 'delta' >/dev/null) || [ -n "$(hg status)" ]; then
43799
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   606
  >   echo "OK."
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   607
  > else
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   608
  >   echo "Bug detected. 'delta' is not part of the commit OR the wdir"
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   609
  >   echo "Diff and status before rebuild:"
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   610
  >   hg diff
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   611
  >   hg status
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   612
  >   hg debugrebuilddirstate
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   613
  >   echo "Diff and status after rebuild:"
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   614
  >   hg diff
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   615
  >   hg status
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   616
  > fi
5558e3437872 amend: check for file modifications when updating dirstate (issue6233)
Kyle Lippincott <spectral@google.com>
parents: 42935
diff changeset
   617
  OK.
49178
dc342071297f amend: add test showing poor behavior when copies are involved
Kyle Lippincott <spectral@google.com>
parents: 47554
diff changeset
   618
dc342071297f amend: add test showing poor behavior when copies are involved
Kyle Lippincott <spectral@google.com>
parents: 47554
diff changeset
   619
Amending a commit that has copies but not specifying those copies shouldn't
dc342071297f amend: add test showing poor behavior when copies are involved
Kyle Lippincott <spectral@google.com>
parents: 47554
diff changeset
   620
cause them to be lost
dc342071297f amend: add test showing poor behavior when copies are involved
Kyle Lippincott <spectral@google.com>
parents: 47554
diff changeset
   621
dc342071297f amend: add test showing poor behavior when copies are involved
Kyle Lippincott <spectral@google.com>
parents: 47554
diff changeset
   622
  $ cd $TESTTMP
dc342071297f amend: add test showing poor behavior when copies are involved
Kyle Lippincott <spectral@google.com>
parents: 47554
diff changeset
   623
  $ hg init dont-lose-copies; cd dont-lose-copies
dc342071297f amend: add test showing poor behavior when copies are involved
Kyle Lippincott <spectral@google.com>
parents: 47554
diff changeset
   624
  $ echo r0 > r0; hg commit -qAm "r0"
dc342071297f amend: add test showing poor behavior when copies are involved
Kyle Lippincott <spectral@google.com>
parents: 47554
diff changeset
   625
  $ hg cp r0 r0_copied; hg commit -qm "copy r0"
dc342071297f amend: add test showing poor behavior when copies are involved
Kyle Lippincott <spectral@google.com>
parents: 47554
diff changeset
   626
  $ echo hi > new_file_amend_me
dc342071297f amend: add test showing poor behavior when copies are involved
Kyle Lippincott <spectral@google.com>
parents: 47554
diff changeset
   627
  $ hg status --change . --copies
dc342071297f amend: add test showing poor behavior when copies are involved
Kyle Lippincott <spectral@google.com>
parents: 47554
diff changeset
   628
  A r0_copied
dc342071297f amend: add test showing poor behavior when copies are involved
Kyle Lippincott <spectral@google.com>
parents: 47554
diff changeset
   629
    r0
dc342071297f amend: add test showing poor behavior when copies are involved
Kyle Lippincott <spectral@google.com>
parents: 47554
diff changeset
   630
  $ hg amend -qA new_file_amend_me
dc342071297f amend: add test showing poor behavior when copies are involved
Kyle Lippincott <spectral@google.com>
parents: 47554
diff changeset
   631
  $ hg status --change . --copies
dc342071297f amend: add test showing poor behavior when copies are involved
Kyle Lippincott <spectral@google.com>
parents: 47554
diff changeset
   632
  A new_file_amend_me
dc342071297f amend: add test showing poor behavior when copies are involved
Kyle Lippincott <spectral@google.com>
parents: 47554
diff changeset
   633
  A r0_copied
49179
df68d64b0d50 amend: stop specifying matcher, get all copies in wctx
Kyle Lippincott <spectral@google.com>
parents: 49178
diff changeset
   634
    r0