##// END OF EJS Templates
merge: introduce a clean_update() for that use-case...
Martin von Zweigbergk -
r44743:f546d217 default
parent child Browse files
Show More
@@ -945,7 +945,7 b' class fold(histeditaction):'
945 class base(histeditaction):
945 class base(histeditaction):
946 def run(self):
946 def run(self):
947 if self.repo[b'.'].node() != self.node:
947 if self.repo[b'.'].node() != self.node:
948 mergemod.update(self.repo, self.node, branchmerge=False, force=True)
948 mergemod.clean_update(self.repo[self.node])
949 return self.continueclean()
949 return self.continueclean()
950
950
951 def continuedirty(self):
951 def continuedirty(self):
@@ -800,9 +800,7 b' class rebaseruntime(object):'
800
800
801 # Update away from the rebase if necessary
801 # Update away from the rebase if necessary
802 if shouldupdate:
802 if shouldupdate:
803 mergemod.update(
803 mergemod.clean_update(repo[self.originalwd])
804 repo, self.originalwd, branchmerge=False, force=True
805 )
806
804
807 # Strip from the first rebased revision
805 # Strip from the first rebased revision
808 if rebased:
806 if rebased:
@@ -1477,7 +1475,7 b' def rebasenode(repo, rev, p1, base, coll'
1477 else:
1475 else:
1478 if repo[b'.'].rev() != p1:
1476 if repo[b'.'].rev() != p1:
1479 repo.ui.debug(b" update to %d:%s\n" % (p1, p1ctx))
1477 repo.ui.debug(b" update to %d:%s\n" % (p1, p1ctx))
1480 mergemod.update(repo, p1, branchmerge=False, force=True)
1478 mergemod.clean_update(p1ctx)
1481 else:
1479 else:
1482 repo.ui.debug(b" already in destination\n")
1480 repo.ui.debug(b" already in destination\n")
1483 # This is, alas, necessary to invalidate workingctx's manifest cache,
1481 # This is, alas, necessary to invalidate workingctx's manifest cache,
@@ -1173,7 +1173,7 b' def abortmerge(ui, repo):'
1173 node = repo[b'.'].hex()
1173 node = repo[b'.'].hex()
1174
1174
1175 repo.ui.status(_(b"aborting the merge, updating back to %s\n") % node[:12])
1175 repo.ui.status(_(b"aborting the merge, updating back to %s\n") % node[:12])
1176 stats = mergemod.update(repo, node, branchmerge=False, force=True)
1176 stats = mergemod.clean_update(repo[node])
1177 assert stats.unresolvedcount == 0
1177 assert stats.unresolvedcount == 0
1178 _showstats(repo, stats)
1178 _showstats(repo, stats)
1179
1179
@@ -2597,6 +2597,15 b' def update('
2597 return stats
2597 return stats
2598
2598
2599
2599
2600 def clean_update(ctx, wc=None):
2601 """Do a clean update to the given commit.
2602
2603 This involves updating to the commit and discarding any changes in the
2604 working copy.
2605 """
2606 return update(ctx.repo(), ctx.rev(), branchmerge=False, force=True, wc=wc)
2607
2608
2600 def graft(
2609 def graft(
2601 repo,
2610 repo,
2602 ctx,
2611 ctx,
@@ -745,7 +745,7 b' def unshelveabort(ui, repo, state):'
745 try:
745 try:
746 checkparents(repo, state)
746 checkparents(repo, state)
747
747
748 merge.update(repo, state.pendingctx, branchmerge=False, force=True)
748 merge.clean_update(state.pendingctx)
749 if state.activebookmark and state.activebookmark in repo._bookmarks:
749 if state.activebookmark and state.activebookmark in repo._bookmarks:
750 bookmarks.activate(repo, state.activebookmark)
750 bookmarks.activate(repo, state.activebookmark)
751 mergefiles(ui, repo, state.wctx, state.pendingctx)
751 mergefiles(ui, repo, state.wctx, state.pendingctx)
General Comments 0
You need to be logged in to leave comments. Login now