annotate tests/test-amend.t @ 6931:237f99ee3d64 stable

tests: remove leading spaces in `hg help` output, run only on Mercurial 6.9+ Core decided to remove a lot of leading spaces in docstrings to support Python 3.13, see 51057ab0dffa for details.
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 11 Nov 2024 10:39:57 +0400
parents 5e14782908e4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
263
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
1 $ cat >> $HGRCPATH <<EOF
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
2 > [extensions]
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
3 > EOF
1806
9f42f819267b evolve: move the extensions to 'hgext3rd'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1673
diff changeset
4 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
263
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
5
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
6 $ glog() {
2776
4dd84054ebbb test: remove reference to the graphlog extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2730
diff changeset
7 > hg log -G --template '{rev}@{branch}({phase}) {desc|firstline}\n' "$@"
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
8 > }
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
9
630
722b52c75f02 compat: adapt to upstreaming of divergent logic
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 491
diff changeset
10 $ hg init repo --traceback
263
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
11 $ cd repo
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
12 $ echo a > a
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
13 $ hg ci -Am adda
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
14 adding a
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
15
984
b286f77d680c tests: fix grammar, spelling, punctuation in comments
Greg Ward <greg@gerg.ca>
parents: 976
diff changeset
16 Test that amend captures branches
263
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
17
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
18 $ hg branch foo
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
19 marked working directory as branch foo
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
20 (branches are permanent and global, did you want a bookmark?)
3221
9f3521cc4c90 amend: add support for storing a note in obsmarker
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3013
diff changeset
21 $ hg amend -d '0 0' -n "this a note on the obsmarker and supported for hg>=4.4"
441
d702f0d26c6a obsolete: remove debugsuccessors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 385
diff changeset
22 $ hg debugobsolete
2578
7795a86ba326 effectflag: activate effect flag on test-amend.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
23 07f4944404050f47db2e5c5071e0e84e7a27bba9 6a022cbb61d5ba0f03f98ff2d36319dfea1034ae 0 (*) {'ef1': '*', 'user': 'test'} (glob)
5301
e8660b28bfee obslog: makes --origin flag the default
Anton Shestakov <av6@dwimlabs.net>
parents: 5123
diff changeset
24 $ hg obslog --no-origin
3221
9f3521cc4c90 amend: add support for storing a note in obsmarker
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3013
diff changeset
25 @ 6a022cbb61d5 (1) adda
9f3521cc4c90 amend: add support for storing a note in obsmarker
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3013
diff changeset
26 |
9f3521cc4c90 amend: add support for storing a note in obsmarker
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3013
diff changeset
27 x 07f494440405 (0) adda
5123
900668a93629 obslog: use _successorsetverb() in regular obslog too
Anton Shestakov <av6@dwimlabs.net>
parents: 5079
diff changeset
28 branch-changed(branch) as 6a022cbb61d5 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
3223
73b4e84df0bd obsnote: don't add '' to note while showing it in obslog
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3221
diff changeset
29 note: this a note on the obsmarker and supported for hg>=4.4
3221
9f3521cc4c90 amend: add support for storing a note in obsmarker
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3013
diff changeset
30
5301
e8660b28bfee obslog: makes --origin flag the default
Anton Shestakov <av6@dwimlabs.net>
parents: 5123
diff changeset
31 $ hg obslog
e8660b28bfee obslog: makes --origin flag the default
Anton Shestakov <av6@dwimlabs.net>
parents: 5123
diff changeset
32 @ 6a022cbb61d5 (1) adda
e8660b28bfee obslog: makes --origin flag the default
Anton Shestakov <av6@dwimlabs.net>
parents: 5123
diff changeset
33 | branch-changed(branch) from 07f494440405 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
e8660b28bfee obslog: makes --origin flag the default
Anton Shestakov <av6@dwimlabs.net>
parents: 5123
diff changeset
34 | note: this a note on the obsmarker and supported for hg>=4.4
e8660b28bfee obslog: makes --origin flag the default
Anton Shestakov <av6@dwimlabs.net>
parents: 5123
diff changeset
35 |
e8660b28bfee obslog: makes --origin flag the default
Anton Shestakov <av6@dwimlabs.net>
parents: 5123
diff changeset
36 x 07f494440405 (0) adda
e8660b28bfee obslog: makes --origin flag the default
Anton Shestakov <av6@dwimlabs.net>
parents: 5123
diff changeset
37
263
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
38 $ hg branch
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
39 foo
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
40 $ hg branches
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
41 foo 1:6a022cbb61d5
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
42 $ glog
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
43 @ 1@foo(draft) adda
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
44
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
45 Test no-op
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
46
974
5808aad40aca amend: in tests, do not rely on defaults -- always use explicit -d
Greg Ward <greg@gerg.ca>
parents: 742
diff changeset
47 $ hg amend -d '0 0'
742
760d01a549a6 amend: use core mechanism for amend
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 699
diff changeset
48 nothing changed
760d01a549a6 amend: use core mechanism for amend
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 699
diff changeset
49 [1]
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
50 $ glog
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
51 @ 1@foo(draft) adda
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
52
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
53
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
54 Test forcing the message to the same value, no intermediate revision.
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
55
974
5808aad40aca amend: in tests, do not rely on defaults -- always use explicit -d
Greg Ward <greg@gerg.ca>
parents: 742
diff changeset
56 $ hg amend -d '0 0' -m 'adda'
742
760d01a549a6 amend: use core mechanism for amend
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 699
diff changeset
57 nothing changed
760d01a549a6 amend: use core mechanism for amend
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 699
diff changeset
58 [1]
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
59 $ glog
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
60 @ 1@foo(draft) adda
263
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
61
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
62
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
63 Test collapsing into an existing revision, no intermediate revision.
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
64
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
65 $ echo a >> a
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
66 $ hg ci -m changea
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
67 $ echo a > a
445
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
68 $ hg status
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
69 M a
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
70 $ hg pstatus
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
71 $ hg diff
742
760d01a549a6 amend: use core mechanism for amend
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 699
diff changeset
72 diff -r f7a50201fe3a a
445
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
73 --- a/a Thu Jan 01 00:00:00 1970 +0000
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
74 +++ b/a * +0000 (glob)
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
75 @@ -1,2 +1,1 @@
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
76 a
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
77 -a
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
78 $ hg pdiff
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
79 $ hg ci -m reseta
441
d702f0d26c6a obsolete: remove debugsuccessors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 385
diff changeset
80 $ hg debugobsolete
2578
7795a86ba326 effectflag: activate effect flag on test-amend.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
81 07f4944404050f47db2e5c5071e0e84e7a27bba9 6a022cbb61d5ba0f03f98ff2d36319dfea1034ae 0 (*) {'ef1': '*', 'user': 'test'} (glob)
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
82 $ hg phase 2
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
83 2: draft
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
84 $ glog
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
85 @ 3@foo(draft) reseta
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
86 |
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
87 o 2@foo(draft) changea
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
88 |
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
89 o 1@foo(draft) adda
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
90
975
09d6036ad596 amend: explicitly test -d option
Greg Ward <greg@gerg.ca>
parents: 974
diff changeset
91 Specify precise commit date with -d
09d6036ad596 amend: explicitly test -d option
Greg Ward <greg@gerg.ca>
parents: 974
diff changeset
92 $ hg amend -d '2001-02-03 04:05:06 +0700'
09d6036ad596 amend: explicitly test -d option
Greg Ward <greg@gerg.ca>
parents: 974
diff changeset
93 $ hg parents --template '{rev} {date|date}\n'
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
94 4 Sat Feb 03 04:05:06 2001 +0700
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
95
976
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
96 Specify "now" as commit date with -D
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
97 $ before=`date +%s`
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
98 $ hg amend -D
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
99 $ commit=`hg parents --template '{date|hgdate} rev{rev}\n'`
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
100 $ after=`date +%s`
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
101 $ (echo $before ; echo $commit; echo $after) | sort -k1 -n -s
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
102 \d+ (re)
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
103 \d+ 0 rev5 (re)
976
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
104 \d+ (re)
985
6a37044ec0b3 amend: add -U/--current-user option (inspired by mq)
Greg Ward <greg@gerg.ca>
parents: 984
diff changeset
105
6a37044ec0b3 amend: add -U/--current-user option (inspired by mq)
Greg Ward <greg@gerg.ca>
parents: 984
diff changeset
106 Specify current user as committer with -U
6a37044ec0b3 amend: add -U/--current-user option (inspired by mq)
Greg Ward <greg@gerg.ca>
parents: 984
diff changeset
107 $ HGUSER=newbie hg amend -U
6a37044ec0b3 amend: add -U/--current-user option (inspired by mq)
Greg Ward <greg@gerg.ca>
parents: 984
diff changeset
108 $ hg parents --template '{rev} {author}\n'
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
109 6 newbie
1140
b7d85cd8ec7b amend: allow the --logfile argument to work properly
Matt Harbison <matt_harbison@yahoo.com>
parents: 1067
diff changeset
110
b7d85cd8ec7b amend: allow the --logfile argument to work properly
Matt Harbison <matt_harbison@yahoo.com>
parents: 1067
diff changeset
111 Check that --logfile works
b7d85cd8ec7b amend: allow the --logfile argument to work properly
Matt Harbison <matt_harbison@yahoo.com>
parents: 1067
diff changeset
112 $ echo "logfile message" > logfile.txt
b7d85cd8ec7b amend: allow the --logfile argument to work properly
Matt Harbison <matt_harbison@yahoo.com>
parents: 1067
diff changeset
113 $ hg amend -l logfile.txt
b7d85cd8ec7b amend: allow the --logfile argument to work properly
Matt Harbison <matt_harbison@yahoo.com>
parents: 1067
diff changeset
114 $ hg log -r . -T "{desc}\n"
b7d85cd8ec7b amend: allow the --logfile argument to work properly
Matt Harbison <matt_harbison@yahoo.com>
parents: 1067
diff changeset
115 logfile message
1142
9d85fd6e1474 test-amend: add a test for amend with no configured username (issue4211)
Matt Harbison <matt_harbison@yahoo.com>
parents: 1140
diff changeset
116
9d85fd6e1474 test-amend: add a test for amend with no configured username (issue4211)
Matt Harbison <matt_harbison@yahoo.com>
parents: 1140
diff changeset
117 # Make sure we don't get reparented to -1 with no username (issue4211)
9d85fd6e1474 test-amend: add a test for amend with no configured username (issue4211)
Matt Harbison <matt_harbison@yahoo.com>
parents: 1140
diff changeset
118 $ HGUSER=
9d85fd6e1474 test-amend: add a test for amend with no configured username (issue4211)
Matt Harbison <matt_harbison@yahoo.com>
parents: 1140
diff changeset
119 $ hg amend -e --config ui.username= -m "empty user"
9d85fd6e1474 test-amend: add a test for amend with no configured username (issue4211)
Matt Harbison <matt_harbison@yahoo.com>
parents: 1140
diff changeset
120 abort: no username supplied
1673
8e879d59b20e tests: change quoting pattern to match core's conventions
Laurent Charignon <lcharignon@fb.com>
parents: 1584
diff changeset
121 (use 'hg config --edit' to set your username)
1142
9d85fd6e1474 test-amend: add a test for amend with no configured username (issue4211)
Matt Harbison <matt_harbison@yahoo.com>
parents: 1140
diff changeset
122 [255]
9d85fd6e1474 test-amend: add a test for amend with no configured username (issue4211)
Matt Harbison <matt_harbison@yahoo.com>
parents: 1140
diff changeset
123 $ hg sum
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
124 parent: 7:* tip (glob)
1142
9d85fd6e1474 test-amend: add a test for amend with no configured username (issue4211)
Matt Harbison <matt_harbison@yahoo.com>
parents: 1140
diff changeset
125 logfile message
9d85fd6e1474 test-amend: add a test for amend with no configured username (issue4211)
Matt Harbison <matt_harbison@yahoo.com>
parents: 1140
diff changeset
126 branch: foo
9d85fd6e1474 test-amend: add a test for amend with no configured username (issue4211)
Matt Harbison <matt_harbison@yahoo.com>
parents: 1140
diff changeset
127 commit: 1 unknown (clean)
9d85fd6e1474 test-amend: add a test for amend with no configured username (issue4211)
Matt Harbison <matt_harbison@yahoo.com>
parents: 1140
diff changeset
128 update: (current)
1453
8ca31deb8db7 merge with stable
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1452
diff changeset
129 phases: 3 draft
1296
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
130
5079
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
131 setting the user after we have performed the test with no username
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
132 $ HGUSER=test
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
133
6931
237f99ee3d64 tests: remove leading spaces in `hg help` output, run only on Mercurial 6.9+
Anton Shestakov <av6@dwimlabs.net>
parents: 6123
diff changeset
134 #if hg69
1296
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
135 Check the help
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
136 $ hg amend -h
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
137 hg amend [OPTION]... [FILE]...
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
138
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
139 aliases: refresh
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
140
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
141 combine a changeset with updates and replace it with a new one
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
142
6931
237f99ee3d64 tests: remove leading spaces in `hg help` output, run only on Mercurial 6.9+
Anton Shestakov <av6@dwimlabs.net>
parents: 6123
diff changeset
143 Commits a new changeset incorporating both the changes to the given files and
237f99ee3d64 tests: remove leading spaces in `hg help` output, run only on Mercurial 6.9+
Anton Shestakov <av6@dwimlabs.net>
parents: 6123
diff changeset
144 all the changes from the current parent changeset into the repository.
1296
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
145
6931
237f99ee3d64 tests: remove leading spaces in `hg help` output, run only on Mercurial 6.9+
Anton Shestakov <av6@dwimlabs.net>
parents: 6123
diff changeset
146 See 'hg commit' for details about committing changes.
1296
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
147
6931
237f99ee3d64 tests: remove leading spaces in `hg help` output, run only on Mercurial 6.9+
Anton Shestakov <av6@dwimlabs.net>
parents: 6123
diff changeset
148 If you don't specify -m, the parent's message will be reused.
1296
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
149
6931
237f99ee3d64 tests: remove leading spaces in `hg help` output, run only on Mercurial 6.9+
Anton Shestakov <av6@dwimlabs.net>
parents: 6123
diff changeset
150 If --extract is specified, the behavior of 'hg amend' is reversed: Changes to
237f99ee3d64 tests: remove leading spaces in `hg help` output, run only on Mercurial 6.9+
Anton Shestakov <av6@dwimlabs.net>
parents: 6123
diff changeset
151 selected files in the checked out revision appear again as uncommitted changed
237f99ee3d64 tests: remove leading spaces in `hg help` output, run only on Mercurial 6.9+
Anton Shestakov <av6@dwimlabs.net>
parents: 6123
diff changeset
152 in the working directory.
2730
7fbb7a5d359f uncommit: expose the feature with a '--extract' to amend
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2726
diff changeset
153
6931
237f99ee3d64 tests: remove leading spaces in `hg help` output, run only on Mercurial 6.9+
Anton Shestakov <av6@dwimlabs.net>
parents: 6123
diff changeset
154 Returns 0 on success, 1 if nothing changed.
1296
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
155
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
156 options ([+] can be repeated):
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
157
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
158 -A --addremove mark new/missing files as added/removed before
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
159 committing
2730
7fbb7a5d359f uncommit: expose the feature with a '--extract' to amend
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2726
diff changeset
160 -a --all match all files
1296
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
161 -e --edit invoke editor on commit messages
2730
7fbb7a5d359f uncommit: expose the feature with a '--extract' to amend
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2726
diff changeset
162 --extract extract changes from the commit to the working copy
3660
f018656ca3bf amend: add a new flag `--patch` to `hg amend`
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3520
diff changeset
163 --patch make changes to wdir parent by editing patch
1296
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
164 --close-branch mark a branch as closed, hiding it from the branch
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
165 list
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
166 -s --secret use the secret phase for committing
4183
536c67823962 commands: adjust metavariables as appropriate
Anton Shestakov <av6@dwimlabs.net>
parents: 3660
diff changeset
167 -n --note TEXT store a note on amend
1296
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
168 -I --include PATTERN [+] include names matching the given patterns
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
169 -X --exclude PATTERN [+] exclude names matching the given patterns
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
170 -m --message TEXT use text as commit message
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
171 -l --logfile FILE read commit message from file
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
172 -d --date DATE record the specified date as commit date
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
173 -u --user USER record the specified user as committer
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
174 -D --current-date record the current date as commit date
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
175 -U --current-user record the current user as committer
1452
1bcbd14cf159 merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1451
diff changeset
176 -i --interactive use interactive mode
1296
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
177
23819e1d61fd evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents: 1185
diff changeset
178 (some details hidden, use --verbose to show complete help)
6931
237f99ee3d64 tests: remove leading spaces in `hg help` output, run only on Mercurial 6.9+
Anton Shestakov <av6@dwimlabs.net>
parents: 6123
diff changeset
179 #endif
4988
588b3484c131 amend: abort if both --patch and --extract are used
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4183
diff changeset
180
588b3484c131 amend: abort if both --patch and --extract are used
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4183
diff changeset
181 Check that we abort if --patch and --extract both are used at once
588b3484c131 amend: abort if both --patch and --extract are used
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4183
diff changeset
182 $ hg amend --patch --extract
588b3484c131 amend: abort if both --patch and --extract are used
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4183
diff changeset
183 abort: cannot use both --patch and --extract
588b3484c131 amend: abort if both --patch and --extract are used
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4183
diff changeset
184 [255]
5079
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
185
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
186 $ cd ..
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
187
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
188 Check the pre-check logic for content-divergence
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
189 $ hg init precheckrepo
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
190 $ cd precheckrepo
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
191 $ echo a > a
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
192 $ hg ci -Am "added a"
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
193 adding a
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
194 $ echo newchanges > a
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
195 $ hg amend
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
196 $ hg up 0 --hidden -q
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
197 updated to hidden changeset 9092f1db7931
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
198 (hidden revision '9092f1db7931' was rewritten as: aafaf407b00d)
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
199 working directory parent is obsolete! (9092f1db7931)
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
200
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
201 when rewritting an already rewritten changeset (i.e cset being rewritten will
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
202 be the base of divergence)
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
203 $ hg amend -m "i am gonna create divergence"
5970
65d4e47d7f26 rewriteutil: use precheck from core if recent enough
Martin von Zweigbergk <martinvonz@google.com>
parents: 5301
diff changeset
204 abort: cannot amend 9092f1db7931, as that creates content-divergence with aafaf407b00d
5079
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
205 (add --verbose for details or see 'hg help evolution.instability')
5970
65d4e47d7f26 rewriteutil: use precheck from core if recent enough
Martin von Zweigbergk <martinvonz@google.com>
parents: 5301
diff changeset
206 [10]
5079
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
207 $ hg amend -m "i am gonna create divergence" --verbose
5970
65d4e47d7f26 rewriteutil: use precheck from core if recent enough
Martin von Zweigbergk <martinvonz@google.com>
parents: 5301
diff changeset
208 abort: cannot amend 9092f1db7931, as that creates content-divergence with aafaf407b00d
65d4e47d7f26 rewriteutil: use precheck from core if recent enough
Martin von Zweigbergk <martinvonz@google.com>
parents: 5301
diff changeset
209 changeset 9092f1db7931 already has a successor in changeset aafaf407b00d
5079
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
210 rewriting changeset 9092f1db7931 would create "content-divergence"
5970
65d4e47d7f26 rewriteutil: use precheck from core if recent enough
Martin von Zweigbergk <martinvonz@google.com>
parents: 5301
diff changeset
211 set experimental.evolution.allowdivergence=True to skip this check
5079
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
212 (see 'hg help evolution.instability' for details on content-divergence)
5970
65d4e47d7f26 rewriteutil: use precheck from core if recent enough
Martin von Zweigbergk <martinvonz@google.com>
parents: 5301
diff changeset
213 [10]
5079
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
214
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
215 when rewritting a cset which has a predecessor with non-obsolete successor
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
216
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
217 to prepare the repo
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
218 1) create content-divergence
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
219 2) remove divergence by pruning one of the divergent cset
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
220 $ echo edited_a > a
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
221 $ hg ci -m "edited a"
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
222 1 new orphan changesets
6123
5e14782908e4 tests: update for obsolescence-aware head computation in core
Anton Shestakov <av6@dwimlabs.net>
parents: 5970
diff changeset
223 created new head
5079
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
224 $ hg debugobsolete $(hg id -ir 0 --debug) $(hg id -ir 2 --debug)
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
225 1 new obsolescence markers
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
226 2 new content-divergent changesets
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
227
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
228 remove divergence by pruning one side of divergenence
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
229 $ hg debugobsolete $(hg id -ir 2 --debug)
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
230 1 new obsolescence markers
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
231 obsoleted 1 changesets
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
232
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
233 $ hg evolve -l
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
234 $ hg amend -m "i am gonna create divergence"
5970
65d4e47d7f26 rewriteutil: use precheck from core if recent enough
Martin von Zweigbergk <martinvonz@google.com>
parents: 5301
diff changeset
235 abort: cannot amend f8c05838af90, as that creates content-divergence with aafaf407b00d, from 9092f1db7931
5079
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
236 (add --verbose for details or see 'hg help evolution.instability')
5970
65d4e47d7f26 rewriteutil: use precheck from core if recent enough
Martin von Zweigbergk <martinvonz@google.com>
parents: 5301
diff changeset
237 [10]
5079
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
238 $ hg amend -m "i am gonna create divergence" --verbose
5970
65d4e47d7f26 rewriteutil: use precheck from core if recent enough
Martin von Zweigbergk <martinvonz@google.com>
parents: 5301
diff changeset
239 abort: cannot amend f8c05838af90, as that creates content-divergence with aafaf407b00d, from 9092f1db7931
65d4e47d7f26 rewriteutil: use precheck from core if recent enough
Martin von Zweigbergk <martinvonz@google.com>
parents: 5301
diff changeset
240 changeset f8c05838af90 is a successor of changeset 9092f1db7931
65d4e47d7f26 rewriteutil: use precheck from core if recent enough
Martin von Zweigbergk <martinvonz@google.com>
parents: 5301
diff changeset
241 changeset 9092f1db7931 already has a successor in changeset aafaf407b00d
5079
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
242 rewriting changeset f8c05838af90 would create "content-divergence"
5970
65d4e47d7f26 rewriteutil: use precheck from core if recent enough
Martin von Zweigbergk <martinvonz@google.com>
parents: 5301
diff changeset
243 set experimental.evolution.allowdivergence=True to skip this check
5079
1f92a6aa40d6 evolve: add pre-check logic for content-divergence in rewriteutil.precheck()
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4988
diff changeset
244 (see 'hg help evolution.instability' for details on content-divergence)
5970
65d4e47d7f26 rewriteutil: use precheck from core if recent enough
Martin von Zweigbergk <martinvonz@google.com>
parents: 5301
diff changeset
245 [10]