##// END OF EJS Templates
tests: explicitly request changed version in c/d conflict in test-commit-amend.t...
Siddharth Agarwal -
r27597:fe150586 default
parent child Browse files
Show More
@@ -1,1156 +1,1158 b''
1 $ cat << EOF >> $HGRCPATH
1 $ cat << EOF >> $HGRCPATH
2 > [format]
2 > [format]
3 > usegeneraldelta=yes
3 > usegeneraldelta=yes
4 > EOF
4 > EOF
5
5
6 $ hg init
6 $ hg init
7
7
8 Setup:
8 Setup:
9
9
10 $ echo a >> a
10 $ echo a >> a
11 $ hg ci -Am 'base'
11 $ hg ci -Am 'base'
12 adding a
12 adding a
13
13
14 Refuse to amend public csets:
14 Refuse to amend public csets:
15
15
16 $ hg phase -r . -p
16 $ hg phase -r . -p
17 $ hg ci --amend
17 $ hg ci --amend
18 abort: cannot amend public changesets
18 abort: cannot amend public changesets
19 [255]
19 [255]
20 $ hg phase -r . -f -d
20 $ hg phase -r . -f -d
21
21
22 $ echo a >> a
22 $ echo a >> a
23 $ hg ci -Am 'base1'
23 $ hg ci -Am 'base1'
24
24
25 Nothing to amend:
25 Nothing to amend:
26
26
27 $ hg ci --amend -m 'base1'
27 $ hg ci --amend -m 'base1'
28 nothing changed
28 nothing changed
29 [1]
29 [1]
30
30
31 $ cat >> $HGRCPATH <<EOF
31 $ cat >> $HGRCPATH <<EOF
32 > [hooks]
32 > [hooks]
33 > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE"
33 > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE"
34 > EOF
34 > EOF
35
35
36 Amending changeset with changes in working dir:
36 Amending changeset with changes in working dir:
37 (and check that --message does not trigger an editor)
37 (and check that --message does not trigger an editor)
38
38
39 $ echo a >> a
39 $ echo a >> a
40 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1'
40 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1'
41 pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
41 pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
42 43f1ba15f28a tip
42 43f1ba15f28a tip
43 saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-f1bf3ab8-amend-backup.hg (glob)
43 saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-f1bf3ab8-amend-backup.hg (glob)
44 $ echo 'pretxncommit.foo = ' >> $HGRCPATH
44 $ echo 'pretxncommit.foo = ' >> $HGRCPATH
45 $ hg diff -c .
45 $ hg diff -c .
46 diff -r ad120869acf0 -r 43f1ba15f28a a
46 diff -r ad120869acf0 -r 43f1ba15f28a a
47 --- a/a Thu Jan 01 00:00:00 1970 +0000
47 --- a/a Thu Jan 01 00:00:00 1970 +0000
48 +++ b/a Thu Jan 01 00:00:00 1970 +0000
48 +++ b/a Thu Jan 01 00:00:00 1970 +0000
49 @@ -1,1 +1,3 @@
49 @@ -1,1 +1,3 @@
50 a
50 a
51 +a
51 +a
52 +a
52 +a
53 $ hg log
53 $ hg log
54 changeset: 1:43f1ba15f28a
54 changeset: 1:43f1ba15f28a
55 tag: tip
55 tag: tip
56 user: test
56 user: test
57 date: Thu Jan 01 00:00:00 1970 +0000
57 date: Thu Jan 01 00:00:00 1970 +0000
58 summary: amend base1
58 summary: amend base1
59
59
60 changeset: 0:ad120869acf0
60 changeset: 0:ad120869acf0
61 user: test
61 user: test
62 date: Thu Jan 01 00:00:00 1970 +0000
62 date: Thu Jan 01 00:00:00 1970 +0000
63 summary: base
63 summary: base
64
64
65
65
66 Check proper abort for empty message
66 Check proper abort for empty message
67
67
68 $ cat > editor.sh << '__EOF__'
68 $ cat > editor.sh << '__EOF__'
69 > #!/bin/sh
69 > #!/bin/sh
70 > echo "" > "$1"
70 > echo "" > "$1"
71 > __EOF__
71 > __EOF__
72 $ echo b > b
72 $ echo b > b
73 $ hg add b
73 $ hg add b
74 $ hg summary
74 $ hg summary
75 parent: 1:43f1ba15f28a tip
75 parent: 1:43f1ba15f28a tip
76 amend base1
76 amend base1
77 branch: default
77 branch: default
78 commit: 1 added, 1 unknown
78 commit: 1 added, 1 unknown
79 update: (current)
79 update: (current)
80 phases: 2 draft
80 phases: 2 draft
81 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
81 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
82 transaction abort!
82 transaction abort!
83 rollback completed
83 rollback completed
84 abort: empty commit message
84 abort: empty commit message
85 [255]
85 [255]
86 $ hg summary
86 $ hg summary
87 parent: 1:43f1ba15f28a tip
87 parent: 1:43f1ba15f28a tip
88 amend base1
88 amend base1
89 branch: default
89 branch: default
90 commit: 1 added, 1 unknown
90 commit: 1 added, 1 unknown
91 update: (current)
91 update: (current)
92 phases: 2 draft
92 phases: 2 draft
93
93
94 Add new file:
94 Add new file:
95 $ hg ci --amend -m 'amend base1 new file'
95 $ hg ci --amend -m 'amend base1 new file'
96 saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-7a3b3496-amend-backup.hg (glob)
96 saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-7a3b3496-amend-backup.hg (glob)
97
97
98 Remove file that was added in amended commit:
98 Remove file that was added in amended commit:
99 (and test logfile option)
99 (and test logfile option)
100 (and test that logfile option do not trigger an editor)
100 (and test that logfile option do not trigger an editor)
101
101
102 $ hg rm b
102 $ hg rm b
103 $ echo 'amend base1 remove new file' > ../logfile
103 $ echo 'amend base1 remove new file' > ../logfile
104 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
104 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
105 saved backup bundle to $TESTTMP/.hg/strip-backup/b8e3cb2b3882-0b55739a-amend-backup.hg (glob)
105 saved backup bundle to $TESTTMP/.hg/strip-backup/b8e3cb2b3882-0b55739a-amend-backup.hg (glob)
106
106
107 $ hg cat b
107 $ hg cat b
108 b: no such file in rev 74609c7f506e
108 b: no such file in rev 74609c7f506e
109 [1]
109 [1]
110
110
111 No changes, just a different message:
111 No changes, just a different message:
112
112
113 $ hg ci -v --amend -m 'no changes, new message'
113 $ hg ci -v --amend -m 'no changes, new message'
114 amending changeset 74609c7f506e
114 amending changeset 74609c7f506e
115 copying changeset 74609c7f506e to ad120869acf0
115 copying changeset 74609c7f506e to ad120869acf0
116 committing files:
116 committing files:
117 a
117 a
118 committing manifest
118 committing manifest
119 committing changelog
119 committing changelog
120 stripping amended changeset 74609c7f506e
120 stripping amended changeset 74609c7f506e
121 1 changesets found
121 1 changesets found
122 uncompressed size of bundle content:
122 uncompressed size of bundle content:
123 270 (changelog)
123 270 (changelog)
124 163 (manifests)
124 163 (manifests)
125 129 a
125 129 a
126 saved backup bundle to $TESTTMP/.hg/strip-backup/74609c7f506e-1bfde511-amend-backup.hg (glob)
126 saved backup bundle to $TESTTMP/.hg/strip-backup/74609c7f506e-1bfde511-amend-backup.hg (glob)
127 1 changesets found
127 1 changesets found
128 uncompressed size of bundle content:
128 uncompressed size of bundle content:
129 266 (changelog)
129 266 (changelog)
130 163 (manifests)
130 163 (manifests)
131 129 a
131 129 a
132 adding branch
132 adding branch
133 adding changesets
133 adding changesets
134 adding manifests
134 adding manifests
135 adding file changes
135 adding file changes
136 added 1 changesets with 1 changes to 1 files
136 added 1 changesets with 1 changes to 1 files
137 committed changeset 1:1cd866679df8
137 committed changeset 1:1cd866679df8
138 $ hg diff -c .
138 $ hg diff -c .
139 diff -r ad120869acf0 -r 1cd866679df8 a
139 diff -r ad120869acf0 -r 1cd866679df8 a
140 --- a/a Thu Jan 01 00:00:00 1970 +0000
140 --- a/a Thu Jan 01 00:00:00 1970 +0000
141 +++ b/a Thu Jan 01 00:00:00 1970 +0000
141 +++ b/a Thu Jan 01 00:00:00 1970 +0000
142 @@ -1,1 +1,3 @@
142 @@ -1,1 +1,3 @@
143 a
143 a
144 +a
144 +a
145 +a
145 +a
146 $ hg log
146 $ hg log
147 changeset: 1:1cd866679df8
147 changeset: 1:1cd866679df8
148 tag: tip
148 tag: tip
149 user: test
149 user: test
150 date: Thu Jan 01 00:00:00 1970 +0000
150 date: Thu Jan 01 00:00:00 1970 +0000
151 summary: no changes, new message
151 summary: no changes, new message
152
152
153 changeset: 0:ad120869acf0
153 changeset: 0:ad120869acf0
154 user: test
154 user: test
155 date: Thu Jan 01 00:00:00 1970 +0000
155 date: Thu Jan 01 00:00:00 1970 +0000
156 summary: base
156 summary: base
157
157
158
158
159 Disable default date on commit so when -d isn't given, the old date is preserved:
159 Disable default date on commit so when -d isn't given, the old date is preserved:
160
160
161 $ echo '[defaults]' >> $HGRCPATH
161 $ echo '[defaults]' >> $HGRCPATH
162 $ echo 'commit=' >> $HGRCPATH
162 $ echo 'commit=' >> $HGRCPATH
163
163
164 Test -u/-d:
164 Test -u/-d:
165
165
166 $ cat > .hg/checkeditform.sh <<EOF
166 $ cat > .hg/checkeditform.sh <<EOF
167 > env | grep HGEDITFORM
167 > env | grep HGEDITFORM
168 > true
168 > true
169 > EOF
169 > EOF
170 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0'
170 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0'
171 HGEDITFORM=commit.amend.normal
171 HGEDITFORM=commit.amend.normal
172 saved backup bundle to $TESTTMP/.hg/strip-backup/1cd866679df8-5f5bcb85-amend-backup.hg (glob)
172 saved backup bundle to $TESTTMP/.hg/strip-backup/1cd866679df8-5f5bcb85-amend-backup.hg (glob)
173 $ echo a >> a
173 $ echo a >> a
174 $ hg ci --amend -u foo -d '1 0'
174 $ hg ci --amend -u foo -d '1 0'
175 saved backup bundle to $TESTTMP/.hg/strip-backup/780e6f23e03d-83b10a27-amend-backup.hg (glob)
175 saved backup bundle to $TESTTMP/.hg/strip-backup/780e6f23e03d-83b10a27-amend-backup.hg (glob)
176 $ hg log -r .
176 $ hg log -r .
177 changeset: 1:5f357c7560ab
177 changeset: 1:5f357c7560ab
178 tag: tip
178 tag: tip
179 user: foo
179 user: foo
180 date: Thu Jan 01 00:00:01 1970 +0000
180 date: Thu Jan 01 00:00:01 1970 +0000
181 summary: no changes, new message
181 summary: no changes, new message
182
182
183
183
184 Open editor with old commit message if a message isn't given otherwise:
184 Open editor with old commit message if a message isn't given otherwise:
185
185
186 $ cat > editor.sh << '__EOF__'
186 $ cat > editor.sh << '__EOF__'
187 > #!/bin/sh
187 > #!/bin/sh
188 > cat $1
188 > cat $1
189 > echo "another precious commit message" > "$1"
189 > echo "another precious commit message" > "$1"
190 > __EOF__
190 > __EOF__
191
191
192 at first, test saving last-message.txt
192 at first, test saving last-message.txt
193
193
194 $ cat > .hg/hgrc << '__EOF__'
194 $ cat > .hg/hgrc << '__EOF__'
195 > [hooks]
195 > [hooks]
196 > pretxncommit.test-saving-last-message = false
196 > pretxncommit.test-saving-last-message = false
197 > __EOF__
197 > __EOF__
198
198
199 $ rm -f .hg/last-message.txt
199 $ rm -f .hg/last-message.txt
200 $ hg commit --amend -v -m "message given from command line"
200 $ hg commit --amend -v -m "message given from command line"
201 amending changeset 5f357c7560ab
201 amending changeset 5f357c7560ab
202 copying changeset 5f357c7560ab to ad120869acf0
202 copying changeset 5f357c7560ab to ad120869acf0
203 committing files:
203 committing files:
204 a
204 a
205 committing manifest
205 committing manifest
206 committing changelog
206 committing changelog
207 running hook pretxncommit.test-saving-last-message: false
207 running hook pretxncommit.test-saving-last-message: false
208 transaction abort!
208 transaction abort!
209 rollback completed
209 rollback completed
210 abort: pretxncommit.test-saving-last-message hook exited with status 1
210 abort: pretxncommit.test-saving-last-message hook exited with status 1
211 [255]
211 [255]
212 $ cat .hg/last-message.txt
212 $ cat .hg/last-message.txt
213 message given from command line (no-eol)
213 message given from command line (no-eol)
214
214
215 $ rm -f .hg/last-message.txt
215 $ rm -f .hg/last-message.txt
216 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
216 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
217 amending changeset 5f357c7560ab
217 amending changeset 5f357c7560ab
218 copying changeset 5f357c7560ab to ad120869acf0
218 copying changeset 5f357c7560ab to ad120869acf0
219 no changes, new message
219 no changes, new message
220
220
221
221
222 HG: Enter commit message. Lines beginning with 'HG:' are removed.
222 HG: Enter commit message. Lines beginning with 'HG:' are removed.
223 HG: Leave message empty to abort commit.
223 HG: Leave message empty to abort commit.
224 HG: --
224 HG: --
225 HG: user: foo
225 HG: user: foo
226 HG: branch 'default'
226 HG: branch 'default'
227 HG: changed a
227 HG: changed a
228 committing files:
228 committing files:
229 a
229 a
230 committing manifest
230 committing manifest
231 committing changelog
231 committing changelog
232 running hook pretxncommit.test-saving-last-message: false
232 running hook pretxncommit.test-saving-last-message: false
233 transaction abort!
233 transaction abort!
234 rollback completed
234 rollback completed
235 abort: pretxncommit.test-saving-last-message hook exited with status 1
235 abort: pretxncommit.test-saving-last-message hook exited with status 1
236 [255]
236 [255]
237
237
238 $ cat .hg/last-message.txt
238 $ cat .hg/last-message.txt
239 another precious commit message
239 another precious commit message
240
240
241 $ cat > .hg/hgrc << '__EOF__'
241 $ cat > .hg/hgrc << '__EOF__'
242 > [hooks]
242 > [hooks]
243 > pretxncommit.test-saving-last-message =
243 > pretxncommit.test-saving-last-message =
244 > __EOF__
244 > __EOF__
245
245
246 then, test editing custom commit message
246 then, test editing custom commit message
247
247
248 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
248 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
249 amending changeset 5f357c7560ab
249 amending changeset 5f357c7560ab
250 copying changeset 5f357c7560ab to ad120869acf0
250 copying changeset 5f357c7560ab to ad120869acf0
251 no changes, new message
251 no changes, new message
252
252
253
253
254 HG: Enter commit message. Lines beginning with 'HG:' are removed.
254 HG: Enter commit message. Lines beginning with 'HG:' are removed.
255 HG: Leave message empty to abort commit.
255 HG: Leave message empty to abort commit.
256 HG: --
256 HG: --
257 HG: user: foo
257 HG: user: foo
258 HG: branch 'default'
258 HG: branch 'default'
259 HG: changed a
259 HG: changed a
260 committing files:
260 committing files:
261 a
261 a
262 committing manifest
262 committing manifest
263 committing changelog
263 committing changelog
264 stripping amended changeset 5f357c7560ab
264 stripping amended changeset 5f357c7560ab
265 1 changesets found
265 1 changesets found
266 uncompressed size of bundle content:
266 uncompressed size of bundle content:
267 258 (changelog)
267 258 (changelog)
268 163 (manifests)
268 163 (manifests)
269 131 a
269 131 a
270 saved backup bundle to $TESTTMP/.hg/strip-backup/5f357c7560ab-e7c84ade-amend-backup.hg (glob)
270 saved backup bundle to $TESTTMP/.hg/strip-backup/5f357c7560ab-e7c84ade-amend-backup.hg (glob)
271 1 changesets found
271 1 changesets found
272 uncompressed size of bundle content:
272 uncompressed size of bundle content:
273 266 (changelog)
273 266 (changelog)
274 163 (manifests)
274 163 (manifests)
275 131 a
275 131 a
276 adding branch
276 adding branch
277 adding changesets
277 adding changesets
278 adding manifests
278 adding manifests
279 adding file changes
279 adding file changes
280 added 1 changesets with 1 changes to 1 files
280 added 1 changesets with 1 changes to 1 files
281 committed changeset 1:7ab3bf440b54
281 committed changeset 1:7ab3bf440b54
282
282
283 Same, but with changes in working dir (different code path):
283 Same, but with changes in working dir (different code path):
284
284
285 $ echo a >> a
285 $ echo a >> a
286 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
286 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
287 amending changeset 7ab3bf440b54
287 amending changeset 7ab3bf440b54
288 committing files:
288 committing files:
289 a
289 a
290 committing manifest
290 committing manifest
291 committing changelog
291 committing changelog
292 copying changeset a0ea9b1a4c8c to ad120869acf0
292 copying changeset a0ea9b1a4c8c to ad120869acf0
293 another precious commit message
293 another precious commit message
294
294
295
295
296 HG: Enter commit message. Lines beginning with 'HG:' are removed.
296 HG: Enter commit message. Lines beginning with 'HG:' are removed.
297 HG: Leave message empty to abort commit.
297 HG: Leave message empty to abort commit.
298 HG: --
298 HG: --
299 HG: user: foo
299 HG: user: foo
300 HG: branch 'default'
300 HG: branch 'default'
301 HG: changed a
301 HG: changed a
302 committing files:
302 committing files:
303 a
303 a
304 committing manifest
304 committing manifest
305 committing changelog
305 committing changelog
306 stripping intermediate changeset a0ea9b1a4c8c
306 stripping intermediate changeset a0ea9b1a4c8c
307 stripping amended changeset 7ab3bf440b54
307 stripping amended changeset 7ab3bf440b54
308 2 changesets found
308 2 changesets found
309 uncompressed size of bundle content:
309 uncompressed size of bundle content:
310 490 (changelog)
310 490 (changelog)
311 322 (manifests)
311 322 (manifests)
312 249 a
312 249 a
313 saved backup bundle to $TESTTMP/.hg/strip-backup/7ab3bf440b54-8e3b5088-amend-backup.hg (glob)
313 saved backup bundle to $TESTTMP/.hg/strip-backup/7ab3bf440b54-8e3b5088-amend-backup.hg (glob)
314 1 changesets found
314 1 changesets found
315 uncompressed size of bundle content:
315 uncompressed size of bundle content:
316 266 (changelog)
316 266 (changelog)
317 163 (manifests)
317 163 (manifests)
318 133 a
318 133 a
319 adding branch
319 adding branch
320 adding changesets
320 adding changesets
321 adding manifests
321 adding manifests
322 adding file changes
322 adding file changes
323 added 1 changesets with 1 changes to 1 files
323 added 1 changesets with 1 changes to 1 files
324 committed changeset 1:ea22a388757c
324 committed changeset 1:ea22a388757c
325
325
326 $ rm editor.sh
326 $ rm editor.sh
327 $ hg log -r .
327 $ hg log -r .
328 changeset: 1:ea22a388757c
328 changeset: 1:ea22a388757c
329 tag: tip
329 tag: tip
330 user: foo
330 user: foo
331 date: Thu Jan 01 00:00:01 1970 +0000
331 date: Thu Jan 01 00:00:01 1970 +0000
332 summary: another precious commit message
332 summary: another precious commit message
333
333
334
334
335 Moving bookmarks, preserve active bookmark:
335 Moving bookmarks, preserve active bookmark:
336
336
337 $ hg book book1
337 $ hg book book1
338 $ hg book book2
338 $ hg book book2
339 $ hg ci --amend -m 'move bookmarks'
339 $ hg ci --amend -m 'move bookmarks'
340 saved backup bundle to $TESTTMP/.hg/strip-backup/ea22a388757c-e51094db-amend-backup.hg (glob)
340 saved backup bundle to $TESTTMP/.hg/strip-backup/ea22a388757c-e51094db-amend-backup.hg (glob)
341 $ hg book
341 $ hg book
342 book1 1:6cec5aa930e2
342 book1 1:6cec5aa930e2
343 * book2 1:6cec5aa930e2
343 * book2 1:6cec5aa930e2
344 $ echo a >> a
344 $ echo a >> a
345 $ hg ci --amend -m 'move bookmarks'
345 $ hg ci --amend -m 'move bookmarks'
346 saved backup bundle to $TESTTMP/.hg/strip-backup/6cec5aa930e2-e9b06de4-amend-backup.hg (glob)
346 saved backup bundle to $TESTTMP/.hg/strip-backup/6cec5aa930e2-e9b06de4-amend-backup.hg (glob)
347 $ hg book
347 $ hg book
348 book1 1:48bb6e53a15f
348 book1 1:48bb6e53a15f
349 * book2 1:48bb6e53a15f
349 * book2 1:48bb6e53a15f
350
350
351 abort does not loose bookmarks
351 abort does not loose bookmarks
352
352
353 $ cat > editor.sh << '__EOF__'
353 $ cat > editor.sh << '__EOF__'
354 > #!/bin/sh
354 > #!/bin/sh
355 > echo "" > "$1"
355 > echo "" > "$1"
356 > __EOF__
356 > __EOF__
357 $ echo a >> a
357 $ echo a >> a
358 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
358 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
359 transaction abort!
359 transaction abort!
360 rollback completed
360 rollback completed
361 abort: empty commit message
361 abort: empty commit message
362 [255]
362 [255]
363 $ hg book
363 $ hg book
364 book1 1:48bb6e53a15f
364 book1 1:48bb6e53a15f
365 * book2 1:48bb6e53a15f
365 * book2 1:48bb6e53a15f
366 $ hg revert -Caq
366 $ hg revert -Caq
367 $ rm editor.sh
367 $ rm editor.sh
368
368
369 $ echo '[defaults]' >> $HGRCPATH
369 $ echo '[defaults]' >> $HGRCPATH
370 $ echo "commit=-d '0 0'" >> $HGRCPATH
370 $ echo "commit=-d '0 0'" >> $HGRCPATH
371
371
372 Moving branches:
372 Moving branches:
373
373
374 $ hg branch foo
374 $ hg branch foo
375 marked working directory as branch foo
375 marked working directory as branch foo
376 (branches are permanent and global, did you want a bookmark?)
376 (branches are permanent and global, did you want a bookmark?)
377 $ echo a >> a
377 $ echo a >> a
378 $ hg ci -m 'branch foo'
378 $ hg ci -m 'branch foo'
379 $ hg branch default -f
379 $ hg branch default -f
380 marked working directory as branch default
380 marked working directory as branch default
381 $ hg ci --amend -m 'back to default'
381 $ hg ci --amend -m 'back to default'
382 saved backup bundle to $TESTTMP/.hg/strip-backup/8ac881fbf49d-fd962fef-amend-backup.hg (glob)
382 saved backup bundle to $TESTTMP/.hg/strip-backup/8ac881fbf49d-fd962fef-amend-backup.hg (glob)
383 $ hg branches
383 $ hg branches
384 default 2:ce12b0b57d46
384 default 2:ce12b0b57d46
385
385
386 Close branch:
386 Close branch:
387
387
388 $ hg up -q 0
388 $ hg up -q 0
389 $ echo b >> b
389 $ echo b >> b
390 $ hg branch foo
390 $ hg branch foo
391 marked working directory as branch foo
391 marked working directory as branch foo
392 (branches are permanent and global, did you want a bookmark?)
392 (branches are permanent and global, did you want a bookmark?)
393 $ hg ci -Am 'fork'
393 $ hg ci -Am 'fork'
394 adding b
394 adding b
395 $ echo b >> b
395 $ echo b >> b
396 $ hg ci -mb
396 $ hg ci -mb
397 $ hg ci --amend --close-branch -m 'closing branch foo'
397 $ hg ci --amend --close-branch -m 'closing branch foo'
398 saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-6701c392-amend-backup.hg (glob)
398 saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-6701c392-amend-backup.hg (glob)
399
399
400 Same thing, different code path:
400 Same thing, different code path:
401
401
402 $ echo b >> b
402 $ echo b >> b
403 $ hg ci -m 'reopen branch'
403 $ hg ci -m 'reopen branch'
404 reopening closed branch head 4
404 reopening closed branch head 4
405 $ echo b >> b
405 $ echo b >> b
406 $ hg ci --amend --close-branch
406 $ hg ci --amend --close-branch
407 saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-49c0c55d-amend-backup.hg (glob)
407 saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-49c0c55d-amend-backup.hg (glob)
408 $ hg branches
408 $ hg branches
409 default 2:ce12b0b57d46
409 default 2:ce12b0b57d46
410
410
411 Refuse to amend during a merge:
411 Refuse to amend during a merge:
412
412
413 $ hg up -q default
413 $ hg up -q default
414 $ hg merge foo
414 $ hg merge foo
415 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
415 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
416 (branch merge, don't forget to commit)
416 (branch merge, don't forget to commit)
417 $ hg ci --amend
417 $ hg ci --amend
418 abort: cannot amend while merging
418 abort: cannot amend while merging
419 [255]
419 [255]
420 $ hg ci -m 'merge'
420 $ hg ci -m 'merge'
421
421
422 Follow copies/renames:
422 Follow copies/renames:
423
423
424 $ hg mv b c
424 $ hg mv b c
425 $ hg ci -m 'b -> c'
425 $ hg ci -m 'b -> c'
426 $ hg mv c d
426 $ hg mv c d
427 $ hg ci --amend -m 'b -> d'
427 $ hg ci --amend -m 'b -> d'
428 saved backup bundle to $TESTTMP/.hg/strip-backup/b8c6eac7f12e-adaaa8b1-amend-backup.hg (glob)
428 saved backup bundle to $TESTTMP/.hg/strip-backup/b8c6eac7f12e-adaaa8b1-amend-backup.hg (glob)
429 $ hg st --rev '.^' --copies d
429 $ hg st --rev '.^' --copies d
430 A d
430 A d
431 b
431 b
432 $ hg cp d e
432 $ hg cp d e
433 $ hg ci -m 'e = d'
433 $ hg ci -m 'e = d'
434 $ hg cp e f
434 $ hg cp e f
435 $ hg ci --amend -m 'f = d'
435 $ hg ci --amend -m 'f = d'
436 saved backup bundle to $TESTTMP/.hg/strip-backup/7f9761d65613-d37aa788-amend-backup.hg (glob)
436 saved backup bundle to $TESTTMP/.hg/strip-backup/7f9761d65613-d37aa788-amend-backup.hg (glob)
437 $ hg st --rev '.^' --copies f
437 $ hg st --rev '.^' --copies f
438 A f
438 A f
439 d
439 d
440
440
441 $ mv f f.orig
441 $ mv f f.orig
442 $ hg rm -A f
442 $ hg rm -A f
443 $ hg ci -m removef
443 $ hg ci -m removef
444 $ hg cp a f
444 $ hg cp a f
445 $ mv f.orig f
445 $ mv f.orig f
446 $ hg ci --amend -m replacef
446 $ hg ci --amend -m replacef
447 saved backup bundle to $TESTTMP/.hg/strip-backup/9e8c5f7e3d95-90259f67-amend-backup.hg (glob)
447 saved backup bundle to $TESTTMP/.hg/strip-backup/9e8c5f7e3d95-90259f67-amend-backup.hg (glob)
448 $ hg st --change . --copies
448 $ hg st --change . --copies
449 $ hg log -r . --template "{file_copies}\n"
449 $ hg log -r . --template "{file_copies}\n"
450
450
451
451
452 Move added file (issue3410):
452 Move added file (issue3410):
453
453
454 $ echo g >> g
454 $ echo g >> g
455 $ hg ci -Am g
455 $ hg ci -Am g
456 adding g
456 adding g
457 $ hg mv g h
457 $ hg mv g h
458 $ hg ci --amend
458 $ hg ci --amend
459 saved backup bundle to $TESTTMP/.hg/strip-backup/24aa8eacce2b-7059e0f1-amend-backup.hg (glob)
459 saved backup bundle to $TESTTMP/.hg/strip-backup/24aa8eacce2b-7059e0f1-amend-backup.hg (glob)
460 $ hg st --change . --copies h
460 $ hg st --change . --copies h
461 A h
461 A h
462 $ hg log -r . --template "{file_copies}\n"
462 $ hg log -r . --template "{file_copies}\n"
463
463
464
464
465 Can't rollback an amend:
465 Can't rollback an amend:
466
466
467 $ hg rollback
467 $ hg rollback
468 no rollback information available
468 no rollback information available
469 [1]
469 [1]
470
470
471 Preserve extra dict (issue3430):
471 Preserve extra dict (issue3430):
472
472
473 $ hg branch a
473 $ hg branch a
474 marked working directory as branch a
474 marked working directory as branch a
475 (branches are permanent and global, did you want a bookmark?)
475 (branches are permanent and global, did you want a bookmark?)
476 $ echo a >> a
476 $ echo a >> a
477 $ hg ci -ma
477 $ hg ci -ma
478 $ hg ci --amend -m "a'"
478 $ hg ci --amend -m "a'"
479 saved backup bundle to $TESTTMP/.hg/strip-backup/3837aa2a2fdb-2be01fd1-amend-backup.hg (glob)
479 saved backup bundle to $TESTTMP/.hg/strip-backup/3837aa2a2fdb-2be01fd1-amend-backup.hg (glob)
480 $ hg log -r . --template "{branch}\n"
480 $ hg log -r . --template "{branch}\n"
481 a
481 a
482 $ hg ci --amend -m "a''"
482 $ hg ci --amend -m "a''"
483 saved backup bundle to $TESTTMP/.hg/strip-backup/c05c06be7514-ed28c4cd-amend-backup.hg (glob)
483 saved backup bundle to $TESTTMP/.hg/strip-backup/c05c06be7514-ed28c4cd-amend-backup.hg (glob)
484 $ hg log -r . --template "{branch}\n"
484 $ hg log -r . --template "{branch}\n"
485 a
485 a
486
486
487 Also preserve other entries in the dict that are in the old commit,
487 Also preserve other entries in the dict that are in the old commit,
488 first graft something so there's an additional entry:
488 first graft something so there's an additional entry:
489
489
490 $ hg up 0 -q
490 $ hg up 0 -q
491 $ echo z > z
491 $ echo z > z
492 $ hg ci -Am 'fork'
492 $ hg ci -Am 'fork'
493 adding z
493 adding z
494 created new head
494 created new head
495 $ hg up 11
495 $ hg up 11
496 5 files updated, 0 files merged, 1 files removed, 0 files unresolved
496 5 files updated, 0 files merged, 1 files removed, 0 files unresolved
497 $ hg graft 12
497 $ hg graft 12
498 grafting 12:2647734878ef "fork" (tip)
498 grafting 12:2647734878ef "fork" (tip)
499 $ hg ci --amend -m 'graft amend'
499 $ hg ci --amend -m 'graft amend'
500 saved backup bundle to $TESTTMP/.hg/strip-backup/bd010aea3f39-eedb103b-amend-backup.hg (glob)
500 saved backup bundle to $TESTTMP/.hg/strip-backup/bd010aea3f39-eedb103b-amend-backup.hg (glob)
501 $ hg log -r . --debug | grep extra
501 $ hg log -r . --debug | grep extra
502 extra: amend_source=bd010aea3f39f3fb2a2f884b9ccb0471cd77398e
502 extra: amend_source=bd010aea3f39f3fb2a2f884b9ccb0471cd77398e
503 extra: branch=a
503 extra: branch=a
504 extra: source=2647734878ef0236dda712fae9c1651cf694ea8a
504 extra: source=2647734878ef0236dda712fae9c1651cf694ea8a
505
505
506 Preserve phase
506 Preserve phase
507
507
508 $ hg phase '.^::.'
508 $ hg phase '.^::.'
509 11: draft
509 11: draft
510 13: draft
510 13: draft
511 $ hg phase --secret --force .
511 $ hg phase --secret --force .
512 $ hg phase '.^::.'
512 $ hg phase '.^::.'
513 11: draft
513 11: draft
514 13: secret
514 13: secret
515 $ hg commit --amend -m 'amend for phase' -q
515 $ hg commit --amend -m 'amend for phase' -q
516 $ hg phase '.^::.'
516 $ hg phase '.^::.'
517 11: draft
517 11: draft
518 13: secret
518 13: secret
519
519
520 Test amend with obsolete
520 Test amend with obsolete
521 ---------------------------
521 ---------------------------
522
522
523 Enable obsolete
523 Enable obsolete
524
524
525 $ cat >> $HGRCPATH << EOF
525 $ cat >> $HGRCPATH << EOF
526 > [experimental]
526 > [experimental]
527 > evolution=createmarkers,allowunstable
527 > evolution=createmarkers,allowunstable
528 > EOF
528 > EOF
529
529
530 Amend with no files changes
530 Amend with no files changes
531
531
532 $ hg id -n
532 $ hg id -n
533 13
533 13
534 $ hg ci --amend -m 'babar'
534 $ hg ci --amend -m 'babar'
535 $ hg id -n
535 $ hg id -n
536 14
536 14
537 $ hg log -Gl 3 --style=compact
537 $ hg log -Gl 3 --style=compact
538 @ 14[tip]:11 b650e6ee8614 1970-01-01 00:00 +0000 test
538 @ 14[tip]:11 b650e6ee8614 1970-01-01 00:00 +0000 test
539 | babar
539 | babar
540 |
540 |
541 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
541 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
542 | | fork
542 | | fork
543 | |
543 | |
544 o | 11 3334b7925910 1970-01-01 00:00 +0000 test
544 o | 11 3334b7925910 1970-01-01 00:00 +0000 test
545 | | a''
545 | | a''
546 | |
546 | |
547 $ hg log -Gl 4 --hidden --style=compact
547 $ hg log -Gl 4 --hidden --style=compact
548 @ 14[tip]:11 b650e6ee8614 1970-01-01 00:00 +0000 test
548 @ 14[tip]:11 b650e6ee8614 1970-01-01 00:00 +0000 test
549 | babar
549 | babar
550 |
550 |
551 | x 13:11 68ff8ff97044 1970-01-01 00:00 +0000 test
551 | x 13:11 68ff8ff97044 1970-01-01 00:00 +0000 test
552 |/ amend for phase
552 |/ amend for phase
553 |
553 |
554 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
554 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
555 | | fork
555 | | fork
556 | |
556 | |
557 o | 11 3334b7925910 1970-01-01 00:00 +0000 test
557 o | 11 3334b7925910 1970-01-01 00:00 +0000 test
558 | | a''
558 | | a''
559 | |
559 | |
560
560
561 Amend with files changes
561 Amend with files changes
562
562
563 (note: the extra commit over 15 is a temporary junk I would be happy to get
563 (note: the extra commit over 15 is a temporary junk I would be happy to get
564 ride of)
564 ride of)
565
565
566 $ echo 'babar' >> a
566 $ echo 'babar' >> a
567 $ hg commit --amend
567 $ hg commit --amend
568 $ hg log -Gl 6 --hidden --style=compact
568 $ hg log -Gl 6 --hidden --style=compact
569 @ 16[tip]:11 9f9e9bccf56c 1970-01-01 00:00 +0000 test
569 @ 16[tip]:11 9f9e9bccf56c 1970-01-01 00:00 +0000 test
570 | babar
570 | babar
571 |
571 |
572 | x 15 90fef497c56f 1970-01-01 00:00 +0000 test
572 | x 15 90fef497c56f 1970-01-01 00:00 +0000 test
573 | | temporary amend commit for b650e6ee8614
573 | | temporary amend commit for b650e6ee8614
574 | |
574 | |
575 | x 14:11 b650e6ee8614 1970-01-01 00:00 +0000 test
575 | x 14:11 b650e6ee8614 1970-01-01 00:00 +0000 test
576 |/ babar
576 |/ babar
577 |
577 |
578 | x 13:11 68ff8ff97044 1970-01-01 00:00 +0000 test
578 | x 13:11 68ff8ff97044 1970-01-01 00:00 +0000 test
579 |/ amend for phase
579 |/ amend for phase
580 |
580 |
581 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
581 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
582 | | fork
582 | | fork
583 | |
583 | |
584 o | 11 3334b7925910 1970-01-01 00:00 +0000 test
584 o | 11 3334b7925910 1970-01-01 00:00 +0000 test
585 | | a''
585 | | a''
586 | |
586 | |
587
587
588
588
589 Test that amend does not make it easy to create obsolescence cycle
589 Test that amend does not make it easy to create obsolescence cycle
590 ---------------------------------------------------------------------
590 ---------------------------------------------------------------------
591
591
592 $ hg id -r 14 --hidden
592 $ hg id -r 14 --hidden
593 b650e6ee8614 (a)
593 b650e6ee8614 (a)
594 $ hg revert -ar 14 --hidden
594 $ hg revert -ar 14 --hidden
595 reverting a
595 reverting a
596 $ hg commit --amend
596 $ hg commit --amend
597 $ hg id
597 $ hg id
598 b99e5df575f7 (a) tip
598 b99e5df575f7 (a) tip
599
599
600 Test that rewriting leaving instability behind is allowed
600 Test that rewriting leaving instability behind is allowed
601 ---------------------------------------------------------------------
601 ---------------------------------------------------------------------
602
602
603 $ hg up '.^'
603 $ hg up '.^'
604 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
604 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
605 $ echo 'b' >> a
605 $ echo 'b' >> a
606 $ hg log --style compact -r 'children(.)'
606 $ hg log --style compact -r 'children(.)'
607 18[tip]:11 b99e5df575f7 1970-01-01 00:00 +0000 test
607 18[tip]:11 b99e5df575f7 1970-01-01 00:00 +0000 test
608 babar
608 babar
609
609
610 $ hg commit --amend
610 $ hg commit --amend
611 $ hg log -r 'unstable()'
611 $ hg log -r 'unstable()'
612 changeset: 18:b99e5df575f7
612 changeset: 18:b99e5df575f7
613 branch: a
613 branch: a
614 parent: 11:3334b7925910
614 parent: 11:3334b7925910
615 user: test
615 user: test
616 date: Thu Jan 01 00:00:00 1970 +0000
616 date: Thu Jan 01 00:00:00 1970 +0000
617 summary: babar
617 summary: babar
618
618
619
619
620 Amend a merge changeset (with renames and conflicts from the second parent):
620 Amend a merge changeset (with renames and conflicts from the second parent):
621
621
622 $ hg up -q default
622 $ hg up -q default
623 $ hg branch -q bar
623 $ hg branch -q bar
624 $ hg cp a aa
624 $ hg cp a aa
625 $ hg mv z zz
625 $ hg mv z zz
626 $ echo cc > cc
626 $ echo cc > cc
627 $ hg add cc
627 $ hg add cc
628 $ hg ci -m aazzcc
628 $ hg ci -m aazzcc
629 $ hg up -q default
629 $ hg up -q default
630 $ echo a >> a
630 $ echo a >> a
631 $ echo dd > cc
631 $ echo dd > cc
632 $ hg add cc
632 $ hg add cc
633 $ hg ci -m aa
633 $ hg ci -m aa
634 $ hg merge -q bar
634 $ hg merge -q bar
635 warning: conflicts while merging cc! (edit, then use 'hg resolve --mark')
635 warning: conflicts while merging cc! (edit, then use 'hg resolve --mark')
636 [1]
636 [1]
637 $ hg resolve -m cc
637 $ hg resolve -m cc
638 (no more unresolved files)
638 (no more unresolved files)
639 $ hg ci -m 'merge bar'
639 $ hg ci -m 'merge bar'
640 $ hg log --config diff.git=1 -pr .
640 $ hg log --config diff.git=1 -pr .
641 changeset: 23:93cd4445f720
641 changeset: 23:93cd4445f720
642 tag: tip
642 tag: tip
643 parent: 22:30d96aeaf27b
643 parent: 22:30d96aeaf27b
644 parent: 21:1aa437659d19
644 parent: 21:1aa437659d19
645 user: test
645 user: test
646 date: Thu Jan 01 00:00:00 1970 +0000
646 date: Thu Jan 01 00:00:00 1970 +0000
647 summary: merge bar
647 summary: merge bar
648
648
649 diff --git a/a b/aa
649 diff --git a/a b/aa
650 copy from a
650 copy from a
651 copy to aa
651 copy to aa
652 diff --git a/cc b/cc
652 diff --git a/cc b/cc
653 --- a/cc
653 --- a/cc
654 +++ b/cc
654 +++ b/cc
655 @@ -1,1 +1,5 @@
655 @@ -1,1 +1,5 @@
656 +<<<<<<< local: 30d96aeaf27b - test: aa
656 +<<<<<<< local: 30d96aeaf27b - test: aa
657 dd
657 dd
658 +=======
658 +=======
659 +cc
659 +cc
660 +>>>>>>> other: 1aa437659d19 bar - test: aazzcc
660 +>>>>>>> other: 1aa437659d19 bar - test: aazzcc
661 diff --git a/z b/zz
661 diff --git a/z b/zz
662 rename from z
662 rename from z
663 rename to zz
663 rename to zz
664
664
665 $ hg debugrename aa
665 $ hg debugrename aa
666 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
666 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
667 $ hg debugrename zz
667 $ hg debugrename zz
668 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
668 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
669 $ hg debugrename cc
669 $ hg debugrename cc
670 cc not renamed
670 cc not renamed
671 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
671 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
672 HGEDITFORM=commit.amend.merge
672 HGEDITFORM=commit.amend.merge
673 $ hg log --config diff.git=1 -pr .
673 $ hg log --config diff.git=1 -pr .
674 changeset: 24:832b50f2c271
674 changeset: 24:832b50f2c271
675 tag: tip
675 tag: tip
676 parent: 22:30d96aeaf27b
676 parent: 22:30d96aeaf27b
677 parent: 21:1aa437659d19
677 parent: 21:1aa437659d19
678 user: test
678 user: test
679 date: Thu Jan 01 00:00:00 1970 +0000
679 date: Thu Jan 01 00:00:00 1970 +0000
680 summary: merge bar (amend message)
680 summary: merge bar (amend message)
681
681
682 diff --git a/a b/aa
682 diff --git a/a b/aa
683 copy from a
683 copy from a
684 copy to aa
684 copy to aa
685 diff --git a/cc b/cc
685 diff --git a/cc b/cc
686 --- a/cc
686 --- a/cc
687 +++ b/cc
687 +++ b/cc
688 @@ -1,1 +1,5 @@
688 @@ -1,1 +1,5 @@
689 +<<<<<<< local: 30d96aeaf27b - test: aa
689 +<<<<<<< local: 30d96aeaf27b - test: aa
690 dd
690 dd
691 +=======
691 +=======
692 +cc
692 +cc
693 +>>>>>>> other: 1aa437659d19 bar - test: aazzcc
693 +>>>>>>> other: 1aa437659d19 bar - test: aazzcc
694 diff --git a/z b/zz
694 diff --git a/z b/zz
695 rename from z
695 rename from z
696 rename to zz
696 rename to zz
697
697
698 $ hg debugrename aa
698 $ hg debugrename aa
699 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
699 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
700 $ hg debugrename zz
700 $ hg debugrename zz
701 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
701 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
702 $ hg debugrename cc
702 $ hg debugrename cc
703 cc not renamed
703 cc not renamed
704 $ hg mv zz z
704 $ hg mv zz z
705 $ hg ci --amend -m 'merge bar (undo rename)'
705 $ hg ci --amend -m 'merge bar (undo rename)'
706 $ hg log --config diff.git=1 -pr .
706 $ hg log --config diff.git=1 -pr .
707 changeset: 26:bdafc5c72f74
707 changeset: 26:bdafc5c72f74
708 tag: tip
708 tag: tip
709 parent: 22:30d96aeaf27b
709 parent: 22:30d96aeaf27b
710 parent: 21:1aa437659d19
710 parent: 21:1aa437659d19
711 user: test
711 user: test
712 date: Thu Jan 01 00:00:00 1970 +0000
712 date: Thu Jan 01 00:00:00 1970 +0000
713 summary: merge bar (undo rename)
713 summary: merge bar (undo rename)
714
714
715 diff --git a/a b/aa
715 diff --git a/a b/aa
716 copy from a
716 copy from a
717 copy to aa
717 copy to aa
718 diff --git a/cc b/cc
718 diff --git a/cc b/cc
719 --- a/cc
719 --- a/cc
720 +++ b/cc
720 +++ b/cc
721 @@ -1,1 +1,5 @@
721 @@ -1,1 +1,5 @@
722 +<<<<<<< local: 30d96aeaf27b - test: aa
722 +<<<<<<< local: 30d96aeaf27b - test: aa
723 dd
723 dd
724 +=======
724 +=======
725 +cc
725 +cc
726 +>>>>>>> other: 1aa437659d19 bar - test: aazzcc
726 +>>>>>>> other: 1aa437659d19 bar - test: aazzcc
727
727
728 $ hg debugrename z
728 $ hg debugrename z
729 z not renamed
729 z not renamed
730
730
731 Amend a merge changeset (with renames during the merge):
731 Amend a merge changeset (with renames during the merge):
732
732
733 $ hg up -q bar
733 $ hg up -q bar
734 $ echo x > x
734 $ echo x > x
735 $ hg add x
735 $ hg add x
736 $ hg ci -m x
736 $ hg ci -m x
737 $ hg up -q default
737 $ hg up -q default
738 $ hg merge -q bar
738 $ hg merge -q bar
739 $ hg mv aa aaa
739 $ hg mv aa aaa
740 $ echo aa >> aaa
740 $ echo aa >> aaa
741 $ hg ci -m 'merge bar again'
741 $ hg ci -m 'merge bar again'
742 $ hg log --config diff.git=1 -pr .
742 $ hg log --config diff.git=1 -pr .
743 changeset: 28:32f19415b634
743 changeset: 28:32f19415b634
744 tag: tip
744 tag: tip
745 parent: 26:bdafc5c72f74
745 parent: 26:bdafc5c72f74
746 parent: 27:4c94d5bc65f5
746 parent: 27:4c94d5bc65f5
747 user: test
747 user: test
748 date: Thu Jan 01 00:00:00 1970 +0000
748 date: Thu Jan 01 00:00:00 1970 +0000
749 summary: merge bar again
749 summary: merge bar again
750
750
751 diff --git a/aa b/aa
751 diff --git a/aa b/aa
752 deleted file mode 100644
752 deleted file mode 100644
753 --- a/aa
753 --- a/aa
754 +++ /dev/null
754 +++ /dev/null
755 @@ -1,2 +0,0 @@
755 @@ -1,2 +0,0 @@
756 -a
756 -a
757 -a
757 -a
758 diff --git a/aaa b/aaa
758 diff --git a/aaa b/aaa
759 new file mode 100644
759 new file mode 100644
760 --- /dev/null
760 --- /dev/null
761 +++ b/aaa
761 +++ b/aaa
762 @@ -0,0 +1,3 @@
762 @@ -0,0 +1,3 @@
763 +a
763 +a
764 +a
764 +a
765 +aa
765 +aa
766 diff --git a/x b/x
766 diff --git a/x b/x
767 new file mode 100644
767 new file mode 100644
768 --- /dev/null
768 --- /dev/null
769 +++ b/x
769 +++ b/x
770 @@ -0,0 +1,1 @@
770 @@ -0,0 +1,1 @@
771 +x
771 +x
772
772
773 $ hg debugrename aaa
773 $ hg debugrename aaa
774 aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980
774 aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980
775 $ hg mv aaa aa
775 $ hg mv aaa aa
776 $ hg ci --amend -m 'merge bar again (undo rename)'
776 $ hg ci --amend -m 'merge bar again (undo rename)'
777 $ hg log --config diff.git=1 -pr .
777 $ hg log --config diff.git=1 -pr .
778 changeset: 30:1e2a06b3d312
778 changeset: 30:1e2a06b3d312
779 tag: tip
779 tag: tip
780 parent: 26:bdafc5c72f74
780 parent: 26:bdafc5c72f74
781 parent: 27:4c94d5bc65f5
781 parent: 27:4c94d5bc65f5
782 user: test
782 user: test
783 date: Thu Jan 01 00:00:00 1970 +0000
783 date: Thu Jan 01 00:00:00 1970 +0000
784 summary: merge bar again (undo rename)
784 summary: merge bar again (undo rename)
785
785
786 diff --git a/aa b/aa
786 diff --git a/aa b/aa
787 --- a/aa
787 --- a/aa
788 +++ b/aa
788 +++ b/aa
789 @@ -1,2 +1,3 @@
789 @@ -1,2 +1,3 @@
790 a
790 a
791 a
791 a
792 +aa
792 +aa
793 diff --git a/x b/x
793 diff --git a/x b/x
794 new file mode 100644
794 new file mode 100644
795 --- /dev/null
795 --- /dev/null
796 +++ b/x
796 +++ b/x
797 @@ -0,0 +1,1 @@
797 @@ -0,0 +1,1 @@
798 +x
798 +x
799
799
800 $ hg debugrename aa
800 $ hg debugrename aa
801 aa not renamed
801 aa not renamed
802 $ hg debugrename -r '.^' aa
802 $ hg debugrename -r '.^' aa
803 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
803 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
804
804
805 Amend a merge changeset (with manifest-level conflicts):
805 Amend a merge changeset (with manifest-level conflicts):
806
806
807 $ hg up -q bar
807 $ hg up -q bar
808 $ hg rm aa
808 $ hg rm aa
809 $ hg ci -m 'rm aa'
809 $ hg ci -m 'rm aa'
810 $ hg up -q default
810 $ hg up -q default
811 $ echo aa >> aa
811 $ echo aa >> aa
812 $ hg ci -m aa
812 $ hg ci -m aa
813 $ hg merge -q bar
813 $ hg merge -q bar --config ui.interactive=True << EOF
814 > c
815 > EOF
814 local changed aa which remote deleted
816 local changed aa which remote deleted
815 use (c)hanged version, (d)elete, or leave (u)nresolved? c
817 use (c)hanged version, (d)elete, or leave (u)nresolved? c
816 $ hg ci -m 'merge bar (with conflicts)'
818 $ hg ci -m 'merge bar (with conflicts)'
817 $ hg log --config diff.git=1 -pr .
819 $ hg log --config diff.git=1 -pr .
818 changeset: 33:97a298b0c59f
820 changeset: 33:97a298b0c59f
819 tag: tip
821 tag: tip
820 parent: 32:3d78ce4226b8
822 parent: 32:3d78ce4226b8
821 parent: 31:67db8847a540
823 parent: 31:67db8847a540
822 user: test
824 user: test
823 date: Thu Jan 01 00:00:00 1970 +0000
825 date: Thu Jan 01 00:00:00 1970 +0000
824 summary: merge bar (with conflicts)
826 summary: merge bar (with conflicts)
825
827
826
828
827 $ hg rm aa
829 $ hg rm aa
828 $ hg ci --amend -m 'merge bar (with conflicts, amended)'
830 $ hg ci --amend -m 'merge bar (with conflicts, amended)'
829 $ hg log --config diff.git=1 -pr .
831 $ hg log --config diff.git=1 -pr .
830 changeset: 35:6de0c1bde1c8
832 changeset: 35:6de0c1bde1c8
831 tag: tip
833 tag: tip
832 parent: 32:3d78ce4226b8
834 parent: 32:3d78ce4226b8
833 parent: 31:67db8847a540
835 parent: 31:67db8847a540
834 user: test
836 user: test
835 date: Thu Jan 01 00:00:00 1970 +0000
837 date: Thu Jan 01 00:00:00 1970 +0000
836 summary: merge bar (with conflicts, amended)
838 summary: merge bar (with conflicts, amended)
837
839
838 diff --git a/aa b/aa
840 diff --git a/aa b/aa
839 deleted file mode 100644
841 deleted file mode 100644
840 --- a/aa
842 --- a/aa
841 +++ /dev/null
843 +++ /dev/null
842 @@ -1,4 +0,0 @@
844 @@ -1,4 +0,0 @@
843 -a
845 -a
844 -a
846 -a
845 -aa
847 -aa
846 -aa
848 -aa
847
849
848 Issue 3445: amending with --close-branch a commit that created a new head should fail
850 Issue 3445: amending with --close-branch a commit that created a new head should fail
849 This shouldn't be possible:
851 This shouldn't be possible:
850
852
851 $ hg up -q default
853 $ hg up -q default
852 $ hg branch closewithamend
854 $ hg branch closewithamend
853 marked working directory as branch closewithamend
855 marked working directory as branch closewithamend
854 $ echo foo > foo
856 $ echo foo > foo
855 $ hg add foo
857 $ hg add foo
856 $ hg ci -m..
858 $ hg ci -m..
857 $ hg ci --amend --close-branch -m 'closing'
859 $ hg ci --amend --close-branch -m 'closing'
858 abort: can only close branch heads
860 abort: can only close branch heads
859 [255]
861 [255]
860
862
861 This silliness fails:
863 This silliness fails:
862
864
863 $ hg branch silliness
865 $ hg branch silliness
864 marked working directory as branch silliness
866 marked working directory as branch silliness
865 $ echo b >> b
867 $ echo b >> b
866 $ hg ci --close-branch -m'open and close'
868 $ hg ci --close-branch -m'open and close'
867 abort: can only close branch heads
869 abort: can only close branch heads
868 [255]
870 [255]
869
871
870 Test that amend with --secret creates new secret changeset forcibly
872 Test that amend with --secret creates new secret changeset forcibly
871 ---------------------------------------------------------------------
873 ---------------------------------------------------------------------
872
874
873 $ hg phase '.^::.'
875 $ hg phase '.^::.'
874 35: draft
876 35: draft
875 36: draft
877 36: draft
876 $ hg commit --amend --secret -m 'amend as secret' -q
878 $ hg commit --amend --secret -m 'amend as secret' -q
877 $ hg phase '.^::.'
879 $ hg phase '.^::.'
878 35: draft
880 35: draft
879 38: secret
881 38: secret
880
882
881 Test that amend with --edit invokes editor forcibly
883 Test that amend with --edit invokes editor forcibly
882 ---------------------------------------------------
884 ---------------------------------------------------
883
885
884 $ hg parents --template "{desc}\n"
886 $ hg parents --template "{desc}\n"
885 amend as secret
887 amend as secret
886 $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed"
888 $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed"
887 $ hg parents --template "{desc}\n"
889 $ hg parents --template "{desc}\n"
888 editor should be suppressed
890 editor should be suppressed
889
891
890 $ hg status --rev '.^1::.'
892 $ hg status --rev '.^1::.'
891 A foo
893 A foo
892 $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit
894 $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit
893 editor should be invoked
895 editor should be invoked
894
896
895
897
896 HG: Enter commit message. Lines beginning with 'HG:' are removed.
898 HG: Enter commit message. Lines beginning with 'HG:' are removed.
897 HG: Leave message empty to abort commit.
899 HG: Leave message empty to abort commit.
898 HG: --
900 HG: --
899 HG: user: test
901 HG: user: test
900 HG: branch 'silliness'
902 HG: branch 'silliness'
901 HG: added foo
903 HG: added foo
902 $ hg parents --template "{desc}\n"
904 $ hg parents --template "{desc}\n"
903 editor should be invoked
905 editor should be invoked
904
906
905 Test that "diff()" in committemplate works correctly for amending
907 Test that "diff()" in committemplate works correctly for amending
906 -----------------------------------------------------------------
908 -----------------------------------------------------------------
907
909
908 $ cat >> .hg/hgrc <<EOF
910 $ cat >> .hg/hgrc <<EOF
909 > [committemplate]
911 > [committemplate]
910 > changeset.commit.amend = {desc}\n
912 > changeset.commit.amend = {desc}\n
911 > HG: M: {file_mods}
913 > HG: M: {file_mods}
912 > HG: A: {file_adds}
914 > HG: A: {file_adds}
913 > HG: R: {file_dels}
915 > HG: R: {file_dels}
914 > {splitlines(diff()) % 'HG: {line}\n'}
916 > {splitlines(diff()) % 'HG: {line}\n'}
915 > EOF
917 > EOF
916
918
917 $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n"
919 $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n"
918 M:
920 M:
919 A: foo
921 A: foo
920 R:
922 R:
921 $ hg status -amr
923 $ hg status -amr
922 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo"
924 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo"
923 expecting diff of foo
925 expecting diff of foo
924
926
925 HG: M:
927 HG: M:
926 HG: A: foo
928 HG: A: foo
927 HG: R:
929 HG: R:
928 HG: diff -r 6de0c1bde1c8 foo
930 HG: diff -r 6de0c1bde1c8 foo
929 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
931 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
930 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
932 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
931 HG: @@ -0,0 +1,1 @@
933 HG: @@ -0,0 +1,1 @@
932 HG: +foo
934 HG: +foo
933
935
934 $ echo y > y
936 $ echo y > y
935 $ hg add y
937 $ hg add y
936 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y"
938 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y"
937 expecting diff of foo and y
939 expecting diff of foo and y
938
940
939 HG: M:
941 HG: M:
940 HG: A: foo y
942 HG: A: foo y
941 HG: R:
943 HG: R:
942 HG: diff -r 6de0c1bde1c8 foo
944 HG: diff -r 6de0c1bde1c8 foo
943 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
945 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
944 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
946 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
945 HG: @@ -0,0 +1,1 @@
947 HG: @@ -0,0 +1,1 @@
946 HG: +foo
948 HG: +foo
947 HG: diff -r 6de0c1bde1c8 y
949 HG: diff -r 6de0c1bde1c8 y
948 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
950 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
949 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
951 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
950 HG: @@ -0,0 +1,1 @@
952 HG: @@ -0,0 +1,1 @@
951 HG: +y
953 HG: +y
952
954
953 $ hg rm a
955 $ hg rm a
954 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y"
956 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y"
955 expecting diff of a, foo and y
957 expecting diff of a, foo and y
956
958
957 HG: M:
959 HG: M:
958 HG: A: foo y
960 HG: A: foo y
959 HG: R: a
961 HG: R: a
960 HG: diff -r 6de0c1bde1c8 a
962 HG: diff -r 6de0c1bde1c8 a
961 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
963 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
962 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
964 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
963 HG: @@ -1,2 +0,0 @@
965 HG: @@ -1,2 +0,0 @@
964 HG: -a
966 HG: -a
965 HG: -a
967 HG: -a
966 HG: diff -r 6de0c1bde1c8 foo
968 HG: diff -r 6de0c1bde1c8 foo
967 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
969 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
968 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
970 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
969 HG: @@ -0,0 +1,1 @@
971 HG: @@ -0,0 +1,1 @@
970 HG: +foo
972 HG: +foo
971 HG: diff -r 6de0c1bde1c8 y
973 HG: diff -r 6de0c1bde1c8 y
972 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
974 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
973 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
975 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
974 HG: @@ -0,0 +1,1 @@
976 HG: @@ -0,0 +1,1 @@
975 HG: +y
977 HG: +y
976
978
977 $ hg rm x
979 $ hg rm x
978 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y"
980 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y"
979 expecting diff of a, foo, x and y
981 expecting diff of a, foo, x and y
980
982
981 HG: M:
983 HG: M:
982 HG: A: foo y
984 HG: A: foo y
983 HG: R: a x
985 HG: R: a x
984 HG: diff -r 6de0c1bde1c8 a
986 HG: diff -r 6de0c1bde1c8 a
985 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
987 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
986 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
988 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
987 HG: @@ -1,2 +0,0 @@
989 HG: @@ -1,2 +0,0 @@
988 HG: -a
990 HG: -a
989 HG: -a
991 HG: -a
990 HG: diff -r 6de0c1bde1c8 foo
992 HG: diff -r 6de0c1bde1c8 foo
991 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
993 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
992 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
994 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
993 HG: @@ -0,0 +1,1 @@
995 HG: @@ -0,0 +1,1 @@
994 HG: +foo
996 HG: +foo
995 HG: diff -r 6de0c1bde1c8 x
997 HG: diff -r 6de0c1bde1c8 x
996 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
998 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
997 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
999 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
998 HG: @@ -1,1 +0,0 @@
1000 HG: @@ -1,1 +0,0 @@
999 HG: -x
1001 HG: -x
1000 HG: diff -r 6de0c1bde1c8 y
1002 HG: diff -r 6de0c1bde1c8 y
1001 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1003 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1002 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1004 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1003 HG: @@ -0,0 +1,1 @@
1005 HG: @@ -0,0 +1,1 @@
1004 HG: +y
1006 HG: +y
1005
1007
1006 $ echo cccc >> cc
1008 $ echo cccc >> cc
1007 $ hg status -amr
1009 $ hg status -amr
1008 M cc
1010 M cc
1009 $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc
1011 $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc
1010 cc should be excluded
1012 cc should be excluded
1011
1013
1012 HG: M:
1014 HG: M:
1013 HG: A: foo y
1015 HG: A: foo y
1014 HG: R: a x
1016 HG: R: a x
1015 HG: diff -r 6de0c1bde1c8 a
1017 HG: diff -r 6de0c1bde1c8 a
1016 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1018 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1017 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1019 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1018 HG: @@ -1,2 +0,0 @@
1020 HG: @@ -1,2 +0,0 @@
1019 HG: -a
1021 HG: -a
1020 HG: -a
1022 HG: -a
1021 HG: diff -r 6de0c1bde1c8 foo
1023 HG: diff -r 6de0c1bde1c8 foo
1022 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1024 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1023 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1025 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1024 HG: @@ -0,0 +1,1 @@
1026 HG: @@ -0,0 +1,1 @@
1025 HG: +foo
1027 HG: +foo
1026 HG: diff -r 6de0c1bde1c8 x
1028 HG: diff -r 6de0c1bde1c8 x
1027 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1029 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1028 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1030 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1029 HG: @@ -1,1 +0,0 @@
1031 HG: @@ -1,1 +0,0 @@
1030 HG: -x
1032 HG: -x
1031 HG: diff -r 6de0c1bde1c8 y
1033 HG: diff -r 6de0c1bde1c8 y
1032 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1034 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1033 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1035 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1034 HG: @@ -0,0 +1,1 @@
1036 HG: @@ -0,0 +1,1 @@
1035 HG: +y
1037 HG: +y
1036
1038
1037 Check for issue4405
1039 Check for issue4405
1038 -------------------
1040 -------------------
1039
1041
1040 Setup the repo with a file that gets moved in a second commit.
1042 Setup the repo with a file that gets moved in a second commit.
1041 $ hg init repo
1043 $ hg init repo
1042 $ cd repo
1044 $ cd repo
1043 $ touch a0
1045 $ touch a0
1044 $ hg add a0
1046 $ hg add a0
1045 $ hg commit -m a0
1047 $ hg commit -m a0
1046 $ hg mv a0 a1
1048 $ hg mv a0 a1
1047 $ hg commit -m a1
1049 $ hg commit -m a1
1048 $ hg up -q 0
1050 $ hg up -q 0
1049 $ hg log -G --template '{rev} {desc}'
1051 $ hg log -G --template '{rev} {desc}'
1050 o 1 a1
1052 o 1 a1
1051 |
1053 |
1052 @ 0 a0
1054 @ 0 a0
1053
1055
1054
1056
1055 Now we branch the repro, but re-use the file contents, so we have a divergence
1057 Now we branch the repro, but re-use the file contents, so we have a divergence
1056 in the file revlog topology and the changelog topology.
1058 in the file revlog topology and the changelog topology.
1057 $ hg revert --rev 1 --all
1059 $ hg revert --rev 1 --all
1058 removing a0
1060 removing a0
1059 adding a1
1061 adding a1
1060 $ hg ci -qm 'a1-amend'
1062 $ hg ci -qm 'a1-amend'
1061 $ hg log -G --template '{rev} {desc}'
1063 $ hg log -G --template '{rev} {desc}'
1062 @ 2 a1-amend
1064 @ 2 a1-amend
1063 |
1065 |
1064 | o 1 a1
1066 | o 1 a1
1065 |/
1067 |/
1066 o 0 a0
1068 o 0 a0
1067
1069
1068
1070
1069 The way mercurial does amends is to create a temporary commit (rev 3) and then
1071 The way mercurial does amends is to create a temporary commit (rev 3) and then
1070 fold the new and old commits together into another commit (rev 4). During this
1072 fold the new and old commits together into another commit (rev 4). During this
1071 process, _findlimit is called to check how far back to look for the transitive
1073 process, _findlimit is called to check how far back to look for the transitive
1072 closure of file copy information, but due to the divergence of the filelog
1074 closure of file copy information, but due to the divergence of the filelog
1073 and changelog graph topologies, before _findlimit was fixed, it returned a rev
1075 and changelog graph topologies, before _findlimit was fixed, it returned a rev
1074 which was not far enough back in this case.
1076 which was not far enough back in this case.
1075 $ hg mv a1 a2
1077 $ hg mv a1 a2
1076 $ hg status --copies --rev 0
1078 $ hg status --copies --rev 0
1077 A a2
1079 A a2
1078 a0
1080 a0
1079 R a0
1081 R a0
1080 $ hg ci --amend -q
1082 $ hg ci --amend -q
1081 $ hg log -G --template '{rev} {desc}'
1083 $ hg log -G --template '{rev} {desc}'
1082 @ 4 a1-amend
1084 @ 4 a1-amend
1083 |
1085 |
1084 | o 1 a1
1086 | o 1 a1
1085 |/
1087 |/
1086 o 0 a0
1088 o 0 a0
1087
1089
1088
1090
1089 Before the fix, the copy information was lost.
1091 Before the fix, the copy information was lost.
1090 $ hg status --copies --rev 0
1092 $ hg status --copies --rev 0
1091 A a2
1093 A a2
1092 a0
1094 a0
1093 R a0
1095 R a0
1094 $ cd ..
1096 $ cd ..
1095
1097
1096 Check that amend properly preserve rename from directory rename (issue-4516)
1098 Check that amend properly preserve rename from directory rename (issue-4516)
1097
1099
1098 If a parent of the merge renames a full directory, any files added to the old
1100 If a parent of the merge renames a full directory, any files added to the old
1099 directory in the other parent will be renamed to the new directory. For some
1101 directory in the other parent will be renamed to the new directory. For some
1100 reason, the rename metadata was when amending such merge. This test ensure we
1102 reason, the rename metadata was when amending such merge. This test ensure we
1101 do not regress. We have a dedicated repo because it needs a setup with renamed
1103 do not regress. We have a dedicated repo because it needs a setup with renamed
1102 directory)
1104 directory)
1103
1105
1104 $ hg init issue4516
1106 $ hg init issue4516
1105 $ cd issue4516
1107 $ cd issue4516
1106 $ mkdir olddirname
1108 $ mkdir olddirname
1107 $ echo line1 > olddirname/commonfile.py
1109 $ echo line1 > olddirname/commonfile.py
1108 $ hg add olddirname/commonfile.py
1110 $ hg add olddirname/commonfile.py
1109 $ hg ci -m first
1111 $ hg ci -m first
1110
1112
1111 $ hg branch newdirname
1113 $ hg branch newdirname
1112 marked working directory as branch newdirname
1114 marked working directory as branch newdirname
1113 (branches are permanent and global, did you want a bookmark?)
1115 (branches are permanent and global, did you want a bookmark?)
1114 $ hg mv olddirname newdirname
1116 $ hg mv olddirname newdirname
1115 moving olddirname/commonfile.py to newdirname/commonfile.py (glob)
1117 moving olddirname/commonfile.py to newdirname/commonfile.py (glob)
1116 $ hg ci -m rename
1118 $ hg ci -m rename
1117
1119
1118 $ hg update default
1120 $ hg update default
1119 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1121 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1120 $ echo line1 > olddirname/newfile.py
1122 $ echo line1 > olddirname/newfile.py
1121 $ hg add olddirname/newfile.py
1123 $ hg add olddirname/newfile.py
1122 $ hg ci -m log
1124 $ hg ci -m log
1123
1125
1124 $ hg up newdirname
1126 $ hg up newdirname
1125 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1127 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1126 $ # create newdirname/newfile.py
1128 $ # create newdirname/newfile.py
1127 $ hg merge default
1129 $ hg merge default
1128 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1130 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1129 (branch merge, don't forget to commit)
1131 (branch merge, don't forget to commit)
1130 $ hg ci -m add
1132 $ hg ci -m add
1131 $
1133 $
1132 $ hg debugrename newdirname/newfile.py
1134 $ hg debugrename newdirname/newfile.py
1133 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def (glob)
1135 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def (glob)
1134 $ hg status -C --change .
1136 $ hg status -C --change .
1135 A newdirname/newfile.py
1137 A newdirname/newfile.py
1136 $ hg status -C --rev 1
1138 $ hg status -C --rev 1
1137 A newdirname/newfile.py
1139 A newdirname/newfile.py
1138 $ hg status -C --rev 2
1140 $ hg status -C --rev 2
1139 A newdirname/commonfile.py
1141 A newdirname/commonfile.py
1140 olddirname/commonfile.py
1142 olddirname/commonfile.py
1141 A newdirname/newfile.py
1143 A newdirname/newfile.py
1142 olddirname/newfile.py
1144 olddirname/newfile.py
1143 R olddirname/commonfile.py
1145 R olddirname/commonfile.py
1144 R olddirname/newfile.py
1146 R olddirname/newfile.py
1145 $ hg debugindex newdirname/newfile.py
1147 $ hg debugindex newdirname/newfile.py
1146 rev offset length delta linkrev nodeid p1 p2
1148 rev offset length delta linkrev nodeid p1 p2
1147 0 0 88 -1 3 34a4d536c0c0 000000000000 000000000000
1149 0 0 88 -1 3 34a4d536c0c0 000000000000 000000000000
1148
1150
1149 $ echo a >> newdirname/commonfile.py
1151 $ echo a >> newdirname/commonfile.py
1150 $ hg ci --amend -m bug
1152 $ hg ci --amend -m bug
1151 $ hg debugrename newdirname/newfile.py
1153 $ hg debugrename newdirname/newfile.py
1152 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def (glob)
1154 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def (glob)
1153 $ hg debugindex newdirname/newfile.py
1155 $ hg debugindex newdirname/newfile.py
1154 rev offset length delta linkrev nodeid p1 p2
1156 rev offset length delta linkrev nodeid p1 p2
1155 0 0 88 -1 3 34a4d536c0c0 000000000000 000000000000
1157 0 0 88 -1 3 34a4d536c0c0 000000000000 000000000000
1156
1158
General Comments 0
You need to be logged in to leave comments. Login now