Show More
@@ -1,769 +1,767 b'' | |||
|
1 | 1 | $ hg init |
|
2 | 2 | |
|
3 | 3 | Setup: |
|
4 | 4 | |
|
5 | 5 | $ echo a >> a |
|
6 | 6 | $ hg ci -Am 'base' |
|
7 | 7 | adding a |
|
8 | 8 | |
|
9 | 9 | Refuse to amend public csets: |
|
10 | 10 | |
|
11 | 11 | $ hg phase -r . -p |
|
12 | 12 | $ hg ci --amend |
|
13 | 13 | abort: cannot amend public changesets |
|
14 | 14 | [255] |
|
15 | 15 | $ hg phase -r . -f -d |
|
16 | 16 | |
|
17 | 17 | $ echo a >> a |
|
18 | 18 | $ hg ci -Am 'base1' |
|
19 | 19 | |
|
20 | 20 | Nothing to amend: |
|
21 | 21 | |
|
22 | 22 | $ hg ci --amend |
|
23 | 23 | nothing changed |
|
24 | 24 | [1] |
|
25 | 25 | |
|
26 | 26 | $ cat >> $HGRCPATH <<EOF |
|
27 | 27 | > [hooks] |
|
28 | 28 | > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE" |
|
29 | 29 | > EOF |
|
30 | 30 | |
|
31 | 31 | Amending changeset with changes in working dir: |
|
32 | 32 | (and check that --message does not trigger an editor) |
|
33 | 33 | |
|
34 | 34 | $ echo a >> a |
|
35 | 35 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1' |
|
36 | 36 | pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149 |
|
37 | 37 | 43f1ba15f28a tip |
|
38 | 38 | saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-amend-backup.hg (glob) |
|
39 | 39 | $ echo 'pretxncommit.foo = ' >> $HGRCPATH |
|
40 | 40 | $ hg diff -c . |
|
41 | 41 | diff -r ad120869acf0 -r 43f1ba15f28a a |
|
42 | 42 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
43 | 43 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
44 | 44 | @@ -1,1 +1,3 @@ |
|
45 | 45 | a |
|
46 | 46 | +a |
|
47 | 47 | +a |
|
48 | 48 | $ hg log |
|
49 | 49 | changeset: 1:43f1ba15f28a |
|
50 | 50 | tag: tip |
|
51 | 51 | user: test |
|
52 | 52 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
53 | 53 | summary: amend base1 |
|
54 | 54 | |
|
55 | 55 | changeset: 0:ad120869acf0 |
|
56 | 56 | user: test |
|
57 | 57 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
58 | 58 | summary: base |
|
59 | 59 | |
|
60 | 60 | |
|
61 | 61 | Check proper abort for empty message |
|
62 | 62 | |
|
63 | 63 | $ cat > editor.sh << '__EOF__' |
|
64 | 64 | > #!/bin/sh |
|
65 | 65 | > echo "" > "$1" |
|
66 | 66 | > __EOF__ |
|
67 | 67 | $ echo b > b |
|
68 | 68 | $ hg add b |
|
69 | 69 | $ hg summary |
|
70 | 70 | parent: 1:43f1ba15f28a tip |
|
71 | 71 | amend base1 |
|
72 | 72 | branch: default |
|
73 | 73 | commit: 1 added, 1 unknown |
|
74 | 74 | update: (current) |
|
75 | 75 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend |
|
76 | 76 | transaction abort! |
|
77 | 77 | rollback completed |
|
78 | 78 | abort: empty commit message |
|
79 | 79 | [255] |
|
80 | 80 | $ hg summary |
|
81 | 81 | parent: 1:43f1ba15f28a tip |
|
82 | 82 | amend base1 |
|
83 | 83 | branch: default |
|
84 | 84 | commit: 1 added, 1 unknown |
|
85 | 85 | update: (current) |
|
86 | 86 | |
|
87 | 87 | Add new file: |
|
88 | 88 | $ hg ci --amend -m 'amend base1 new file' |
|
89 | 89 | saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-amend-backup.hg (glob) |
|
90 | 90 | |
|
91 | 91 | Remove file that was added in amended commit: |
|
92 | 92 | (and test logfile option) |
|
93 | 93 | (and test that logfile option do not trigger an editor) |
|
94 | 94 | |
|
95 | 95 | $ hg rm b |
|
96 | 96 | $ echo 'amend base1 remove new file' > ../logfile |
|
97 | 97 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile |
|
98 | 98 | saved backup bundle to $TESTTMP/.hg/strip-backup/b8e3cb2b3882-amend-backup.hg (glob) |
|
99 | 99 | |
|
100 | 100 | $ hg cat b |
|
101 | 101 | b: no such file in rev 74609c7f506e |
|
102 | 102 | [1] |
|
103 | 103 | |
|
104 | 104 | No changes, just a different message: |
|
105 | 105 | |
|
106 | 106 | $ hg ci -v --amend -m 'no changes, new message' |
|
107 | 107 | amending changeset 74609c7f506e |
|
108 | 108 | copying changeset 74609c7f506e to ad120869acf0 |
|
109 | 109 | a |
|
110 | 110 | stripping amended changeset 74609c7f506e |
|
111 | 111 | 1 changesets found |
|
112 | 112 | saved backup bundle to $TESTTMP/.hg/strip-backup/74609c7f506e-amend-backup.hg (glob) |
|
113 | 113 | 1 changesets found |
|
114 | 114 | adding branch |
|
115 | 115 | adding changesets |
|
116 | 116 | adding manifests |
|
117 | 117 | adding file changes |
|
118 | 118 | added 1 changesets with 1 changes to 1 files |
|
119 | 119 | committed changeset 1:1cd866679df8 |
|
120 | 120 | $ hg diff -c . |
|
121 | 121 | diff -r ad120869acf0 -r 1cd866679df8 a |
|
122 | 122 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
123 | 123 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
124 | 124 | @@ -1,1 +1,3 @@ |
|
125 | 125 | a |
|
126 | 126 | +a |
|
127 | 127 | +a |
|
128 | 128 | $ hg log |
|
129 | 129 | changeset: 1:1cd866679df8 |
|
130 | 130 | tag: tip |
|
131 | 131 | user: test |
|
132 | 132 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
133 | 133 | summary: no changes, new message |
|
134 | 134 | |
|
135 | 135 | changeset: 0:ad120869acf0 |
|
136 | 136 | user: test |
|
137 | 137 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
138 | 138 | summary: base |
|
139 | 139 | |
|
140 | 140 | |
|
141 | 141 | Disable default date on commit so when -d isn't given, the old date is preserved: |
|
142 | 142 | |
|
143 | 143 | $ echo '[defaults]' >> $HGRCPATH |
|
144 | 144 | $ echo 'commit=' >> $HGRCPATH |
|
145 | 145 | |
|
146 | 146 | Test -u/-d: |
|
147 | 147 | |
|
148 | 148 | $ hg ci --amend -u foo -d '1 0' |
|
149 | 149 | saved backup bundle to $TESTTMP/.hg/strip-backup/1cd866679df8-amend-backup.hg (glob) |
|
150 | 150 | $ echo a >> a |
|
151 | 151 | $ hg ci --amend -u foo -d '1 0' |
|
152 | 152 | saved backup bundle to $TESTTMP/.hg/strip-backup/780e6f23e03d-amend-backup.hg (glob) |
|
153 | 153 | $ hg log -r . |
|
154 | 154 | changeset: 1:5f357c7560ab |
|
155 | 155 | tag: tip |
|
156 | 156 | user: foo |
|
157 | 157 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
158 | 158 | summary: no changes, new message |
|
159 | 159 | |
|
160 | 160 | |
|
161 | 161 | Open editor with old commit message if a message isn't given otherwise: |
|
162 | 162 | |
|
163 | 163 | $ cat > editor.sh << '__EOF__' |
|
164 | 164 | > #!/bin/sh |
|
165 | 165 | > cat $1 |
|
166 | 166 | > echo "another precious commit message" > "$1" |
|
167 | 167 | > __EOF__ |
|
168 | 168 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
169 | 169 | amending changeset 5f357c7560ab |
|
170 | 170 | copying changeset 5f357c7560ab to ad120869acf0 |
|
171 | 171 | no changes, new message |
|
172 | 172 | |
|
173 | 173 | |
|
174 | 174 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
175 | 175 | HG: Leave message empty to abort commit. |
|
176 | 176 | HG: -- |
|
177 | 177 | HG: user: foo |
|
178 | 178 | HG: branch 'default' |
|
179 | 179 | HG: changed a |
|
180 | 180 | a |
|
181 | 181 | stripping amended changeset 5f357c7560ab |
|
182 | 182 | 1 changesets found |
|
183 | 183 | saved backup bundle to $TESTTMP/.hg/strip-backup/5f357c7560ab-amend-backup.hg (glob) |
|
184 | 184 | 1 changesets found |
|
185 | 185 | adding branch |
|
186 | 186 | adding changesets |
|
187 | 187 | adding manifests |
|
188 | 188 | adding file changes |
|
189 | 189 | added 1 changesets with 1 changes to 1 files |
|
190 | 190 | committed changeset 1:7ab3bf440b54 |
|
191 | 191 | |
|
192 | 192 | Same, but with changes in working dir (different code path): |
|
193 | 193 | |
|
194 | 194 | $ echo a >> a |
|
195 | 195 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
196 | 196 | amending changeset 7ab3bf440b54 |
|
197 | 197 | a |
|
198 | 198 | copying changeset a0ea9b1a4c8c to ad120869acf0 |
|
199 | 199 | another precious commit message |
|
200 | 200 | |
|
201 | 201 | |
|
202 | 202 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
203 | 203 | HG: Leave message empty to abort commit. |
|
204 | 204 | HG: -- |
|
205 | 205 | HG: user: foo |
|
206 | 206 | HG: branch 'default' |
|
207 | 207 | HG: changed a |
|
208 | 208 | a |
|
209 | 209 | stripping intermediate changeset a0ea9b1a4c8c |
|
210 | 210 | stripping amended changeset 7ab3bf440b54 |
|
211 | 211 | 2 changesets found |
|
212 | 212 | saved backup bundle to $TESTTMP/.hg/strip-backup/7ab3bf440b54-amend-backup.hg (glob) |
|
213 | 213 | 1 changesets found |
|
214 | 214 | adding branch |
|
215 | 215 | adding changesets |
|
216 | 216 | adding manifests |
|
217 | 217 | adding file changes |
|
218 | 218 | added 1 changesets with 1 changes to 1 files |
|
219 | 219 | committed changeset 1:ea22a388757c |
|
220 | 220 | |
|
221 | 221 | $ rm editor.sh |
|
222 | 222 | $ hg log -r . |
|
223 | 223 | changeset: 1:ea22a388757c |
|
224 | 224 | tag: tip |
|
225 | 225 | user: foo |
|
226 | 226 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
227 | 227 | summary: another precious commit message |
|
228 | 228 | |
|
229 | 229 | |
|
230 | 230 | Moving bookmarks, preserve active bookmark: |
|
231 | 231 | |
|
232 | 232 | $ hg book book1 |
|
233 | 233 | $ hg book book2 |
|
234 | 234 | $ hg ci --amend -m 'move bookmarks' |
|
235 | 235 | saved backup bundle to $TESTTMP/.hg/strip-backup/ea22a388757c-amend-backup.hg (glob) |
|
236 | 236 | $ hg book |
|
237 | 237 | book1 1:6cec5aa930e2 |
|
238 | 238 | * book2 1:6cec5aa930e2 |
|
239 | 239 | $ echo a >> a |
|
240 | 240 | $ hg ci --amend -m 'move bookmarks' |
|
241 | 241 | saved backup bundle to $TESTTMP/.hg/strip-backup/6cec5aa930e2-amend-backup.hg (glob) |
|
242 | 242 | $ hg book |
|
243 | 243 | book1 1:48bb6e53a15f |
|
244 | 244 | * book2 1:48bb6e53a15f |
|
245 | 245 | |
|
246 | 246 | abort does not loose bookmarks |
|
247 | 247 | |
|
248 | 248 | $ cat > editor.sh << '__EOF__' |
|
249 | 249 | > #!/bin/sh |
|
250 | 250 | > echo "" > "$1" |
|
251 | 251 | > __EOF__ |
|
252 | 252 | $ echo a >> a |
|
253 | 253 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend |
|
254 | 254 | transaction abort! |
|
255 | 255 | rollback completed |
|
256 | 256 | abort: empty commit message |
|
257 | 257 | [255] |
|
258 | 258 | $ hg book |
|
259 | 259 | book1 1:48bb6e53a15f |
|
260 | 260 | * book2 1:48bb6e53a15f |
|
261 | 261 | $ hg revert -Caq |
|
262 | 262 | $ rm editor.sh |
|
263 | 263 | |
|
264 | 264 | $ echo '[defaults]' >> $HGRCPATH |
|
265 | 265 | $ echo "commit=-d '0 0'" >> $HGRCPATH |
|
266 | 266 | |
|
267 | 267 | Moving branches: |
|
268 | 268 | |
|
269 | 269 | $ hg branch foo |
|
270 | 270 | marked working directory as branch foo |
|
271 | 271 | (branches are permanent and global, did you want a bookmark?) |
|
272 | 272 | $ echo a >> a |
|
273 | 273 | $ hg ci -m 'branch foo' |
|
274 | 274 | $ hg branch default -f |
|
275 | 275 | marked working directory as branch default |
|
276 | 276 | (branches are permanent and global, did you want a bookmark?) |
|
277 | 277 | $ hg ci --amend -m 'back to default' |
|
278 | 278 | saved backup bundle to $TESTTMP/.hg/strip-backup/8ac881fbf49d-amend-backup.hg (glob) |
|
279 | 279 | $ hg branches |
|
280 | 280 | default 2:ce12b0b57d46 |
|
281 | 281 | |
|
282 | 282 | Close branch: |
|
283 | 283 | |
|
284 | 284 | $ hg up -q 0 |
|
285 | 285 | $ echo b >> b |
|
286 | 286 | $ hg branch foo |
|
287 | 287 | marked working directory as branch foo |
|
288 | 288 | (branches are permanent and global, did you want a bookmark?) |
|
289 | 289 | $ hg ci -Am 'fork' |
|
290 | 290 | adding b |
|
291 | 291 | $ echo b >> b |
|
292 | 292 | $ hg ci -mb |
|
293 | 293 | $ hg ci --amend --close-branch -m 'closing branch foo' |
|
294 | 294 | saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-amend-backup.hg (glob) |
|
295 | 295 | |
|
296 | 296 | Same thing, different code path: |
|
297 | 297 | |
|
298 | 298 | $ echo b >> b |
|
299 | 299 | $ hg ci -m 'reopen branch' |
|
300 | 300 | reopening closed branch head 4 |
|
301 | 301 | $ echo b >> b |
|
302 | 302 | $ hg ci --amend --close-branch |
|
303 | 303 | saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-amend-backup.hg (glob) |
|
304 | 304 | $ hg branches |
|
305 | 305 | default 2:ce12b0b57d46 |
|
306 | 306 | |
|
307 | 307 | Refuse to amend during a merge: |
|
308 | 308 | |
|
309 | 309 | $ hg up -q default |
|
310 | 310 | $ hg merge foo |
|
311 | 311 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
312 | 312 | (branch merge, don't forget to commit) |
|
313 | 313 | $ hg ci --amend |
|
314 | 314 | abort: cannot amend while merging |
|
315 | 315 | [255] |
|
316 | 316 | $ hg ci -m 'merge' |
|
317 | 317 | |
|
318 | 318 | Follow copies/renames: |
|
319 | 319 | |
|
320 | 320 | $ hg mv b c |
|
321 | 321 | $ hg ci -m 'b -> c' |
|
322 | 322 | $ hg mv c d |
|
323 | 323 | $ hg ci --amend -m 'b -> d' |
|
324 | 324 | saved backup bundle to $TESTTMP/.hg/strip-backup/b8c6eac7f12e-amend-backup.hg (glob) |
|
325 | 325 | $ hg st --rev '.^' --copies d |
|
326 | 326 | A d |
|
327 | 327 | b |
|
328 | 328 | $ hg cp d e |
|
329 | 329 | $ hg ci -m 'e = d' |
|
330 | 330 | $ hg cp e f |
|
331 | 331 | $ hg ci --amend -m 'f = d' |
|
332 | 332 | saved backup bundle to $TESTTMP/.hg/strip-backup/7f9761d65613-amend-backup.hg (glob) |
|
333 | 333 | $ hg st --rev '.^' --copies f |
|
334 | 334 | A f |
|
335 | 335 | d |
|
336 | 336 | |
|
337 | 337 | $ mv f f.orig |
|
338 | 338 | $ hg rm -A f |
|
339 | 339 | $ hg ci -m removef |
|
340 | 340 | $ hg cp a f |
|
341 | 341 | $ mv f.orig f |
|
342 | 342 | $ hg ci --amend -m replacef |
|
343 | 343 | saved backup bundle to $TESTTMP/.hg/strip-backup/9e8c5f7e3d95-amend-backup.hg (glob) |
|
344 | 344 | $ hg st --change . --copies |
|
345 | 345 | $ hg log -r . --template "{file_copies}\n" |
|
346 | 346 | |
|
347 | 347 | |
|
348 | 348 | Move added file (issue3410): |
|
349 | 349 | |
|
350 | 350 | $ echo g >> g |
|
351 | 351 | $ hg ci -Am g |
|
352 | 352 | adding g |
|
353 | 353 | $ hg mv g h |
|
354 | 354 | $ hg ci --amend |
|
355 | 355 | saved backup bundle to $TESTTMP/.hg/strip-backup/24aa8eacce2b-amend-backup.hg (glob) |
|
356 | 356 | $ hg st --change . --copies h |
|
357 | 357 | A h |
|
358 | 358 | $ hg log -r . --template "{file_copies}\n" |
|
359 | 359 | |
|
360 | 360 | |
|
361 | 361 | Can't rollback an amend: |
|
362 | 362 | |
|
363 | 363 | $ hg rollback |
|
364 | 364 | no rollback information available |
|
365 | 365 | [1] |
|
366 | 366 | |
|
367 | 367 | Preserve extra dict (issue3430): |
|
368 | 368 | |
|
369 | 369 | $ hg branch a |
|
370 | 370 | marked working directory as branch a |
|
371 | 371 | (branches are permanent and global, did you want a bookmark?) |
|
372 | 372 | $ echo a >> a |
|
373 | 373 | $ hg ci -ma |
|
374 | 374 | $ hg ci --amend -m "a'" |
|
375 | 375 | saved backup bundle to $TESTTMP/.hg/strip-backup/3837aa2a2fdb-amend-backup.hg (glob) |
|
376 | 376 | $ hg log -r . --template "{branch}\n" |
|
377 | 377 | a |
|
378 | 378 | $ hg ci --amend -m "a''" |
|
379 | 379 | saved backup bundle to $TESTTMP/.hg/strip-backup/c05c06be7514-amend-backup.hg (glob) |
|
380 | 380 | $ hg log -r . --template "{branch}\n" |
|
381 | 381 | a |
|
382 | 382 | |
|
383 | 383 | Also preserve other entries in the dict that are in the old commit, |
|
384 | 384 | first graft something so there's an additional entry: |
|
385 | 385 | |
|
386 | 386 | $ hg up 0 -q |
|
387 | 387 | $ echo z > z |
|
388 | 388 | $ hg ci -Am 'fork' |
|
389 | 389 | adding z |
|
390 | 390 | created new head |
|
391 | 391 | $ hg up 11 |
|
392 | 392 | 5 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
393 | 393 | $ hg graft 12 |
|
394 | 394 | grafting revision 12 |
|
395 | 395 | $ hg ci --amend -m 'graft amend' |
|
396 | 396 | saved backup bundle to $TESTTMP/.hg/strip-backup/bd010aea3f39-amend-backup.hg (glob) |
|
397 | 397 | $ hg log -r . --debug | grep extra |
|
398 | 398 | extra: amend_source=bd010aea3f39f3fb2a2f884b9ccb0471cd77398e |
|
399 | 399 | extra: branch=a |
|
400 | 400 | extra: source=2647734878ef0236dda712fae9c1651cf694ea8a |
|
401 | 401 | |
|
402 | 402 | Preserve phase |
|
403 | 403 | |
|
404 | 404 | $ hg phase '.^::.' |
|
405 | 405 | 11: draft |
|
406 | 406 | 13: draft |
|
407 | 407 | $ hg phase --secret --force . |
|
408 | 408 | $ hg phase '.^::.' |
|
409 | 409 | 11: draft |
|
410 | 410 | 13: secret |
|
411 | 411 | $ hg commit --amend -m 'amend for phase' -q |
|
412 | 412 | $ hg phase '.^::.' |
|
413 | 413 | 11: draft |
|
414 | 414 | 13: secret |
|
415 | 415 | |
|
416 | 416 | Test amend with obsolete |
|
417 | 417 | --------------------------- |
|
418 | 418 | |
|
419 | 419 | Enable obsolete |
|
420 | 420 | |
|
421 | 421 | $ cat > ${TESTTMP}/obs.py << EOF |
|
422 | 422 | > import mercurial.obsolete |
|
423 | 423 | > mercurial.obsolete._enabled = True |
|
424 | 424 | > EOF |
|
425 | 425 | $ echo '[extensions]' >> $HGRCPATH |
|
426 | 426 | $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH |
|
427 | 427 | |
|
428 | 428 | |
|
429 | 429 | Amend with no files changes |
|
430 | 430 | |
|
431 | 431 | $ hg id -n |
|
432 | 432 | 13 |
|
433 | 433 | $ hg ci --amend -m 'babar' |
|
434 | 434 | $ hg id -n |
|
435 | 435 | 14 |
|
436 | 436 | $ hg log -Gl 3 --style=compact |
|
437 | 437 | @ 14[tip]:11 b650e6ee8614 1970-01-01 00:00 +0000 test |
|
438 | 438 | | babar |
|
439 | 439 | | |
|
440 | 440 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
441 | 441 | | | fork |
|
442 | 442 | | | |
|
443 | 443 | o | 11 3334b7925910 1970-01-01 00:00 +0000 test |
|
444 | 444 | | | a'' |
|
445 | 445 | | | |
|
446 | 446 | $ hg log -Gl 4 --hidden --style=compact |
|
447 | 447 | @ 14[tip]:11 b650e6ee8614 1970-01-01 00:00 +0000 test |
|
448 | 448 | | babar |
|
449 | 449 | | |
|
450 | 450 | | x 13:11 68ff8ff97044 1970-01-01 00:00 +0000 test |
|
451 | 451 | |/ amend for phase |
|
452 | 452 | | |
|
453 | 453 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
454 | 454 | | | fork |
|
455 | 455 | | | |
|
456 | 456 | o | 11 3334b7925910 1970-01-01 00:00 +0000 test |
|
457 | 457 | | | a'' |
|
458 | 458 | | | |
|
459 | 459 | |
|
460 | 460 | Amend with files changes |
|
461 | 461 | |
|
462 | 462 | (note: the extra commit over 15 is a temporary junk I would be happy to get |
|
463 | 463 | ride of) |
|
464 | 464 | |
|
465 | 465 | $ echo 'babar' >> a |
|
466 | 466 | $ hg commit --amend |
|
467 | 467 | $ hg log -Gl 6 --hidden --style=compact |
|
468 | 468 | @ 16[tip]:11 9f9e9bccf56c 1970-01-01 00:00 +0000 test |
|
469 | 469 | | babar |
|
470 | 470 | | |
|
471 | 471 | | x 15 90fef497c56f 1970-01-01 00:00 +0000 test |
|
472 | 472 | | | temporary amend commit for b650e6ee8614 |
|
473 | 473 | | | |
|
474 | 474 | | x 14:11 b650e6ee8614 1970-01-01 00:00 +0000 test |
|
475 | 475 | |/ babar |
|
476 | 476 | | |
|
477 | 477 | | x 13:11 68ff8ff97044 1970-01-01 00:00 +0000 test |
|
478 | 478 | |/ amend for phase |
|
479 | 479 | | |
|
480 | 480 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
481 | 481 | | | fork |
|
482 | 482 | | | |
|
483 | 483 | o | 11 3334b7925910 1970-01-01 00:00 +0000 test |
|
484 | 484 | | | a'' |
|
485 | 485 | | | |
|
486 | 486 | |
|
487 | 487 | |
|
488 | 488 | Test that amend does not make it easy to create obsolescence cycle |
|
489 | 489 | --------------------------------------------------------------------- |
|
490 | 490 | |
|
491 | 491 | $ hg id -r 14 --hidden |
|
492 | 492 | b650e6ee8614 (a) |
|
493 | 493 | $ hg revert -ar 14 --hidden |
|
494 | 494 | reverting a |
|
495 | 495 | $ hg commit --amend |
|
496 | 496 | $ hg id |
|
497 | 497 | b99e5df575f7 (a) tip |
|
498 | 498 | |
|
499 | 499 | Test that rewriting leaving instability behind is allowed |
|
500 | 500 | --------------------------------------------------------------------- |
|
501 | 501 | |
|
502 | 502 | $ hg up '.^' |
|
503 | 503 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
504 | 504 | $ echo 'b' >> a |
|
505 | 505 | $ hg log --style compact -r 'children(.)' |
|
506 | 506 | 18[tip]:11 b99e5df575f7 1970-01-01 00:00 +0000 test |
|
507 | 507 | babar |
|
508 | 508 | |
|
509 | 509 | $ hg commit --amend |
|
510 | 510 | $ hg log -r 'unstable()' |
|
511 | 511 | changeset: 18:b99e5df575f7 |
|
512 | 512 | branch: a |
|
513 | 513 | parent: 11:3334b7925910 |
|
514 | 514 | user: test |
|
515 | 515 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
516 | 516 | summary: babar |
|
517 | 517 | |
|
518 | 518 | |
|
519 | 519 | Amend a merge changeset (with renames and conflicts from the second parent): |
|
520 | 520 | |
|
521 | 521 | $ hg up -q default |
|
522 | 522 | $ hg branch -q bar |
|
523 | 523 | $ hg cp a aa |
|
524 | 524 | $ hg mv z zz |
|
525 | 525 | $ echo cc > cc |
|
526 | 526 | $ hg add cc |
|
527 | 527 | $ hg ci -m aazzcc |
|
528 | 528 | $ hg up -q default |
|
529 | 529 | $ echo a >> a |
|
530 | 530 | $ echo dd > cc |
|
531 | 531 | $ hg add cc |
|
532 | 532 | $ hg ci -m aa |
|
533 | 533 | $ hg merge -q bar |
|
534 | 534 | warning: conflicts during merge. |
|
535 | 535 | merging cc incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
536 | 536 | [1] |
|
537 | 537 | $ hg resolve -m cc |
|
538 | 538 | $ hg ci -m 'merge bar' |
|
539 | 539 | $ hg log --config diff.git=1 -pr . |
|
540 | 540 | changeset: 23:d51446492733 |
|
541 | 541 | tag: tip |
|
542 | 542 | parent: 22:30d96aeaf27b |
|
543 | 543 | parent: 21:1aa437659d19 |
|
544 | 544 | user: test |
|
545 | 545 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
546 | 546 | summary: merge bar |
|
547 | 547 | |
|
548 | 548 | diff --git a/a b/aa |
|
549 | 549 | copy from a |
|
550 | 550 | copy to aa |
|
551 | 551 | diff --git a/cc b/cc |
|
552 | 552 | --- a/cc |
|
553 | 553 | +++ b/cc |
|
554 | 554 | @@ -1,1 +1,5 @@ |
|
555 | 555 | +<<<<<<< local |
|
556 | 556 | dd |
|
557 | 557 | +======= |
|
558 | 558 | +cc |
|
559 | 559 | +>>>>>>> other |
|
560 | 560 | diff --git a/z b/zz |
|
561 | 561 | rename from z |
|
562 | 562 | rename to zz |
|
563 | 563 | |
|
564 | 564 | $ hg debugrename aa |
|
565 | 565 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
566 | 566 | $ hg debugrename zz |
|
567 | 567 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a |
|
568 | 568 | $ hg debugrename cc |
|
569 | 569 | cc not renamed |
|
570 | 570 | $ hg ci --amend -m 'merge bar (amend message)' |
|
571 | 571 | $ hg log --config diff.git=1 -pr . |
|
572 | 572 | changeset: 24:59de3dce7a79 |
|
573 | 573 | tag: tip |
|
574 | 574 | parent: 22:30d96aeaf27b |
|
575 | 575 | parent: 21:1aa437659d19 |
|
576 | 576 | user: test |
|
577 | 577 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
578 | 578 | summary: merge bar (amend message) |
|
579 | 579 | |
|
580 | 580 | diff --git a/a b/aa |
|
581 | 581 | copy from a |
|
582 | 582 | copy to aa |
|
583 | 583 | diff --git a/cc b/cc |
|
584 | 584 | --- a/cc |
|
585 | 585 | +++ b/cc |
|
586 | 586 | @@ -1,1 +1,5 @@ |
|
587 | 587 | +<<<<<<< local |
|
588 | 588 | dd |
|
589 | 589 | +======= |
|
590 | 590 | +cc |
|
591 | 591 | +>>>>>>> other |
|
592 | 592 | diff --git a/z b/zz |
|
593 | 593 | rename from z |
|
594 | 594 | rename to zz |
|
595 | 595 | |
|
596 | 596 | $ hg debugrename aa |
|
597 | 597 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
598 | 598 | $ hg debugrename zz |
|
599 | 599 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a |
|
600 | 600 | $ hg debugrename cc |
|
601 | 601 | cc not renamed |
|
602 | 602 | $ hg mv zz z |
|
603 | 603 | $ hg ci --amend -m 'merge bar (undo rename)' |
|
604 | 604 | $ hg log --config diff.git=1 -pr . |
|
605 | 605 | changeset: 26:7fb89c461f81 |
|
606 | 606 | tag: tip |
|
607 | 607 | parent: 22:30d96aeaf27b |
|
608 | 608 | parent: 21:1aa437659d19 |
|
609 | 609 | user: test |
|
610 | 610 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
611 | 611 | summary: merge bar (undo rename) |
|
612 | 612 | |
|
613 | 613 | diff --git a/a b/aa |
|
614 | 614 | copy from a |
|
615 | 615 | copy to aa |
|
616 | 616 | diff --git a/cc b/cc |
|
617 | 617 | --- a/cc |
|
618 | 618 | +++ b/cc |
|
619 | 619 | @@ -1,1 +1,5 @@ |
|
620 | 620 | +<<<<<<< local |
|
621 | 621 | dd |
|
622 | 622 | +======= |
|
623 | 623 | +cc |
|
624 | 624 | +>>>>>>> other |
|
625 | 625 | |
|
626 | 626 | $ hg debugrename z |
|
627 | 627 | z not renamed |
|
628 | 628 | |
|
629 | 629 | Amend a merge changeset (with renames during the merge): |
|
630 | 630 | |
|
631 | 631 | $ hg up -q bar |
|
632 | 632 | $ echo x > x |
|
633 | 633 | $ hg add x |
|
634 | 634 | $ hg ci -m x |
|
635 | 635 | $ hg up -q default |
|
636 | 636 | $ hg merge -q bar |
|
637 | 637 | $ hg mv aa aaa |
|
638 | 638 | $ echo aa >> aaa |
|
639 | 639 | $ hg ci -m 'merge bar again' |
|
640 | 640 | $ hg log --config diff.git=1 -pr . |
|
641 | 641 | changeset: 28:982d7a34ffee |
|
642 | 642 | tag: tip |
|
643 | 643 | parent: 26:7fb89c461f81 |
|
644 | 644 | parent: 27:4c94d5bc65f5 |
|
645 | 645 | user: test |
|
646 | 646 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
647 | 647 | summary: merge bar again |
|
648 | 648 | |
|
649 | 649 | diff --git a/aa b/aa |
|
650 | 650 | deleted file mode 100644 |
|
651 | 651 | --- a/aa |
|
652 | 652 | +++ /dev/null |
|
653 | 653 | @@ -1,2 +0,0 @@ |
|
654 | 654 | -a |
|
655 | 655 | -a |
|
656 | 656 | diff --git a/aaa b/aaa |
|
657 | 657 | new file mode 100644 |
|
658 | 658 | --- /dev/null |
|
659 | 659 | +++ b/aaa |
|
660 | 660 | @@ -0,0 +1,3 @@ |
|
661 | 661 | +a |
|
662 | 662 | +a |
|
663 | 663 | +aa |
|
664 | 664 | diff --git a/x b/x |
|
665 | 665 | new file mode 100644 |
|
666 | 666 | --- /dev/null |
|
667 | 667 | +++ b/x |
|
668 | 668 | @@ -0,0 +1,1 @@ |
|
669 | 669 | +x |
|
670 | 670 | |
|
671 | 671 | $ hg debugrename aaa |
|
672 | 672 | aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980 |
|
673 | 673 | $ hg mv aaa aa |
|
674 | 674 | $ hg ci --amend -m 'merge bar again (undo rename)' |
|
675 | 675 | $ hg log --config diff.git=1 -pr . |
|
676 | 676 | changeset: 30:522688c0e71b |
|
677 | 677 | tag: tip |
|
678 | 678 | parent: 26:7fb89c461f81 |
|
679 | 679 | parent: 27:4c94d5bc65f5 |
|
680 | 680 | user: test |
|
681 | 681 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
682 | 682 | summary: merge bar again (undo rename) |
|
683 | 683 | |
|
684 | 684 | diff --git a/aa b/aa |
|
685 | 685 | --- a/aa |
|
686 | 686 | +++ b/aa |
|
687 | 687 | @@ -1,2 +1,3 @@ |
|
688 | 688 | a |
|
689 | 689 | a |
|
690 | 690 | +aa |
|
691 | 691 | diff --git a/x b/x |
|
692 | 692 | new file mode 100644 |
|
693 | 693 | --- /dev/null |
|
694 | 694 | +++ b/x |
|
695 | 695 | @@ -0,0 +1,1 @@ |
|
696 | 696 | +x |
|
697 | 697 | |
|
698 | 698 | $ hg debugrename aa |
|
699 | 699 | aa not renamed |
|
700 | 700 | $ hg debugrename -r '.^' aa |
|
701 | 701 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
702 | 702 | |
|
703 | 703 | Amend a merge changeset (with manifest-level conflicts): |
|
704 | 704 | |
|
705 | 705 | $ hg up -q bar |
|
706 | 706 | $ hg rm aa |
|
707 | 707 | $ hg ci -m 'rm aa' |
|
708 | 708 | $ hg up -q default |
|
709 | 709 | $ echo aa >> aa |
|
710 | 710 | $ hg ci -m aa |
|
711 | 711 | $ hg merge -q bar |
|
712 | 712 | local changed aa which remote deleted |
|
713 | 713 | use (c)hanged version or (d)elete? c |
|
714 | 714 | $ hg ci -m 'merge bar (with conflicts)' |
|
715 | 715 | $ hg log --config diff.git=1 -pr . |
|
716 | 716 | changeset: 33:5f9904c491b8 |
|
717 | 717 | tag: tip |
|
718 | 718 | parent: 32:01780b896f58 |
|
719 | 719 | parent: 31:67db8847a540 |
|
720 | 720 | user: test |
|
721 | 721 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
722 | 722 | summary: merge bar (with conflicts) |
|
723 | 723 | |
|
724 | 724 | |
|
725 | 725 | $ hg rm aa |
|
726 | 726 | $ hg ci --amend -m 'merge bar (with conflicts, amended)' |
|
727 | 727 | $ hg log --config diff.git=1 -pr . |
|
728 | 728 | changeset: 35:6ce0c89781a3 |
|
729 | 729 | tag: tip |
|
730 | 730 | parent: 32:01780b896f58 |
|
731 | 731 | parent: 31:67db8847a540 |
|
732 | 732 | user: test |
|
733 | 733 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
734 | 734 | summary: merge bar (with conflicts, amended) |
|
735 | 735 | |
|
736 | 736 | diff --git a/aa b/aa |
|
737 | 737 | deleted file mode 100644 |
|
738 | 738 | --- a/aa |
|
739 | 739 | +++ /dev/null |
|
740 | 740 | @@ -1,4 +0,0 @@ |
|
741 | 741 | -a |
|
742 | 742 | -a |
|
743 | 743 | -aa |
|
744 | 744 | -aa |
|
745 | 745 | |
|
746 | 746 | Issue 3445: amending with --close-branch a commit that created a new head should fail |
|
747 | 747 | This shouldn't be possible: |
|
748 | 748 | |
|
749 | 749 | $ hg up -q default |
|
750 | 750 | $ hg branch closewithamend |
|
751 | 751 | marked working directory as branch closewithamend |
|
752 | 752 | (branches are permanent and global, did you want a bookmark?) |
|
753 | $ hg ci -Am.. | |
|
754 | adding cc.orig | |
|
755 | adding obs.py | |
|
756 | adding obs.pyc | |
|
753 | $ hg add obs.py | |
|
754 | $ hg ci -m.. | |
|
757 | 755 | $ hg ci --amend --close-branch -m 'closing' |
|
758 | 756 | abort: can only close branch heads |
|
759 | 757 | [255] |
|
760 | 758 | |
|
761 | 759 | This silliness fails: |
|
762 | 760 | |
|
763 | 761 | $ hg branch silliness |
|
764 | 762 | marked working directory as branch silliness |
|
765 | 763 | (branches are permanent and global, did you want a bookmark?) |
|
766 | 764 | $ echo b >> b |
|
767 | 765 | $ hg ci --close-branch -m'open and close' |
|
768 | 766 | abort: can only close branch heads |
|
769 | 767 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now