##// END OF EJS Templates
graft: add test for reading old graftstate files with new mechanism...
Pulkit Goyal -
r38166:d1690a64 default
parent child Browse files
Show More
@@ -1,1375 +1,1412 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extdiff]
3 3 > # for portability:
4 4 > pdiff = sh "$RUNTESTDIR/pdiff"
5 5 > EOF
6 6
7 7 Create a repo with some stuff in it:
8 8
9 9 $ hg init a
10 10 $ cd a
11 11 $ echo a > a
12 12 $ echo a > d
13 13 $ echo a > e
14 14 $ hg ci -qAm0
15 15 $ echo b > a
16 16 $ hg ci -m1 -u bar
17 17 $ hg mv a b
18 18 $ hg ci -m2
19 19 $ hg cp b c
20 20 $ hg ci -m3 -u baz
21 21 $ echo b > d
22 22 $ echo f > e
23 23 $ hg ci -m4
24 24 $ hg up -q 3
25 25 $ echo b > e
26 26 $ hg branch -q stable
27 27 $ hg ci -m5
28 28 $ hg merge -q default --tool internal:local
29 29 $ hg branch -q default
30 30 $ hg ci -m6
31 31 $ hg phase --public 3
32 32 $ hg phase --force --secret 6
33 33
34 34 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
35 35 @ test@6.secret: 6
36 36 |\
37 37 | o test@5.draft: 5
38 38 | |
39 39 o | test@4.draft: 4
40 40 |/
41 41 o baz@3.public: 3
42 42 |
43 43 o test@2.public: 2
44 44 |
45 45 o bar@1.public: 1
46 46 |
47 47 o test@0.public: 0
48 48
49 49 Can't continue without starting:
50 50
51 51 $ hg rm -q e
52 52 $ hg graft --continue
53 53 abort: no graft in progress
54 54 [255]
55 55 $ hg revert -r . -q e
56 56
57 57 Need to specify a rev:
58 58
59 59 $ hg graft
60 60 abort: no revisions specified
61 61 [255]
62 62
63 63 Can't graft ancestor:
64 64
65 65 $ hg graft 1 2
66 66 skipping ancestor revision 1:5d205f8b35b6
67 67 skipping ancestor revision 2:5c095ad7e90f
68 68 [255]
69 69
70 70 Specify revisions with -r:
71 71
72 72 $ hg graft -r 1 -r 2
73 73 skipping ancestor revision 1:5d205f8b35b6
74 74 skipping ancestor revision 2:5c095ad7e90f
75 75 [255]
76 76
77 77 $ hg graft -r 1 2
78 78 warning: inconsistent use of --rev might give unexpected revision ordering!
79 79 skipping ancestor revision 2:5c095ad7e90f
80 80 skipping ancestor revision 1:5d205f8b35b6
81 81 [255]
82 82
83 83 Can't graft with dirty wd:
84 84
85 85 $ hg up -q 0
86 86 $ echo foo > a
87 87 $ hg graft 1
88 88 abort: uncommitted changes
89 89 [255]
90 90 $ hg revert a
91 91
92 92 Graft a rename:
93 93 (this also tests that editor is invoked if '--edit' is specified)
94 94
95 95 $ hg status --rev "2^1" --rev 2
96 96 A b
97 97 R a
98 98 $ HGEDITOR=cat hg graft 2 -u foo --edit
99 99 grafting 2:5c095ad7e90f "2"
100 100 merging a and b to b
101 101 2
102 102
103 103
104 104 HG: Enter commit message. Lines beginning with 'HG:' are removed.
105 105 HG: Leave message empty to abort commit.
106 106 HG: --
107 107 HG: user: foo
108 108 HG: branch 'default'
109 109 HG: added b
110 110 HG: removed a
111 111 $ hg export tip --git
112 112 # HG changeset patch
113 113 # User foo
114 114 # Date 0 0
115 115 # Thu Jan 01 00:00:00 1970 +0000
116 116 # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82
117 117 # Parent 68795b066622ca79a25816a662041d8f78f3cd9e
118 118 2
119 119
120 120 diff --git a/a b/b
121 121 rename from a
122 122 rename to b
123 123
124 124 Look for extra:source
125 125
126 126 $ hg log --debug -r tip
127 127 changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
128 128 tag: tip
129 129 phase: draft
130 130 parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e
131 131 parent: -1:0000000000000000000000000000000000000000
132 132 manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb
133 133 user: foo
134 134 date: Thu Jan 01 00:00:00 1970 +0000
135 135 files+: b
136 136 files-: a
137 137 extra: branch=default
138 138 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
139 139 description:
140 140 2
141 141
142 142
143 143
144 144 Graft out of order, skipping a merge and a duplicate
145 145 (this also tests that editor is not invoked if '--edit' is not specified)
146 146
147 147 $ hg graft 1 5 4 3 'merge()' 2 -n
148 148 skipping ungraftable merge revision 6
149 149 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
150 150 grafting 1:5d205f8b35b6 "1"
151 151 grafting 5:97f8bfe72746 "5"
152 152 grafting 4:9c233e8e184d "4"
153 153 grafting 3:4c60f11aa304 "3"
154 154
155 155 $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug
156 156 skipping ungraftable merge revision 6
157 157 scanning for duplicate grafts
158 158 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
159 159 grafting 1:5d205f8b35b6 "1"
160 160 searching for copies back to rev 1
161 161 unmatched files in local:
162 162 b
163 163 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
164 164 src: 'a' -> dst: 'b' *
165 165 checking for directory renames
166 166 resolving manifests
167 167 branchmerge: True, force: True, partial: False
168 168 ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6
169 169 preserving b for resolve of b
170 170 starting 4 threads for background file closing (?)
171 171 b: local copied/moved from a -> m (premerge)
172 172 picked tool ':merge' for b (binary False symlink False changedelete False)
173 173 merging b and a to b
174 174 my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622
175 175 premerge successful
176 176 committing files:
177 177 b
178 178 committing manifest
179 179 committing changelog
180 180 updating the branch cache
181 181 grafting 5:97f8bfe72746 "5"
182 182 searching for copies back to rev 1
183 183 unmatched files in other (from topological common ancestor):
184 184 c
185 185 resolving manifests
186 186 branchmerge: True, force: True, partial: False
187 187 ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746
188 188 e: remote is newer -> g
189 189 getting e
190 190 committing files:
191 191 e
192 192 committing manifest
193 193 committing changelog
194 194 updating the branch cache
195 195 $ HGEDITOR=cat hg graft 4 3 --log --debug
196 196 scanning for duplicate grafts
197 197 grafting 4:9c233e8e184d "4"
198 198 searching for copies back to rev 1
199 199 unmatched files in other (from topological common ancestor):
200 200 c
201 201 resolving manifests
202 202 branchmerge: True, force: True, partial: False
203 203 ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d
204 204 preserving e for resolve of e
205 205 d: remote is newer -> g
206 206 getting d
207 207 e: versions differ -> m (premerge)
208 208 picked tool ':merge' for e (binary False symlink False changedelete False)
209 209 merging e
210 210 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
211 211 e: versions differ -> m (merge)
212 212 picked tool ':merge' for e (binary False symlink False changedelete False)
213 213 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
214 214 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
215 215 abort: unresolved conflicts, can't continue
216 216 (use 'hg resolve' and 'hg graft --continue --log')
217 217 [255]
218 218
219 219 Summary should mention graft:
220 220
221 221 $ hg summary |grep graft
222 222 commit: 2 modified, 2 unknown, 1 unresolved (graft in progress)
223 223
224 224 Using status to get more context
225 225
226 226 $ hg status --verbose
227 227 M d
228 228 M e
229 229 ? a.orig
230 230 ? e.orig
231 231 # The repository is in an unfinished *graft* state.
232 232
233 233 # Unresolved merge conflicts:
234 234 #
235 235 # e
236 236 #
237 237 # To mark files as resolved: hg resolve --mark FILE
238 238
239 239 # To continue: hg graft --continue
240 240 # To abort: hg update --clean . (warning: this will discard uncommitted changes)
241 241
242 242
243 243 Commit while interrupted should fail:
244 244
245 245 $ hg ci -m 'commit interrupted graft'
246 246 abort: graft in progress
247 247 (use 'hg graft --continue' or 'hg update' to abort)
248 248 [255]
249 249
250 250 Abort the graft and try committing:
251 251
252 252 $ hg up -C .
253 253 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
254 254 $ echo c >> e
255 255 $ hg ci -mtest
256 256
257 257 $ hg strip . --config extensions.strip=
258 258 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
259 259 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
260 260
261 261 Graft again:
262 262
263 263 $ hg graft 1 5 4 3 'merge()' 2
264 264 skipping ungraftable merge revision 6
265 265 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
266 266 skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e)
267 267 skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec)
268 268 grafting 4:9c233e8e184d "4"
269 269 merging e
270 270 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
271 271 abort: unresolved conflicts, can't continue
272 272 (use 'hg resolve' and 'hg graft --continue')
273 273 [255]
274 274
275 275 Continue without resolve should fail:
276 276
277 277 $ hg graft -c
278 278 grafting 4:9c233e8e184d "4"
279 279 abort: unresolved merge conflicts (see 'hg help resolve')
280 280 [255]
281 281
282 282 Fix up:
283 283
284 284 $ echo b > e
285 285 $ hg resolve -m e
286 286 (no more unresolved files)
287 287 continue: hg graft --continue
288 288
289 289 Continue with a revision should fail:
290 290
291 291 $ hg graft -c 6
292 292 abort: can't specify --continue and revisions
293 293 [255]
294 294
295 295 $ hg graft -c -r 6
296 296 abort: can't specify --continue and revisions
297 297 [255]
298 298
299 299 Continue for real, clobber usernames
300 300
301 301 $ hg graft -c -U
302 302 grafting 4:9c233e8e184d "4"
303 303 grafting 3:4c60f11aa304 "3"
304 304
305 305 Compare with original:
306 306
307 307 $ hg diff -r 6
308 308 $ hg status --rev 0:. -C
309 309 M d
310 310 M e
311 311 A b
312 312 a
313 313 A c
314 314 a
315 315 R a
316 316
317 317 View graph:
318 318
319 319 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
320 320 @ test@11.draft: 3
321 321 |
322 322 o test@10.draft: 4
323 323 |
324 324 o test@9.draft: 5
325 325 |
326 326 o bar@8.draft: 1
327 327 |
328 328 o foo@7.draft: 2
329 329 |
330 330 | o test@6.secret: 6
331 331 | |\
332 332 | | o test@5.draft: 5
333 333 | | |
334 334 | o | test@4.draft: 4
335 335 | |/
336 336 | o baz@3.public: 3
337 337 | |
338 338 | o test@2.public: 2
339 339 | |
340 340 | o bar@1.public: 1
341 341 |/
342 342 o test@0.public: 0
343 343
344 344 Graft again onto another branch should preserve the original source
345 345 $ hg up -q 0
346 346 $ echo 'g'>g
347 347 $ hg add g
348 348 $ hg ci -m 7
349 349 created new head
350 350 $ hg graft 7
351 351 grafting 7:ef0ef43d49e7 "2"
352 352
353 353 $ hg log -r 7 --template '{rev}:{node}\n'
354 354 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
355 355 $ hg log -r 2 --template '{rev}:{node}\n'
356 356 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
357 357
358 358 $ hg log --debug -r tip
359 359 changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9
360 360 tag: tip
361 361 phase: draft
362 362 parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
363 363 parent: -1:0000000000000000000000000000000000000000
364 364 manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637
365 365 user: foo
366 366 date: Thu Jan 01 00:00:00 1970 +0000
367 367 files+: b
368 368 files-: a
369 369 extra: branch=default
370 370 extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82
371 371 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
372 372 description:
373 373 2
374 374
375 375
376 376 Disallow grafting an already grafted cset onto its original branch
377 377 $ hg up -q 6
378 378 $ hg graft 7
379 379 skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
380 380 [255]
381 381
382 382 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13
383 383 --- */hg-5c095ad7e90f.patch * (glob)
384 384 +++ */hg-7a4785234d87.patch * (glob)
385 385 @@ -1,18 +1,18 @@
386 386 # HG changeset patch
387 387 -# User test
388 388 +# User foo
389 389 # Date 0 0
390 390 # Thu Jan 01 00:00:00 1970 +0000
391 391 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
392 392 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
393 393 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
394 394 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
395 395 2
396 396
397 397 -diff -r 5d205f8b35b6 -r 5c095ad7e90f a
398 398 +diff -r b592ea63bb0c -r 7a4785234d87 a
399 399 --- a/a Thu Jan 01 00:00:00 1970 +0000
400 400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
401 401 @@ -1,1 +0,0 @@
402 402 --b
403 403 -diff -r 5d205f8b35b6 -r 5c095ad7e90f b
404 404 +-a
405 405 +diff -r b592ea63bb0c -r 7a4785234d87 b
406 406 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
407 407 +++ b/b Thu Jan 01 00:00:00 1970 +0000
408 408 @@ -0,0 +1,1 @@
409 409 -+b
410 410 ++a
411 411 [1]
412 412
413 413 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 -X .
414 414 --- */hg-5c095ad7e90f.patch * (glob)
415 415 +++ */hg-7a4785234d87.patch * (glob)
416 416 @@ -1,8 +1,8 @@
417 417 # HG changeset patch
418 418 -# User test
419 419 +# User foo
420 420 # Date 0 0
421 421 # Thu Jan 01 00:00:00 1970 +0000
422 422 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
423 423 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
424 424 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
425 425 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
426 426 2
427 427
428 428 [1]
429 429
430 430 Disallow grafting already grafted csets with the same origin onto each other
431 431 $ hg up -q 13
432 432 $ hg graft 2
433 433 skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87)
434 434 [255]
435 435 $ hg graft 7
436 436 skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f)
437 437 [255]
438 438
439 439 $ hg up -q 7
440 440 $ hg graft 2
441 441 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
442 442 [255]
443 443 $ hg graft tip
444 444 skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f)
445 445 [255]
446 446
447 447 Graft with --log
448 448
449 449 $ hg up -Cq 1
450 450 $ hg graft 3 --log -u foo
451 451 grafting 3:4c60f11aa304 "3"
452 452 warning: can't find ancestor for 'c' copied from 'b'!
453 453 $ hg log --template '{rev}:{node|short} {parents} {desc}\n' -r tip
454 454 14:0c921c65ef1e 1:5d205f8b35b6 3
455 455 (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
456 456
457 457 Resolve conflicted graft
458 458 $ hg up -q 0
459 459 $ echo b > a
460 460 $ hg ci -m 8
461 461 created new head
462 462 $ echo c > a
463 463 $ hg ci -m 9
464 464 $ hg graft 1 --tool internal:fail
465 465 grafting 1:5d205f8b35b6 "1"
466 466 abort: unresolved conflicts, can't continue
467 467 (use 'hg resolve' and 'hg graft --continue')
468 468 [255]
469 469 $ hg resolve --all
470 470 merging a
471 471 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
472 472 [1]
473 473 $ cat a
474 474 <<<<<<< local: aaa4406d4f0a - test: 9
475 475 c
476 476 =======
477 477 b
478 478 >>>>>>> graft: 5d205f8b35b6 - bar: 1
479 479 $ echo b > a
480 480 $ hg resolve -m a
481 481 (no more unresolved files)
482 482 continue: hg graft --continue
483 483 $ hg graft -c
484 484 grafting 1:5d205f8b35b6 "1"
485 485 $ hg export tip --git
486 486 # HG changeset patch
487 487 # User bar
488 488 # Date 0 0
489 489 # Thu Jan 01 00:00:00 1970 +0000
490 490 # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be
491 491 # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6
492 492 1
493 493
494 494 diff --git a/a b/a
495 495 --- a/a
496 496 +++ b/a
497 497 @@ -1,1 +1,1 @@
498 498 -c
499 499 +b
500 500
501 501 Resolve conflicted graft with rename
502 502 $ echo c > a
503 503 $ hg ci -m 10
504 504 $ hg graft 2 --tool internal:fail
505 505 grafting 2:5c095ad7e90f "2"
506 506 abort: unresolved conflicts, can't continue
507 507 (use 'hg resolve' and 'hg graft --continue')
508 508 [255]
509 509 $ hg resolve --all
510 510 merging a and b to b
511 511 (no more unresolved files)
512 512 continue: hg graft --continue
513 513 $ hg graft -c
514 514 grafting 2:5c095ad7e90f "2"
515 515 $ hg export tip --git
516 516 # HG changeset patch
517 517 # User test
518 518 # Date 0 0
519 519 # Thu Jan 01 00:00:00 1970 +0000
520 520 # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc
521 521 # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612
522 522 2
523 523
524 524 diff --git a/a b/b
525 525 rename from a
526 526 rename to b
527 527
528 528 Test simple origin(), with and without args
529 529 $ hg log -r 'origin()'
530 530 changeset: 1:5d205f8b35b6
531 531 user: bar
532 532 date: Thu Jan 01 00:00:00 1970 +0000
533 533 summary: 1
534 534
535 535 changeset: 2:5c095ad7e90f
536 536 user: test
537 537 date: Thu Jan 01 00:00:00 1970 +0000
538 538 summary: 2
539 539
540 540 changeset: 3:4c60f11aa304
541 541 user: baz
542 542 date: Thu Jan 01 00:00:00 1970 +0000
543 543 summary: 3
544 544
545 545 changeset: 4:9c233e8e184d
546 546 user: test
547 547 date: Thu Jan 01 00:00:00 1970 +0000
548 548 summary: 4
549 549
550 550 changeset: 5:97f8bfe72746
551 551 branch: stable
552 552 parent: 3:4c60f11aa304
553 553 user: test
554 554 date: Thu Jan 01 00:00:00 1970 +0000
555 555 summary: 5
556 556
557 557 $ hg log -r 'origin(7)'
558 558 changeset: 2:5c095ad7e90f
559 559 user: test
560 560 date: Thu Jan 01 00:00:00 1970 +0000
561 561 summary: 2
562 562
563 563 Now transplant a graft to test following through copies
564 564 $ hg up -q 0
565 565 $ hg branch -q dev
566 566 $ hg ci -qm "dev branch"
567 567 $ hg --config extensions.transplant= transplant -q 7
568 568 $ hg log -r 'origin(.)'
569 569 changeset: 2:5c095ad7e90f
570 570 user: test
571 571 date: Thu Jan 01 00:00:00 1970 +0000
572 572 summary: 2
573 573
574 574 Test that the graft and transplant markers in extra are converted, allowing
575 575 origin() to still work. Note that these recheck the immediately preceeding two
576 576 tests.
577 577 $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted
578 578
579 579 The graft case
580 580 $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n"
581 581 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b
582 582 branch=default
583 583 convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82
584 584 source=e0213322b2c1a5d5d236c74e79666441bee67a7d
585 585 $ hg -R ../converted log -r 'origin(7)'
586 586 changeset: 2:e0213322b2c1
587 587 user: test
588 588 date: Thu Jan 01 00:00:00 1970 +0000
589 589 summary: 2
590 590
591 591 Test that template correctly expands more than one 'extra' (issue4362), and that
592 592 'intermediate-source' is converted.
593 593 $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}"
594 594 Extra: branch=default
595 595 Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9
596 596 Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b
597 597 Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d
598 598
599 599 The transplant case
600 600 $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n"
601 601 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade
602 602 branch=dev
603 603 convert_revision=7e61b508e709a11d28194a5359bc3532d910af21
604 604 transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac\n`h\x9b
605 605 $ hg -R ../converted log -r 'origin(tip)'
606 606 changeset: 2:e0213322b2c1
607 607 user: test
608 608 date: Thu Jan 01 00:00:00 1970 +0000
609 609 summary: 2
610 610
611 611
612 612 Test simple destination
613 613 $ hg log -r 'destination()'
614 614 changeset: 7:ef0ef43d49e7
615 615 parent: 0:68795b066622
616 616 user: foo
617 617 date: Thu Jan 01 00:00:00 1970 +0000
618 618 summary: 2
619 619
620 620 changeset: 8:6b9e5368ca4e
621 621 user: bar
622 622 date: Thu Jan 01 00:00:00 1970 +0000
623 623 summary: 1
624 624
625 625 changeset: 9:1905859650ec
626 626 user: test
627 627 date: Thu Jan 01 00:00:00 1970 +0000
628 628 summary: 5
629 629
630 630 changeset: 10:52dc0b4c6907
631 631 user: test
632 632 date: Thu Jan 01 00:00:00 1970 +0000
633 633 summary: 4
634 634
635 635 changeset: 11:882b35362a6b
636 636 user: test
637 637 date: Thu Jan 01 00:00:00 1970 +0000
638 638 summary: 3
639 639
640 640 changeset: 13:7a4785234d87
641 641 user: foo
642 642 date: Thu Jan 01 00:00:00 1970 +0000
643 643 summary: 2
644 644
645 645 changeset: 14:0c921c65ef1e
646 646 parent: 1:5d205f8b35b6
647 647 user: foo
648 648 date: Thu Jan 01 00:00:00 1970 +0000
649 649 summary: 3
650 650
651 651 changeset: 17:f67661df0c48
652 652 user: bar
653 653 date: Thu Jan 01 00:00:00 1970 +0000
654 654 summary: 1
655 655
656 656 changeset: 19:9627f653b421
657 657 user: test
658 658 date: Thu Jan 01 00:00:00 1970 +0000
659 659 summary: 2
660 660
661 661 changeset: 21:7e61b508e709
662 662 branch: dev
663 663 tag: tip
664 664 user: foo
665 665 date: Thu Jan 01 00:00:00 1970 +0000
666 666 summary: 2
667 667
668 668 $ hg log -r 'destination(2)'
669 669 changeset: 7:ef0ef43d49e7
670 670 parent: 0:68795b066622
671 671 user: foo
672 672 date: Thu Jan 01 00:00:00 1970 +0000
673 673 summary: 2
674 674
675 675 changeset: 13:7a4785234d87
676 676 user: foo
677 677 date: Thu Jan 01 00:00:00 1970 +0000
678 678 summary: 2
679 679
680 680 changeset: 19:9627f653b421
681 681 user: test
682 682 date: Thu Jan 01 00:00:00 1970 +0000
683 683 summary: 2
684 684
685 685 changeset: 21:7e61b508e709
686 686 branch: dev
687 687 tag: tip
688 688 user: foo
689 689 date: Thu Jan 01 00:00:00 1970 +0000
690 690 summary: 2
691 691
692 692 Transplants of grafts can find a destination...
693 693 $ hg log -r 'destination(7)'
694 694 changeset: 21:7e61b508e709
695 695 branch: dev
696 696 tag: tip
697 697 user: foo
698 698 date: Thu Jan 01 00:00:00 1970 +0000
699 699 summary: 2
700 700
701 701 ... grafts of grafts unfortunately can't
702 702 $ hg graft -q 13
703 703 warning: can't find ancestor for 'b' copied from 'a'!
704 704 $ hg log -r 'destination(13)'
705 705 All copies of a cset
706 706 $ hg log -r 'origin(13) or destination(origin(13))'
707 707 changeset: 2:5c095ad7e90f
708 708 user: test
709 709 date: Thu Jan 01 00:00:00 1970 +0000
710 710 summary: 2
711 711
712 712 changeset: 7:ef0ef43d49e7
713 713 parent: 0:68795b066622
714 714 user: foo
715 715 date: Thu Jan 01 00:00:00 1970 +0000
716 716 summary: 2
717 717
718 718 changeset: 13:7a4785234d87
719 719 user: foo
720 720 date: Thu Jan 01 00:00:00 1970 +0000
721 721 summary: 2
722 722
723 723 changeset: 19:9627f653b421
724 724 user: test
725 725 date: Thu Jan 01 00:00:00 1970 +0000
726 726 summary: 2
727 727
728 728 changeset: 21:7e61b508e709
729 729 branch: dev
730 730 user: foo
731 731 date: Thu Jan 01 00:00:00 1970 +0000
732 732 summary: 2
733 733
734 734 changeset: 22:d1cb6591fa4b
735 735 branch: dev
736 736 tag: tip
737 737 user: foo
738 738 date: Thu Jan 01 00:00:00 1970 +0000
739 739 summary: 2
740 740
741 741
742 742 graft works on complex revset
743 743
744 744 $ hg graft 'origin(13) or destination(origin(13))'
745 745 skipping ancestor revision 21:7e61b508e709
746 746 skipping ancestor revision 22:d1cb6591fa4b
747 747 skipping revision 2:5c095ad7e90f (already grafted to 22:d1cb6591fa4b)
748 748 grafting 7:ef0ef43d49e7 "2"
749 749 warning: can't find ancestor for 'b' copied from 'a'!
750 750 grafting 13:7a4785234d87 "2"
751 751 warning: can't find ancestor for 'b' copied from 'a'!
752 752 grafting 19:9627f653b421 "2"
753 753 merging b
754 754 warning: can't find ancestor for 'b' copied from 'a'!
755 755
756 756 graft with --force (still doesn't graft merges)
757 757
758 758 $ hg graft 19 0 6
759 759 skipping ungraftable merge revision 6
760 760 skipping ancestor revision 0:68795b066622
761 761 skipping already grafted revision 19:9627f653b421 (22:d1cb6591fa4b also has origin 2:5c095ad7e90f)
762 762 [255]
763 763 $ hg graft 19 0 6 --force
764 764 skipping ungraftable merge revision 6
765 765 grafting 19:9627f653b421 "2"
766 766 merging b
767 767 warning: can't find ancestor for 'b' copied from 'a'!
768 768 grafting 0:68795b066622 "0"
769 769
770 770 graft --force after backout
771 771
772 772 $ echo abc > a
773 773 $ hg ci -m 28
774 774 $ hg backout 28
775 775 reverting a
776 776 changeset 29:53177ba928f6 backs out changeset 28:50a516bb8b57
777 777 $ hg graft 28
778 778 skipping ancestor revision 28:50a516bb8b57
779 779 [255]
780 780 $ hg graft 28 --force
781 781 grafting 28:50a516bb8b57 "28"
782 782 merging a
783 783 $ cat a
784 784 abc
785 785
786 786 graft --continue after --force
787 787
788 788 $ echo def > a
789 789 $ hg ci -m 31
790 790 $ hg graft 28 --force --tool internal:fail
791 791 grafting 28:50a516bb8b57 "28"
792 792 abort: unresolved conflicts, can't continue
793 793 (use 'hg resolve' and 'hg graft --continue')
794 794 [255]
795 795 $ hg resolve --all
796 796 merging a
797 797 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
798 798 [1]
799 799 $ echo abc > a
800 800 $ hg resolve -m a
801 801 (no more unresolved files)
802 802 continue: hg graft --continue
803 803 $ hg graft -c
804 804 grafting 28:50a516bb8b57 "28"
805 805 $ cat a
806 806 abc
807 807
808 808 Continue testing same origin policy, using revision numbers from test above
809 809 but do some destructive editing of the repo:
810 810
811 811 $ hg up -qC 7
812 812 $ hg tag -l -r 13 tmp
813 813 $ hg --config extensions.strip= strip 2
814 814 saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg
815 815 $ hg graft tmp
816 816 skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
817 817 [255]
818 818
819 819 Empty graft
820 820
821 821 $ hg up -qr 26
822 822 $ hg tag -f something
823 823 $ hg graft -qr 27
824 824 $ hg graft -f 27
825 825 grafting 27:ed6c7e54e319 "28"
826 826 note: graft of 27:ed6c7e54e319 created no changes to commit
827 827
828 828 $ cd ..
829 829
830 830 Graft to duplicate a commit
831 831
832 832 $ hg init graftsibling
833 833 $ cd graftsibling
834 834 $ touch a
835 835 $ hg commit -qAm a
836 836 $ touch b
837 837 $ hg commit -qAm b
838 838 $ hg log -G -T '{rev}\n'
839 839 @ 1
840 840 |
841 841 o 0
842 842
843 843 $ hg up -q 0
844 844 $ hg graft -r 1
845 845 grafting 1:0e067c57feba "b" (tip)
846 846 $ hg log -G -T '{rev}\n'
847 847 @ 2
848 848 |
849 849 | o 1
850 850 |/
851 851 o 0
852 852
853 853 Graft to duplicate a commit twice
854 854
855 855 $ hg up -q 0
856 856 $ hg graft -r 2
857 857 grafting 2:044ec77f6389 "b" (tip)
858 858 $ hg log -G -T '{rev}\n'
859 859 @ 3
860 860 |
861 861 | o 2
862 862 |/
863 863 | o 1
864 864 |/
865 865 o 0
866 866
867 867 Graft from behind a move or rename
868 868 ==================================
869 869
870 870 NOTE: This is affected by issue5343, and will need updating when it's fixed
871 871
872 872 Possible cases during a regular graft (when ca is between cta and c2):
873 873
874 874 name | c1<-cta | cta<->ca | ca->c2
875 875 A.0 | | |
876 876 A.1 | X | |
877 877 A.2 | | X |
878 878 A.3 | | | X
879 879 A.4 | X | X |
880 880 A.5 | X | | X
881 881 A.6 | | X | X
882 882 A.7 | X | X | X
883 883
884 884 A.0 is trivial, and doesn't need copy tracking.
885 885 For A.1, a forward rename is recorded in the c1 pass, to be followed later.
886 886 In A.2, the rename is recorded in the c2 pass and followed backwards.
887 887 A.3 is recorded in the c2 pass as a forward rename to be duplicated on target.
888 888 In A.4, both passes of checkcopies record incomplete renames, which are
889 889 then joined in mergecopies to record a rename to be followed.
890 890 In A.5 and A.7, the c1 pass records an incomplete rename, while the c2 pass
891 891 records an incomplete divergence. The incomplete rename is then joined to the
892 892 appropriate side of the incomplete divergence, and the result is recorded as a
893 893 divergence. The code doesn't distinguish at all between these two cases, since
894 894 the end result of them is the same: an incomplete divergence joined with an
895 895 incomplete rename into a divergence.
896 896 Finally, A.6 records a divergence entirely in the c2 pass.
897 897
898 898 A.4 has a degenerate case a<-b<-a->a, where checkcopies isn't needed at all.
899 899 A.5 has a special case a<-b<-b->a, which is treated like a<-b->a in a merge.
900 900 A.6 has a special case a<-a<-b->a. Here, checkcopies will find a spurious
901 901 incomplete divergence, which is in fact complete. This is handled later in
902 902 mergecopies.
903 903 A.7 has 4 special cases: a<-b<-a->b (the "ping-pong" case), a<-b<-c->b,
904 904 a<-b<-a->c and a<-b<-c->a. Of these, only the "ping-pong" case is interesting,
905 905 the others are fairly trivial (a<-b<-c->b and a<-b<-a->c proceed like the base
906 906 case, a<-b<-c->a is treated the same as a<-b<-b->a).
907 907
908 908 f5a therefore tests the "ping-pong" rename case, where a file is renamed to the
909 909 same name on both branches, then the rename is backed out on one branch, and
910 910 the backout is grafted to the other branch. This creates a challenging rename
911 911 sequence of a<-b<-a->b in the graft target, topological CA, graft CA and graft
912 912 source, respectively. Since rename detection will run on the c1 side for such a
913 913 sequence (as for technical reasons, we split the c1 and c2 sides not at the
914 914 graft CA, but rather at the topological CA), it will pick up a false rename,
915 915 and cause a spurious merge conflict. This false rename is always exactly the
916 916 reverse of the true rename that would be detected on the c2 side, so we can
917 917 correct for it by detecting this condition and reversing as necessary.
918 918
919 919 First, set up the repository with commits to be grafted
920 920
921 921 $ hg init ../graftmove
922 922 $ cd ../graftmove
923 923 $ echo c1a > f1a
924 924 $ echo c2a > f2a
925 925 $ echo c3a > f3a
926 926 $ echo c4a > f4a
927 927 $ echo c5a > f5a
928 928 $ hg ci -qAm A0
929 929 $ hg mv f1a f1b
930 930 $ hg mv f3a f3b
931 931 $ hg mv f5a f5b
932 932 $ hg ci -qAm B0
933 933 $ echo c1c > f1b
934 934 $ hg mv f2a f2c
935 935 $ hg mv f5b f5a
936 936 $ echo c5c > f5a
937 937 $ hg ci -qAm C0
938 938 $ hg mv f3b f3d
939 939 $ echo c4d > f4a
940 940 $ hg ci -qAm D0
941 941 $ hg log -G
942 942 @ changeset: 3:b69f5839d2d9
943 943 | tag: tip
944 944 | user: test
945 945 | date: Thu Jan 01 00:00:00 1970 +0000
946 946 | summary: D0
947 947 |
948 948 o changeset: 2:f58c7e2b28fa
949 949 | user: test
950 950 | date: Thu Jan 01 00:00:00 1970 +0000
951 951 | summary: C0
952 952 |
953 953 o changeset: 1:3d7bba921b5d
954 954 | user: test
955 955 | date: Thu Jan 01 00:00:00 1970 +0000
956 956 | summary: B0
957 957 |
958 958 o changeset: 0:11f7a1b56675
959 959 user: test
960 960 date: Thu Jan 01 00:00:00 1970 +0000
961 961 summary: A0
962 962
963 963
964 964 Test the cases A.2 (f1x), A.3 (f2x) and a special case of A.6 (f5x) where the
965 965 two renames actually converge to the same name (thus no actual divergence).
966 966
967 967 $ hg up -q 'desc("A0")'
968 968 $ HGEDITOR="echo C1 >" hg graft -r 'desc("C0")' --edit
969 969 grafting 2:f58c7e2b28fa "C0"
970 970 merging f1a and f1b to f1a
971 971 merging f5a
972 972 warning: can't find ancestor for 'f5a' copied from 'f5b'!
973 973 $ hg status --change .
974 974 M f1a
975 975 M f5a
976 976 A f2c
977 977 R f2a
978 978 $ hg cat f1a
979 979 c1c
980 980 $ hg cat f1b
981 981 f1b: no such file in rev c9763722f9bd
982 982 [1]
983 983
984 984 Test the cases A.0 (f4x) and A.6 (f3x)
985 985
986 986 $ HGEDITOR="echo D1 >" hg graft -r 'desc("D0")' --edit
987 987 grafting 3:b69f5839d2d9 "D0"
988 988 note: possible conflict - f3b was renamed multiple times to:
989 989 f3d
990 990 f3a
991 991 warning: can't find ancestor for 'f3d' copied from 'f3b'!
992 992
993 993 Set up the repository for some further tests
994 994
995 995 $ hg up -q "min(desc("A0"))"
996 996 $ hg mv f1a f1e
997 997 $ echo c2e > f2a
998 998 $ hg mv f3a f3e
999 999 $ hg mv f4a f4e
1000 1000 $ hg mv f5a f5b
1001 1001 $ hg ci -qAm "E0"
1002 1002 $ hg log -G
1003 1003 @ changeset: 6:6bd1736cab86
1004 1004 | tag: tip
1005 1005 | parent: 0:11f7a1b56675
1006 1006 | user: test
1007 1007 | date: Thu Jan 01 00:00:00 1970 +0000
1008 1008 | summary: E0
1009 1009 |
1010 1010 | o changeset: 5:560daee679da
1011 1011 | | user: test
1012 1012 | | date: Thu Jan 01 00:00:00 1970 +0000
1013 1013 | | summary: D1
1014 1014 | |
1015 1015 | o changeset: 4:c9763722f9bd
1016 1016 |/ parent: 0:11f7a1b56675
1017 1017 | user: test
1018 1018 | date: Thu Jan 01 00:00:00 1970 +0000
1019 1019 | summary: C1
1020 1020 |
1021 1021 | o changeset: 3:b69f5839d2d9
1022 1022 | | user: test
1023 1023 | | date: Thu Jan 01 00:00:00 1970 +0000
1024 1024 | | summary: D0
1025 1025 | |
1026 1026 | o changeset: 2:f58c7e2b28fa
1027 1027 | | user: test
1028 1028 | | date: Thu Jan 01 00:00:00 1970 +0000
1029 1029 | | summary: C0
1030 1030 | |
1031 1031 | o changeset: 1:3d7bba921b5d
1032 1032 |/ user: test
1033 1033 | date: Thu Jan 01 00:00:00 1970 +0000
1034 1034 | summary: B0
1035 1035 |
1036 1036 o changeset: 0:11f7a1b56675
1037 1037 user: test
1038 1038 date: Thu Jan 01 00:00:00 1970 +0000
1039 1039 summary: A0
1040 1040
1041 1041
1042 1042 Test the cases A.4 (f1x), the "ping-pong" special case of A.7 (f5x),
1043 1043 and A.3 with a local content change to be preserved (f2x).
1044 1044
1045 1045 $ HGEDITOR="echo C2 >" hg graft -r 'desc("C0")' --edit
1046 1046 grafting 2:f58c7e2b28fa "C0"
1047 1047 merging f1e and f1b to f1e
1048 1048 merging f2a and f2c to f2c
1049 1049 merging f5b and f5a to f5a
1050 1050
1051 1051 Test the cases A.1 (f4x) and A.7 (f3x).
1052 1052
1053 1053 $ HGEDITOR="echo D2 >" hg graft -r 'desc("D0")' --edit
1054 1054 grafting 3:b69f5839d2d9 "D0"
1055 1055 note: possible conflict - f3b was renamed multiple times to:
1056 1056 f3e
1057 1057 f3d
1058 1058 merging f4e and f4a to f4e
1059 1059 warning: can't find ancestor for 'f3d' copied from 'f3b'!
1060 1060
1061 1061 Check the results of the grafts tested
1062 1062
1063 1063 $ hg log -CGv --patch --git
1064 1064 @ changeset: 8:93ee502e8b0a
1065 1065 | tag: tip
1066 1066 | user: test
1067 1067 | date: Thu Jan 01 00:00:00 1970 +0000
1068 1068 | files: f3d f4e
1069 1069 | description:
1070 1070 | D2
1071 1071 |
1072 1072 |
1073 1073 | diff --git a/f3d b/f3d
1074 1074 | new file mode 100644
1075 1075 | --- /dev/null
1076 1076 | +++ b/f3d
1077 1077 | @@ -0,0 +1,1 @@
1078 1078 | +c3a
1079 1079 | diff --git a/f4e b/f4e
1080 1080 | --- a/f4e
1081 1081 | +++ b/f4e
1082 1082 | @@ -1,1 +1,1 @@
1083 1083 | -c4a
1084 1084 | +c4d
1085 1085 |
1086 1086 o changeset: 7:539cf145f496
1087 1087 | user: test
1088 1088 | date: Thu Jan 01 00:00:00 1970 +0000
1089 1089 | files: f1e f2a f2c f5a f5b
1090 1090 | copies: f2c (f2a) f5a (f5b)
1091 1091 | description:
1092 1092 | C2
1093 1093 |
1094 1094 |
1095 1095 | diff --git a/f1e b/f1e
1096 1096 | --- a/f1e
1097 1097 | +++ b/f1e
1098 1098 | @@ -1,1 +1,1 @@
1099 1099 | -c1a
1100 1100 | +c1c
1101 1101 | diff --git a/f2a b/f2c
1102 1102 | rename from f2a
1103 1103 | rename to f2c
1104 1104 | diff --git a/f5b b/f5a
1105 1105 | rename from f5b
1106 1106 | rename to f5a
1107 1107 | --- a/f5b
1108 1108 | +++ b/f5a
1109 1109 | @@ -1,1 +1,1 @@
1110 1110 | -c5a
1111 1111 | +c5c
1112 1112 |
1113 1113 o changeset: 6:6bd1736cab86
1114 1114 | parent: 0:11f7a1b56675
1115 1115 | user: test
1116 1116 | date: Thu Jan 01 00:00:00 1970 +0000
1117 1117 | files: f1a f1e f2a f3a f3e f4a f4e f5a f5b
1118 1118 | copies: f1e (f1a) f3e (f3a) f4e (f4a) f5b (f5a)
1119 1119 | description:
1120 1120 | E0
1121 1121 |
1122 1122 |
1123 1123 | diff --git a/f1a b/f1e
1124 1124 | rename from f1a
1125 1125 | rename to f1e
1126 1126 | diff --git a/f2a b/f2a
1127 1127 | --- a/f2a
1128 1128 | +++ b/f2a
1129 1129 | @@ -1,1 +1,1 @@
1130 1130 | -c2a
1131 1131 | +c2e
1132 1132 | diff --git a/f3a b/f3e
1133 1133 | rename from f3a
1134 1134 | rename to f3e
1135 1135 | diff --git a/f4a b/f4e
1136 1136 | rename from f4a
1137 1137 | rename to f4e
1138 1138 | diff --git a/f5a b/f5b
1139 1139 | rename from f5a
1140 1140 | rename to f5b
1141 1141 |
1142 1142 | o changeset: 5:560daee679da
1143 1143 | | user: test
1144 1144 | | date: Thu Jan 01 00:00:00 1970 +0000
1145 1145 | | files: f3d f4a
1146 1146 | | description:
1147 1147 | | D1
1148 1148 | |
1149 1149 | |
1150 1150 | | diff --git a/f3d b/f3d
1151 1151 | | new file mode 100644
1152 1152 | | --- /dev/null
1153 1153 | | +++ b/f3d
1154 1154 | | @@ -0,0 +1,1 @@
1155 1155 | | +c3a
1156 1156 | | diff --git a/f4a b/f4a
1157 1157 | | --- a/f4a
1158 1158 | | +++ b/f4a
1159 1159 | | @@ -1,1 +1,1 @@
1160 1160 | | -c4a
1161 1161 | | +c4d
1162 1162 | |
1163 1163 | o changeset: 4:c9763722f9bd
1164 1164 |/ parent: 0:11f7a1b56675
1165 1165 | user: test
1166 1166 | date: Thu Jan 01 00:00:00 1970 +0000
1167 1167 | files: f1a f2a f2c f5a
1168 1168 | copies: f2c (f2a)
1169 1169 | description:
1170 1170 | C1
1171 1171 |
1172 1172 |
1173 1173 | diff --git a/f1a b/f1a
1174 1174 | --- a/f1a
1175 1175 | +++ b/f1a
1176 1176 | @@ -1,1 +1,1 @@
1177 1177 | -c1a
1178 1178 | +c1c
1179 1179 | diff --git a/f2a b/f2c
1180 1180 | rename from f2a
1181 1181 | rename to f2c
1182 1182 | diff --git a/f5a b/f5a
1183 1183 | --- a/f5a
1184 1184 | +++ b/f5a
1185 1185 | @@ -1,1 +1,1 @@
1186 1186 | -c5a
1187 1187 | +c5c
1188 1188 |
1189 1189 | o changeset: 3:b69f5839d2d9
1190 1190 | | user: test
1191 1191 | | date: Thu Jan 01 00:00:00 1970 +0000
1192 1192 | | files: f3b f3d f4a
1193 1193 | | copies: f3d (f3b)
1194 1194 | | description:
1195 1195 | | D0
1196 1196 | |
1197 1197 | |
1198 1198 | | diff --git a/f3b b/f3d
1199 1199 | | rename from f3b
1200 1200 | | rename to f3d
1201 1201 | | diff --git a/f4a b/f4a
1202 1202 | | --- a/f4a
1203 1203 | | +++ b/f4a
1204 1204 | | @@ -1,1 +1,1 @@
1205 1205 | | -c4a
1206 1206 | | +c4d
1207 1207 | |
1208 1208 | o changeset: 2:f58c7e2b28fa
1209 1209 | | user: test
1210 1210 | | date: Thu Jan 01 00:00:00 1970 +0000
1211 1211 | | files: f1b f2a f2c f5a f5b
1212 1212 | | copies: f2c (f2a) f5a (f5b)
1213 1213 | | description:
1214 1214 | | C0
1215 1215 | |
1216 1216 | |
1217 1217 | | diff --git a/f1b b/f1b
1218 1218 | | --- a/f1b
1219 1219 | | +++ b/f1b
1220 1220 | | @@ -1,1 +1,1 @@
1221 1221 | | -c1a
1222 1222 | | +c1c
1223 1223 | | diff --git a/f2a b/f2c
1224 1224 | | rename from f2a
1225 1225 | | rename to f2c
1226 1226 | | diff --git a/f5b b/f5a
1227 1227 | | rename from f5b
1228 1228 | | rename to f5a
1229 1229 | | --- a/f5b
1230 1230 | | +++ b/f5a
1231 1231 | | @@ -1,1 +1,1 @@
1232 1232 | | -c5a
1233 1233 | | +c5c
1234 1234 | |
1235 1235 | o changeset: 1:3d7bba921b5d
1236 1236 |/ user: test
1237 1237 | date: Thu Jan 01 00:00:00 1970 +0000
1238 1238 | files: f1a f1b f3a f3b f5a f5b
1239 1239 | copies: f1b (f1a) f3b (f3a) f5b (f5a)
1240 1240 | description:
1241 1241 | B0
1242 1242 |
1243 1243 |
1244 1244 | diff --git a/f1a b/f1b
1245 1245 | rename from f1a
1246 1246 | rename to f1b
1247 1247 | diff --git a/f3a b/f3b
1248 1248 | rename from f3a
1249 1249 | rename to f3b
1250 1250 | diff --git a/f5a b/f5b
1251 1251 | rename from f5a
1252 1252 | rename to f5b
1253 1253 |
1254 1254 o changeset: 0:11f7a1b56675
1255 1255 user: test
1256 1256 date: Thu Jan 01 00:00:00 1970 +0000
1257 1257 files: f1a f2a f3a f4a f5a
1258 1258 description:
1259 1259 A0
1260 1260
1261 1261
1262 1262 diff --git a/f1a b/f1a
1263 1263 new file mode 100644
1264 1264 --- /dev/null
1265 1265 +++ b/f1a
1266 1266 @@ -0,0 +1,1 @@
1267 1267 +c1a
1268 1268 diff --git a/f2a b/f2a
1269 1269 new file mode 100644
1270 1270 --- /dev/null
1271 1271 +++ b/f2a
1272 1272 @@ -0,0 +1,1 @@
1273 1273 +c2a
1274 1274 diff --git a/f3a b/f3a
1275 1275 new file mode 100644
1276 1276 --- /dev/null
1277 1277 +++ b/f3a
1278 1278 @@ -0,0 +1,1 @@
1279 1279 +c3a
1280 1280 diff --git a/f4a b/f4a
1281 1281 new file mode 100644
1282 1282 --- /dev/null
1283 1283 +++ b/f4a
1284 1284 @@ -0,0 +1,1 @@
1285 1285 +c4a
1286 1286 diff --git a/f5a b/f5a
1287 1287 new file mode 100644
1288 1288 --- /dev/null
1289 1289 +++ b/f5a
1290 1290 @@ -0,0 +1,1 @@
1291 1291 +c5a
1292 1292
1293 1293 $ hg cat f2c
1294 1294 c2e
1295 1295
1296 1296 Check superfluous filemerge of files renamed in the past but untouched by graft
1297 1297
1298 1298 $ echo a > a
1299 1299 $ hg ci -qAma
1300 1300 $ hg mv a b
1301 1301 $ echo b > b
1302 1302 $ hg ci -qAmb
1303 1303 $ echo c > c
1304 1304 $ hg ci -qAmc
1305 1305 $ hg up -q .~2
1306 1306 $ hg graft tip -qt:fail
1307 1307
1308 1308 $ cd ..
1309 1309
1310 1310 Graft a change into a new file previously grafted into a renamed directory
1311 1311
1312 1312 $ hg init dirmovenewfile
1313 1313 $ cd dirmovenewfile
1314 1314 $ mkdir a
1315 1315 $ echo a > a/a
1316 1316 $ hg ci -qAma
1317 1317 $ echo x > a/x
1318 1318 $ hg ci -qAmx
1319 1319 $ hg up -q 0
1320 1320 $ hg mv -q a b
1321 1321 $ hg ci -qAmb
1322 1322 $ hg graft -q 1 # a/x grafted as b/x, but no copy information recorded
1323 1323 $ hg up -q 1
1324 1324 $ echo y > a/x
1325 1325 $ hg ci -qAmy
1326 1326 $ hg up -q 3
1327 1327 $ hg graft -q 4
1328 1328 $ hg status --change .
1329 1329 M b/x
1330 1330
1331 1331 Prepare for test of skipped changesets and how merges can influence it:
1332 1332
1333 1333 $ hg merge -q -r 1 --tool :local
1334 1334 $ hg ci -m m
1335 1335 $ echo xx >> b/x
1336 1336 $ hg ci -m xx
1337 1337
1338 1338 $ hg log -G -T '{rev} {desc|firstline}'
1339 1339 @ 7 xx
1340 1340 |
1341 1341 o 6 m
1342 1342 |\
1343 1343 | o 5 y
1344 1344 | |
1345 1345 +---o 4 y
1346 1346 | |
1347 1347 | o 3 x
1348 1348 | |
1349 1349 | o 2 b
1350 1350 | |
1351 1351 o | 1 x
1352 1352 |/
1353 1353 o 0 a
1354 1354
1355 1355 Grafting of plain changes correctly detects that 3 and 5 should be skipped:
1356 1356
1357 1357 $ hg up -qCr 4
1358 1358 $ hg graft --tool :local -r 2::5
1359 1359 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
1360 1360 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
1361 1361 grafting 2:42127f193bcd "b"
1362 1362
1363 1363 Extending the graft range to include a (skipped) merge of 3 will not prevent us from
1364 1364 also detecting that both 3 and 5 should be skipped:
1365 1365
1366 1366 $ hg up -qCr 4
1367 1367 $ hg graft --tool :local -r 2::7
1368 1368 skipping ungraftable merge revision 6
1369 1369 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
1370 1370 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
1371 1371 grafting 2:42127f193bcd "b"
1372 1372 grafting 7:d3c3f2b38ecc "xx"
1373 1373 note: graft of 7:d3c3f2b38ecc created no changes to commit
1374 1374
1375 1375 $ cd ..
1376
1377 Testing the reading of old format graftstate file with newer mercurial
1378
1379 $ hg init oldgraft
1380 $ cd oldgraft
1381 $ for ch in a b c; do echo foo > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
1382 $ hg log -GT "{rev}:{node|short} {desc}\n"
1383 @ 2:8be98ac1a569 added c
1384 |
1385 o 1:80e6d2c47cfe added b
1386 |
1387 o 0:f7ad41964313 added a
1388
1389 $ hg up 0
1390 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1391 $ echo bar > b
1392 $ hg add b
1393 $ hg ci -m "bar to b"
1394 created new head
1395 $ hg graft -r 1 -r 2
1396 grafting 1:80e6d2c47cfe "added b"
1397 merging b
1398 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1399 abort: unresolved conflicts, can't continue
1400 (use 'hg resolve' and 'hg graft --continue')
1401 [255]
1402
1403 Writing the nodes in old format to graftstate
1404
1405 $ hg log -r 1 -r 2 -T '{node}\n' > .hg/graftstate
1406 $ echo foo > b
1407 $ hg resolve -m
1408 (no more unresolved files)
1409 continue: hg graft --continue
1410 $ hg graft --continue
1411 grafting 1:80e6d2c47cfe "added b"
1412 grafting 2:8be98ac1a569 "added c"
General Comments 0
You need to be logged in to leave comments. Login now