##// END OF EJS Templates
tests: avoid grafting the same change over and over...
Martin von Zweigbergk -
r44496:f3ad014b default
parent child Browse files
Show More
@@ -1,924 +1,917 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 # for conflicts in e, choose 5 and ignore 4
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 Test --base for grafting the merge of 4 from the perspective of 5, thus only getting the change to d
50 50
51 51 $ hg up -cqr 3
52 52 $ hg graft -r 6 --base 5
53 53 grafting 6:25a2b029d3ae "6" (tip)
54 54 merging e
55 55 $ hg st --change .
56 56 M d
57 57
58 58 $ hg -q strip . --config extensions.strip=
59 59
60 60 Test --base for collapsing changesets 2 and 3, thus getting both b and c
61 61
62 62 $ hg up -cqr 0
63 63 $ hg graft -r 3 --base 1
64 64 grafting 3:4c60f11aa304 "3"
65 65 merging a and b to b
66 66 merging a and c to c
67 67 $ hg st --change .
68 68 A b
69 69 A c
70 70 R a
71 71
72 72 $ hg -q strip . --config extensions.strip=
73 73
74 74 Specifying child as --base revision fails safely (perhaps slightly confusing, but consistent)
75 75
76 76 $ hg graft -r 2 --base 3
77 77 grafting 2:5c095ad7e90f "2"
78 78 note: possible conflict - c was deleted and renamed to:
79 79 a
80 80 note: graft of 2:5c095ad7e90f created no changes to commit
81 81
82 82 Can't continue without starting:
83 83
84 84 $ hg -q up -cr tip
85 85 $ hg rm -q e
86 86 $ hg graft --continue
87 87 abort: no graft in progress
88 88 [255]
89 89 $ hg revert -r . -q e
90 90
91 91 Need to specify a rev:
92 92
93 93 $ hg graft
94 94 abort: no revisions specified
95 95 [255]
96 96
97 97 Can't graft ancestor:
98 98
99 99 $ hg graft 1 2
100 100 skipping ancestor revision 1:5d205f8b35b6
101 101 skipping ancestor revision 2:5c095ad7e90f
102 102 [255]
103 103
104 104 Specify revisions with -r:
105 105
106 106 $ hg graft -r 1 -r 2
107 107 skipping ancestor revision 1:5d205f8b35b6
108 108 skipping ancestor revision 2:5c095ad7e90f
109 109 [255]
110 110
111 111 $ hg graft -r 1 2
112 112 warning: inconsistent use of --rev might give unexpected revision ordering!
113 113 skipping ancestor revision 2:5c095ad7e90f
114 114 skipping ancestor revision 1:5d205f8b35b6
115 115 [255]
116 116
117 117 Conflicting date/user options:
118 118
119 119 $ hg up -q 0
120 120 $ hg graft -U --user foo 2
121 121 abort: cannot specify both --user and --currentuser
122 122 [255]
123 123 $ hg graft -D --date '0 0' 2
124 124 abort: cannot specify both --date and --currentdate
125 125 [255]
126 126
127 127 Can't graft with dirty wd:
128 128
129 129 $ hg up -q 0
130 130 $ echo foo > a
131 131 $ hg graft 1
132 132 abort: uncommitted changes
133 133 [255]
134 134 $ hg revert a
135 135
136 136 Graft a rename:
137 137 (this also tests that editor is invoked if '--edit' is specified)
138 138
139 139 $ hg status --rev "2^1" --rev 2
140 140 A b
141 141 R a
142 142 $ HGEDITOR=cat hg graft 2 -u foo --edit
143 143 grafting 2:5c095ad7e90f "2"
144 144 merging a and b to b
145 145 2
146 146
147 147
148 148 HG: Enter commit message. Lines beginning with 'HG:' are removed.
149 149 HG: Leave message empty to abort commit.
150 150 HG: --
151 151 HG: user: foo
152 152 HG: branch 'default'
153 153 HG: added b
154 154 HG: removed a
155 155 $ hg export tip --git
156 156 # HG changeset patch
157 157 # User foo
158 158 # Date 0 0
159 159 # Thu Jan 01 00:00:00 1970 +0000
160 160 # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82
161 161 # Parent 68795b066622ca79a25816a662041d8f78f3cd9e
162 162 2
163 163
164 164 diff --git a/a b/b
165 165 rename from a
166 166 rename to b
167 167
168 168 Look for extra:source
169 169
170 170 $ hg log --debug -r tip
171 171 changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
172 172 tag: tip
173 173 phase: draft
174 174 parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e
175 175 parent: -1:0000000000000000000000000000000000000000
176 176 manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb
177 177 user: foo
178 178 date: Thu Jan 01 00:00:00 1970 +0000
179 179 files+: b
180 180 files-: a
181 181 extra: branch=default
182 182 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
183 183 description:
184 184 2
185 185
186 186
187 187
188 188 Graft out of order, skipping a merge and a duplicate
189 189 (this also tests that editor is not invoked if '--edit' is not specified)
190 190
191 191 $ hg graft 1 5 4 3 'merge()' 2 -n
192 192 skipping ungraftable merge revision 6
193 193 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
194 194 grafting 1:5d205f8b35b6 "1"
195 195 grafting 5:97f8bfe72746 "5"
196 196 grafting 4:9c233e8e184d "4"
197 197 grafting 3:4c60f11aa304 "3"
198 198
199 199 $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug
200 200 skipping ungraftable merge revision 6
201 201 scanning for duplicate grafts
202 202 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
203 203 grafting 1:5d205f8b35b6 "1"
204 204 unmatched files in local:
205 205 b
206 206 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
207 207 src: 'a' -> dst: 'b' *
208 208 checking for directory renames
209 209 resolving manifests
210 210 branchmerge: True, force: True, partial: False
211 211 ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6
212 212 preserving b for resolve of b
213 213 starting 4 threads for background file closing (?)
214 214 b: local copied/moved from a -> m (premerge)
215 215 picked tool ':merge' for b (binary False symlink False changedelete False)
216 216 merging b and a to b
217 217 my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622
218 218 premerge successful
219 219 committing files:
220 220 b
221 221 committing manifest
222 222 committing changelog
223 223 updating the branch cache
224 224 grafting 5:97f8bfe72746 "5"
225 225 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
226 226 src: 'c' -> dst: 'b'
227 227 checking for directory renames
228 228 resolving manifests
229 229 branchmerge: True, force: True, partial: False
230 230 ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746
231 231 e: remote is newer -> g
232 232 getting e
233 233 committing files:
234 234 e
235 235 committing manifest
236 236 committing changelog
237 237 updating the branch cache
238 238 $ HGEDITOR=cat hg graft 4 3 --log --debug
239 239 scanning for duplicate grafts
240 240 grafting 4:9c233e8e184d "4"
241 241 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
242 242 src: 'c' -> dst: 'b'
243 243 checking for directory renames
244 244 resolving manifests
245 245 branchmerge: True, force: True, partial: False
246 246 ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d
247 247 preserving e for resolve of e
248 248 d: remote is newer -> g
249 249 getting d
250 250 e: versions differ -> m (premerge)
251 251 picked tool ':merge' for e (binary False symlink False changedelete False)
252 252 merging e
253 253 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
254 254 e: versions differ -> m (merge)
255 255 picked tool ':merge' for e (binary False symlink False changedelete False)
256 256 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
257 257 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
258 258 abort: unresolved conflicts, can't continue
259 259 (use 'hg resolve' and 'hg graft --continue')
260 260 [255]
261 261
262 262 Summary should mention graft:
263 263
264 264 $ hg summary |grep graft
265 265 commit: 2 modified, 2 unknown, 1 unresolved (graft in progress)
266 266
267 267 Using status to get more context
268 268
269 269 $ hg status --verbose
270 270 M d
271 271 M e
272 272 ? a.orig
273 273 ? e.orig
274 274 # The repository is in an unfinished *graft* state.
275 275
276 276 # Unresolved merge conflicts:
277 277 #
278 278 # e
279 279 #
280 280 # To mark files as resolved: hg resolve --mark FILE
281 281
282 282 # To continue: hg graft --continue
283 283 # To abort: hg graft --abort
284 284 # To stop: hg graft --stop
285 285
286 286
287 287 Commit while interrupted should fail:
288 288
289 289 $ hg ci -m 'commit interrupted graft'
290 290 abort: graft in progress
291 291 (use 'hg graft --continue' or 'hg graft --stop' to stop)
292 292 [255]
293 293
294 294 Abort the graft and try committing:
295 295
296 296 $ hg up -C .
297 297 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
298 298 $ echo c >> e
299 299 $ hg ci -mtest
300 300
301 301 $ hg strip . --config extensions.strip=
302 302 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
303 303 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
304 304
305 305 Graft again:
306 306
307 307 $ hg graft 1 5 4 3 'merge()' 2
308 308 skipping ungraftable merge revision 6
309 309 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
310 310 skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e)
311 311 skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec)
312 312 grafting 4:9c233e8e184d "4"
313 313 merging e
314 314 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
315 315 abort: unresolved conflicts, can't continue
316 316 (use 'hg resolve' and 'hg graft --continue')
317 317 [255]
318 318
319 319 Continue without resolve should fail:
320 320
321 321 $ hg graft -c
322 322 grafting 4:9c233e8e184d "4"
323 323 abort: unresolved merge conflicts (see 'hg help resolve')
324 324 [255]
325 325
326 326 Fix up:
327 327
328 328 $ echo b > e
329 329 $ hg resolve -m e
330 330 (no more unresolved files)
331 331 continue: hg graft --continue
332 332
333 333 Continue with a revision should fail:
334 334
335 335 $ hg graft -c 6
336 336 abort: can't specify --continue and revisions
337 337 [255]
338 338
339 339 $ hg graft -c -r 6
340 340 abort: can't specify --continue and revisions
341 341 [255]
342 342
343 343 Continue for real, clobber usernames
344 344
345 345 $ hg graft -c -U
346 346 grafting 4:9c233e8e184d "4"
347 347 grafting 3:4c60f11aa304 "3"
348 348
349 349 Compare with original:
350 350
351 351 $ hg diff -r 6
352 352 $ hg status --rev 0:. -C
353 353 M d
354 354 M e
355 355 A b
356 356 a
357 357 A c
358 358 a
359 359 R a
360 360
361 361 View graph:
362 362
363 363 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
364 364 @ test@11.draft: 3
365 365 |
366 366 o test@10.draft: 4
367 367 |
368 368 o test@9.draft: 5
369 369 |
370 370 o bar@8.draft: 1
371 371 |
372 372 o foo@7.draft: 2
373 373 |
374 374 | o test@6.secret: 6
375 375 | |\
376 376 | | o test@5.draft: 5
377 377 | | |
378 378 | o | test@4.draft: 4
379 379 | |/
380 380 | o baz@3.public: 3
381 381 | |
382 382 | o test@2.public: 2
383 383 | |
384 384 | o bar@1.public: 1
385 385 |/
386 386 o test@0.public: 0
387 387
388 388 Graft again onto another branch should preserve the original source
389 389 $ hg up -q 0
390 390 $ echo 'g'>g
391 391 $ hg add g
392 392 $ hg ci -m 7
393 393 created new head
394 394 $ hg graft 7
395 395 grafting 7:ef0ef43d49e7 "2"
396 396
397 397 $ hg log -r 7 --template '{rev}:{node}\n'
398 398 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
399 399 $ hg log -r 2 --template '{rev}:{node}\n'
400 400 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
401 401
402 402 $ hg log --debug -r tip
403 403 changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9
404 404 tag: tip
405 405 phase: draft
406 406 parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
407 407 parent: -1:0000000000000000000000000000000000000000
408 408 manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637
409 409 user: foo
410 410 date: Thu Jan 01 00:00:00 1970 +0000
411 411 files+: b
412 412 files-: a
413 413 extra: branch=default
414 414 extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82
415 415 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
416 416 description:
417 417 2
418 418
419 419
420 420 Disallow grafting an already grafted cset onto its original branch
421 421 $ hg up -q 6
422 422 $ hg graft 7
423 423 skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
424 424 [255]
425 425
426 426 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13
427 427 --- */hg-5c095ad7e90f.patch * (glob)
428 428 +++ */hg-7a4785234d87.patch * (glob)
429 429 @@ -1,18 +1,18 @@
430 430 # HG changeset patch
431 431 -# User test
432 432 +# User foo
433 433 # Date 0 0
434 434 # Thu Jan 01 00:00:00 1970 +0000
435 435 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
436 436 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
437 437 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
438 438 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
439 439 2
440 440
441 441 -diff -r 5d205f8b35b6 -r 5c095ad7e90f a
442 442 +diff -r b592ea63bb0c -r 7a4785234d87 a
443 443 --- a/a Thu Jan 01 00:00:00 1970 +0000
444 444 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
445 445 @@ -1,1 +0,0 @@
446 446 --b
447 447 -diff -r 5d205f8b35b6 -r 5c095ad7e90f b
448 448 +-a
449 449 +diff -r b592ea63bb0c -r 7a4785234d87 b
450 450 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
451 451 +++ b/b Thu Jan 01 00:00:00 1970 +0000
452 452 @@ -0,0 +1,1 @@
453 453 -+b
454 454 ++a
455 455 [1]
456 456
457 457 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 -X .
458 458 --- */hg-5c095ad7e90f.patch * (glob)
459 459 +++ */hg-7a4785234d87.patch * (glob)
460 460 @@ -1,8 +1,8 @@
461 461 # HG changeset patch
462 462 -# User test
463 463 +# User foo
464 464 # Date 0 0
465 465 # Thu Jan 01 00:00:00 1970 +0000
466 466 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
467 467 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
468 468 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
469 469 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
470 470 2
471 471
472 472 [1]
473 473
474 474 Disallow grafting already grafted csets with the same origin onto each other
475 475 $ hg up -q 13
476 476 $ hg graft 2
477 477 skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87)
478 478 [255]
479 479 $ hg graft 7
480 480 skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f)
481 481 [255]
482 482
483 483 $ hg up -q 7
484 484 $ hg graft 2
485 485 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
486 486 [255]
487 487 $ hg graft tip
488 488 skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f)
489 489 [255]
490 490
491 491 Graft with --log
492 492
493 493 $ hg up -Cq 1
494 494 $ hg graft 3 --log -u foo
495 495 grafting 3:4c60f11aa304 "3"
496 496 warning: can't find ancestor for 'c' copied from 'b'!
497 497 $ hg log --template '{rev}:{node|short} {parents} {desc}\n' -r tip
498 498 14:0c921c65ef1e 1:5d205f8b35b6 3
499 499 (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
500 500
501 501 Resolve conflicted graft
502 502 $ hg up -q 0
503 503 $ echo b > a
504 504 $ hg ci -m 8
505 505 created new head
506 506 $ echo c > a
507 507 $ hg ci -m 9
508 508 $ hg graft 1 --tool internal:fail
509 509 grafting 1:5d205f8b35b6 "1"
510 510 abort: unresolved conflicts, can't continue
511 511 (use 'hg resolve' and 'hg graft --continue')
512 512 [255]
513 513 $ hg resolve --all
514 514 merging a
515 515 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
516 516 [1]
517 517 $ cat a
518 518 <<<<<<< local: aaa4406d4f0a - test: 9
519 519 c
520 520 =======
521 521 b
522 522 >>>>>>> graft: 5d205f8b35b6 - bar: 1
523 523 $ echo b > a
524 524 $ hg resolve -m a
525 525 (no more unresolved files)
526 526 continue: hg graft --continue
527 527 $ hg graft -c
528 528 grafting 1:5d205f8b35b6 "1"
529 529 $ hg export tip --git
530 530 # HG changeset patch
531 531 # User bar
532 532 # Date 0 0
533 533 # Thu Jan 01 00:00:00 1970 +0000
534 534 # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be
535 535 # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6
536 536 1
537 537
538 538 diff --git a/a b/a
539 539 --- a/a
540 540 +++ b/a
541 541 @@ -1,1 +1,1 @@
542 542 -c
543 543 +b
544 544
545 545 Resolve conflicted graft with rename
546 546 $ echo c > a
547 547 $ hg ci -m 10
548 548 $ hg graft 2 --tool internal:fail
549 549 grafting 2:5c095ad7e90f "2"
550 550 abort: unresolved conflicts, can't continue
551 551 (use 'hg resolve' and 'hg graft --continue')
552 552 [255]
553 553 $ hg resolve --all
554 554 merging a and b to b
555 555 (no more unresolved files)
556 556 continue: hg graft --continue
557 557 $ hg graft -c
558 558 grafting 2:5c095ad7e90f "2"
559 559 $ hg export tip --git
560 560 # HG changeset patch
561 561 # User test
562 562 # Date 0 0
563 563 # Thu Jan 01 00:00:00 1970 +0000
564 564 # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc
565 565 # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612
566 566 2
567 567
568 568 diff --git a/a b/b
569 569 rename from a
570 570 rename to b
571 571
572 572 Test simple origin(), with and without args
573 573 $ hg log -r 'origin()'
574 574 changeset: 1:5d205f8b35b6
575 575 user: bar
576 576 date: Thu Jan 01 00:00:00 1970 +0000
577 577 summary: 1
578 578
579 579 changeset: 2:5c095ad7e90f
580 580 user: test
581 581 date: Thu Jan 01 00:00:00 1970 +0000
582 582 summary: 2
583 583
584 584 changeset: 3:4c60f11aa304
585 585 user: baz
586 586 date: Thu Jan 01 00:00:00 1970 +0000
587 587 summary: 3
588 588
589 589 changeset: 4:9c233e8e184d
590 590 user: test
591 591 date: Thu Jan 01 00:00:00 1970 +0000
592 592 summary: 4
593 593
594 594 changeset: 5:97f8bfe72746
595 595 branch: stable
596 596 parent: 3:4c60f11aa304
597 597 user: test
598 598 date: Thu Jan 01 00:00:00 1970 +0000
599 599 summary: 5
600 600
601 601 $ hg log -r 'origin(7)'
602 602 changeset: 2:5c095ad7e90f
603 603 user: test
604 604 date: Thu Jan 01 00:00:00 1970 +0000
605 605 summary: 2
606 606
607 607 Now transplant a graft to test following through copies
608 608 $ hg up -q 0
609 609 $ hg branch -q dev
610 610 $ hg ci -qm "dev branch"
611 611 $ hg --config extensions.transplant= transplant -q 7
612 612 $ hg log -r 'origin(.)'
613 613 changeset: 2:5c095ad7e90f
614 614 user: test
615 615 date: Thu Jan 01 00:00:00 1970 +0000
616 616 summary: 2
617 617
618 618 Test that the graft and transplant markers in extra are converted, allowing
619 619 origin() to still work. Note that these recheck the immediately preceeding two
620 620 tests.
621 621 $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted
622 622
623 623 The graft case
624 624 $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n"
625 625 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b
626 626 branch=default
627 627 convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82
628 628 source=e0213322b2c1a5d5d236c74e79666441bee67a7d
629 629 $ hg -R ../converted log -r 'origin(7)'
630 630 changeset: 2:e0213322b2c1
631 631 user: test
632 632 date: Thu Jan 01 00:00:00 1970 +0000
633 633 summary: 2
634 634
635 635 Test that template correctly expands more than one 'extra' (issue4362), and that
636 636 'intermediate-source' is converted.
637 637 $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}"
638 638 Extra: branch=default
639 639 Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9
640 640 Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b
641 641 Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d
642 642
643 643 The transplant case
644 644 $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n"
645 645 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade
646 646 branch=dev
647 647 convert_revision=7e61b508e709a11d28194a5359bc3532d910af21
648 648 transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac\n`h\x9b
649 649 $ hg -R ../converted log -r 'origin(tip)'
650 650 changeset: 2:e0213322b2c1
651 651 user: test
652 652 date: Thu Jan 01 00:00:00 1970 +0000
653 653 summary: 2
654 654
655 655
656 656 Test simple destination
657 657 $ hg log -r 'destination()'
658 658 changeset: 7:ef0ef43d49e7
659 659 parent: 0:68795b066622
660 660 user: foo
661 661 date: Thu Jan 01 00:00:00 1970 +0000
662 662 summary: 2
663 663
664 664 changeset: 8:6b9e5368ca4e
665 665 user: bar
666 666 date: Thu Jan 01 00:00:00 1970 +0000
667 667 summary: 1
668 668
669 669 changeset: 9:1905859650ec
670 670 user: test
671 671 date: Thu Jan 01 00:00:00 1970 +0000
672 672 summary: 5
673 673
674 674 changeset: 10:52dc0b4c6907
675 675 user: test
676 676 date: Thu Jan 01 00:00:00 1970 +0000
677 677 summary: 4
678 678
679 679 changeset: 11:882b35362a6b
680 680 user: test
681 681 date: Thu Jan 01 00:00:00 1970 +0000
682 682 summary: 3
683 683
684 684 changeset: 13:7a4785234d87
685 685 user: foo
686 686 date: Thu Jan 01 00:00:00 1970 +0000
687 687 summary: 2
688 688
689 689 changeset: 14:0c921c65ef1e
690 690 parent: 1:5d205f8b35b6
691 691 user: foo
692 692 date: Thu Jan 01 00:00:00 1970 +0000
693 693 summary: 3
694 694
695 695 changeset: 17:f67661df0c48
696 696 user: bar
697 697 date: Thu Jan 01 00:00:00 1970 +0000
698 698 summary: 1
699 699
700 700 changeset: 19:9627f653b421
701 701 user: test
702 702 date: Thu Jan 01 00:00:00 1970 +0000
703 703 summary: 2
704 704
705 705 changeset: 21:7e61b508e709
706 706 branch: dev
707 707 tag: tip
708 708 user: foo
709 709 date: Thu Jan 01 00:00:00 1970 +0000
710 710 summary: 2
711 711
712 712 $ hg log -r 'destination(2)'
713 713 changeset: 7:ef0ef43d49e7
714 714 parent: 0:68795b066622
715 715 user: foo
716 716 date: Thu Jan 01 00:00:00 1970 +0000
717 717 summary: 2
718 718
719 719 changeset: 13:7a4785234d87
720 720 user: foo
721 721 date: Thu Jan 01 00:00:00 1970 +0000
722 722 summary: 2
723 723
724 724 changeset: 19:9627f653b421
725 725 user: test
726 726 date: Thu Jan 01 00:00:00 1970 +0000
727 727 summary: 2
728 728
729 729 changeset: 21:7e61b508e709
730 730 branch: dev
731 731 tag: tip
732 732 user: foo
733 733 date: Thu Jan 01 00:00:00 1970 +0000
734 734 summary: 2
735 735
736 736 Transplants of grafts can find a destination...
737 737 $ hg log -r 'destination(7)'
738 738 changeset: 21:7e61b508e709
739 739 branch: dev
740 740 tag: tip
741 741 user: foo
742 742 date: Thu Jan 01 00:00:00 1970 +0000
743 743 summary: 2
744 744
745 745 ... grafts of grafts unfortunately can't
746 746 $ hg graft -q 13 --debug
747 747 scanning for duplicate grafts
748 748 grafting 13:7a4785234d87 "2"
749 749 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
750 750 src: 'a' -> dst: 'b' *
751 751 checking for directory renames
752 752 resolving manifests
753 753 branchmerge: True, force: True, partial: False
754 754 ancestor: b592ea63bb0c, local: 7e61b508e709+, remote: 7a4785234d87
755 755 starting 4 threads for background file closing (?)
756 756 committing files:
757 757 b
758 758 warning: can't find ancestor for 'b' copied from 'a'!
759 759 reusing manifest from p1 (listed files actually unchanged)
760 760 committing changelog
761 761 updating the branch cache
762 762 $ hg log -r 'destination(13)'
763 763 All copies of a cset
764 764 $ hg log -r 'origin(13) or destination(origin(13))'
765 765 changeset: 2:5c095ad7e90f
766 766 user: test
767 767 date: Thu Jan 01 00:00:00 1970 +0000
768 768 summary: 2
769 769
770 770 changeset: 7:ef0ef43d49e7
771 771 parent: 0:68795b066622
772 772 user: foo
773 773 date: Thu Jan 01 00:00:00 1970 +0000
774 774 summary: 2
775 775
776 776 changeset: 13:7a4785234d87
777 777 user: foo
778 778 date: Thu Jan 01 00:00:00 1970 +0000
779 779 summary: 2
780 780
781 781 changeset: 19:9627f653b421
782 782 user: test
783 783 date: Thu Jan 01 00:00:00 1970 +0000
784 784 summary: 2
785 785
786 786 changeset: 21:7e61b508e709
787 787 branch: dev
788 788 user: foo
789 789 date: Thu Jan 01 00:00:00 1970 +0000
790 790 summary: 2
791 791
792 792 changeset: 22:3a4e92d81b97
793 793 branch: dev
794 794 tag: tip
795 795 user: foo
796 796 date: Thu Jan 01 00:00:00 1970 +0000
797 797 summary: 2
798 798
799 799
800 graft works on complex revset
800 graft skips ancestors
801 801
802 $ hg graft 'origin(13) or destination(origin(13))'
802 $ hg graft 21 3
803 803 skipping ancestor revision 21:7e61b508e709
804 skipping ancestor revision 22:3a4e92d81b97
805 skipping revision 2:5c095ad7e90f (already grafted to 22:3a4e92d81b97)
806 grafting 7:ef0ef43d49e7 "2"
807 warning: can't find ancestor for 'b' copied from 'a'!
808 grafting 13:7a4785234d87 "2"
809 warning: can't find ancestor for 'b' copied from 'a'!
810 grafting 19:9627f653b421 "2"
811 merging b
812 warning: can't find ancestor for 'b' copied from 'a'!
804 grafting 3:4c60f11aa304 "3"
805 merging b and c to c
813 806
814 807 graft with --force (still doesn't graft merges)
815 808
816 809 $ hg graft 19 0 6
817 810 skipping ungraftable merge revision 6
818 811 skipping ancestor revision 0:68795b066622
819 812 skipping already grafted revision 19:9627f653b421 (22:3a4e92d81b97 also has origin 2:5c095ad7e90f)
820 813 [255]
821 814 $ hg graft 19 0 6 --force
822 815 skipping ungraftable merge revision 6
823 816 grafting 19:9627f653b421 "2"
824 817 merging b
825 818 warning: can't find ancestor for 'b' copied from 'a'!
826 819 grafting 0:68795b066622 "0"
827 820
828 821 graft --force after backout
829 822
830 823 $ echo abc > a
831 $ hg ci -m 28
832 $ hg backout 28
824 $ hg ci -m 26
825 $ hg backout 26
833 826 reverting a
834 changeset 29:9d95e865b00c backs out changeset 28:cc20d29aec8d
835 $ hg graft 28
836 skipping ancestor revision 28:cc20d29aec8d
827 changeset 27:e25e17192dc4 backs out changeset 26:44f862488a35
828 $ hg graft 26
829 skipping ancestor revision 26:44f862488a35
837 830 [255]
838 $ hg graft 28 --force
839 grafting 28:cc20d29aec8d "28"
831 $ hg graft 26 --force
832 grafting 26:44f862488a35 "26"
840 833 merging a
841 834 $ cat a
842 835 abc
843 836
844 837 graft --continue after --force
845 838
846 839 $ echo def > a
847 $ hg ci -m 31
848 $ hg graft 28 --force --tool internal:fail
849 grafting 28:cc20d29aec8d "28"
840 $ hg ci -m 29
841 $ hg graft 26 --force --tool internal:fail
842 grafting 26:44f862488a35 "26"
850 843 abort: unresolved conflicts, can't continue
851 844 (use 'hg resolve' and 'hg graft --continue')
852 845 [255]
853 846 $ hg resolve --all
854 847 merging a
855 848 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
856 849 [1]
857 850 $ echo abc > a
858 851 $ hg resolve -m a
859 852 (no more unresolved files)
860 853 continue: hg graft --continue
861 854 $ hg graft -c
862 grafting 28:cc20d29aec8d "28"
855 grafting 26:44f862488a35 "26"
863 856 $ cat a
864 857 abc
865 858
866 859 Continue testing same origin policy, using revision numbers from test above
867 860 but do some destructive editing of the repo:
868 861
869 862 $ hg up -qC 7
870 863 $ hg tag -l -r 13 tmp
871 864 $ hg --config extensions.strip= strip 2
872 865 saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg
873 866 $ hg graft tmp
874 867 skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
875 868 [255]
876 869
877 870 Empty graft
878 871
879 $ hg up -qr 26
872 $ hg up -qr 24
880 873 $ hg tag -f something
881 $ hg graft -qr 27
882 $ hg graft -f 27
883 grafting 27:17d42b8f5d50 "28"
884 note: graft of 27:17d42b8f5d50 created no changes to commit
874 $ hg graft -qr 25
875 $ hg graft -f 25
876 grafting 25:bd0c98709948 "26"
877 note: graft of 25:bd0c98709948 created no changes to commit
885 878
886 879 $ cd ..
887 880
888 881 Graft to duplicate a commit
889 882
890 883 $ hg init graftsibling
891 884 $ cd graftsibling
892 885 $ touch a
893 886 $ hg commit -qAm a
894 887 $ touch b
895 888 $ hg commit -qAm b
896 889 $ hg log -G -T '{rev}\n'
897 890 @ 1
898 891 |
899 892 o 0
900 893
901 894 $ hg up -q 0
902 895 $ hg graft -r 1
903 896 grafting 1:0e067c57feba "b" (tip)
904 897 $ hg log -G -T '{rev}\n'
905 898 @ 2
906 899 |
907 900 | o 1
908 901 |/
909 902 o 0
910 903
911 904 Graft to duplicate a commit twice
912 905
913 906 $ hg up -q 0
914 907 $ hg graft -r 2
915 908 grafting 2:044ec77f6389 "b" (tip)
916 909 $ hg log -G -T '{rev}\n'
917 910 @ 3
918 911 |
919 912 | o 2
920 913 |/
921 914 | o 1
922 915 |/
923 916 o 0
924 917
General Comments 0
You need to be logged in to leave comments. Login now