##// END OF EJS Templates
graft: allow creating sibling grafts...
Durham Goode -
r24643:a8e6897d default
parent child Browse files
Show More
@@ -1184,9 +1184,17 def graft(repo, ctx, pctx, labels):
1184 1184 labels - merge labels eg ['local', 'graft']
1185 1185
1186 1186 """
1187 # If we're grafting a descendant onto an ancestor, be sure to pass
1188 # mergeancestor=True to update. This does two things: 1) allows the merge if
1189 # the destination is the same as the parent of the ctx (so we can use graft
1190 # to copy commits), and 2) informs update that the incoming changes are
1191 # newer than the destination so it doesn't prompt about "remote changed foo
1192 # which local deleted".
1193 mergeancestor = repo.changelog.isancestor(repo['.'].node(), ctx.node())
1187 1194
1188 1195 stats = update(repo, ctx.node(), True, True, False, pctx.node(),
1189 labels=labels)
1196 mergeancestor=mergeancestor, labels=labels)
1197
1190 1198 # drop the second merge parent
1191 1199 repo.dirstate.beginparentchange()
1192 1200 repo.setparents(repo['.'].node(), nullid)
@@ -730,3 +730,29 Empty graft
730 730 $ hg graft -f 27
731 731 grafting 27:3d35c4c79e5a "28"
732 732 note: graft of 27:3d35c4c79e5a created no changes to commit
733
734 $ cd ..
735
736 Graft to duplicate a commit
737
738 $ hg init graftsibling
739 $ cd graftsibling
740 $ touch a
741 $ hg commit -qAm a
742 $ touch b
743 $ hg commit -qAm b
744 $ hg log -G -T '{rev}\n'
745 @ 1
746 |
747 o 0
748
749 $ hg up -q 0
750 $ hg graft -r 1
751 grafting 1:0e067c57feba "b" (tip)
752 $ hg log -G -T '{rev}\n'
753 @ 2
754 |
755 | o 1
756 |/
757 o 0
758
@@ -70,8 +70,6 edit the history
70 70 > pick 652413bf663e f
71 71 > EOF
72 72 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
73 remote changed e which local deleted
74 use (c)hanged version or leave (d)eleted? c
75 73 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
76 74 merging e
77 75 warning: conflicts during merge.
General Comments 0
You need to be logged in to leave comments. Login now