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