This instance will be upgraded to Heptapod 0.26.0rc1 on 2021-10-25 at 14:00 UTC+2 (a few minutes of down time)

Commit 18907425 authored by Martin von Zweigbergk's avatar Martin von Zweigbergk
Browse files

merge: use merge.clean_update() when applicable

We have had this higher-level function (higher than `merge.update()`,
that is) for a while. Let's simply some callers by using it. I don't
know why I didn't do this when I introduced the function.

After this patch, there are no remaining callers that call
`hg.updaterepo()` with `overwrite=True`. We'll clean that up soon.

Differential Revision: https://phab.mercurial-scm.org/D9063
parent feffeb18d412
......@@ -1099,7 +1099,7 @@ def rebase(ui, repo, **opts):
)
# update to the current working revision
# to clear interrupted merge
hg.updaterepo(repo, rbsrt.originalwd, overwrite=True)
mergemod.clean_update(repo[rbsrt.originalwd])
rbsrt._finishrebase()
return 0
elif inmemory:
......
......@@ -476,7 +476,7 @@ class transplanter(object):
"""logic to stop an interrupted transplant"""
if self.canresume():
startctx = repo[b'.']
hg.updaterepo(repo, startctx.node(), overwrite=True)
merge.clean_update(startctx)
ui.status(_(b"stopped the interrupted transplant\n"))
ui.status(
_(b"working directory is now at %s\n") % startctx.hex()[:12]
......
......@@ -4154,7 +4154,6 @@ def abortgraft(ui, repo, graftstate):
startctx = repo[b'.']
# whether to strip or not
cleanup = False
from . import hg
if newnodes:
newnodes = [repo[r].rev() for r in newnodes]
......@@ -4182,7 +4181,7 @@ def abortgraft(ui, repo, graftstate):
if cleanup:
with repo.wlock(), repo.lock():
hg.updaterepo(repo, startctx.node(), overwrite=True)
mergemod.clean_update(startctx)
# stripping the new nodes created
strippoints = [
c.node() for c in repo.set(b"roots(%ld)", newnodes)
......@@ -4192,7 +4191,7 @@ def abortgraft(ui, repo, graftstate):
if not cleanup:
# we don't update to the startnode if we can't strip
startctx = repo[b'.']
hg.updaterepo(repo, startctx.node(), overwrite=True)
mergemod.clean_update(startctx)
ui.status(_(b"graft aborted\n"))
ui.status(_(b"working directory is now at %s\n") % startctx.hex()[:12])
......
......@@ -3247,7 +3247,7 @@ def _stopgraft(ui, repo, graftstate):
if not graftstate.exists():
raise error.Abort(_(b"no interrupted graft found"))
pctx = repo[b'.']
hg.updaterepo(repo, pctx.node(), overwrite=True)
mergemod.clean_update(pctx)
graftstate.delete()
ui.status(_(b"stopped the interrupted graft\n"))
ui.status(_(b"working directory is now at %s\n") % pctx.hex()[:12])
......
......@@ -1074,7 +1074,7 @@ _update = update
def clean(repo, node, show_stats=True, quietempty=False):
"""forcibly switch the working directory to node, clobbering changes"""
stats = updaterepo(repo, node, True)
stats = mergemod.clean_update(repo[node])
assert stats.unresolvedcount == 0
if show_stats:
_showstats(repo, stats, quietempty)
......
......@@ -25,6 +25,7 @@ from . import (
exchange,
logcmdutil,
match as matchmod,
merge as merge,
node,
pathutil,
phases,
......@@ -783,7 +784,10 @@ class hgsubrepo(abstractsubrepo):
% (revision[0:12], self._path)
)
repo = urepo
hg.updaterepo(repo, revision, overwrite)
if overwrite:
merge.clean_update(repo[revision])
else:
hg.updaterepo(repo, revision, False)
@annotatesubrepoerror
def merge(self, state):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment