# HG changeset patch # User Martin von Zweigbergk # Date 2020-09-21 18:53:44 # Node ID 5c8230ca37f2f71faaee9c9e632320b02bbab6c4 # Parent c1b603cdc95a57106d8792dbd9be059a4a536922 merge: replace calls to hg.updaterepo() by merge.update() The former no longer buys us anything. Differential Revision: https://phab.mercurial-scm.org/D9067 diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -881,8 +881,7 @@ class fold(histeditaction): return False def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges): - parent = ctx.p1().node() - hg.updaterepo(repo, parent, overwrite=False) + mergemod.update(ctx.p1()) ### prepare new commit data commitopts = {} commitopts[b'user'] = ctx.user() @@ -926,7 +925,7 @@ class fold(histeditaction): ) if n is None: return ctx, [] - hg.updaterepo(repo, n, overwrite=False) + mergemod.update(repo[n]) replacements = [ (oldctx.node(), (newnode,)), (ctx.node(), (n,)), @@ -2050,7 +2049,7 @@ def _continuehistedit(ui, repo, state): def _finishhistedit(ui, repo, state, fm): """This action runs when histedit is finishing its session""" - hg.updaterepo(repo, state.parentctxnode, overwrite=False) + mergemod.update(repo[state.parentctxnode]) mapping, tmpnodes, created, ntm = processreplacement(state) if mapping: diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -34,7 +34,6 @@ from mercurial import ( dirstateguard, error, extensions, - hg, merge as mergemod, mergestate as mergestatemod, mergeutil, @@ -750,7 +749,7 @@ class rebaseruntime(object): newwd = self.originalwd if newwd not in [c.rev() for c in repo[None].parents()]: ui.note(_(b"update back to initial working directory parent\n")) - hg.updaterepo(repo, newwd, overwrite=False) + mergemod.update(repo[newwd]) collapsedas = None if self.collapsef and not self.keepf: diff --git a/hgext/sparse.py b/hgext/sparse.py --- a/hgext/sparse.py +++ b/hgext/sparse.py @@ -80,9 +80,9 @@ from mercurial import ( dirstate, error, extensions, - hg, logcmdutil, match as matchmod, + merge as mergemod, pycompat, registrar, sparse, @@ -173,9 +173,9 @@ def _clonesparsecmd(orig, ui, repo, *arg # clone if not narrow_pat and (include or exclude or enableprofile): - def clonesparse(orig, self, node, overwrite, *args, **kwargs): + def clonesparse(orig, ctx, *args, **kwargs): sparse.updateconfig( - self.unfiltered(), + ctx.repo().unfiltered(), pat, {}, include=include, @@ -183,9 +183,9 @@ def _clonesparsecmd(orig, ui, repo, *arg enableprofile=enableprofile, usereporootpaths=True, ) - return orig(self, node, overwrite, *args, **kwargs) + return orig(ctx, *args, **kwargs) - extensions.wrapfunction(hg, b'updaterepo', clonesparse) + extensions.wrapfunction(mergemod, b'update', clonesparse) return orig(ui, repo, *args, **opts) diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -1061,7 +1061,7 @@ def updaterepo(repo, node, overwrite, up def update(repo, node, quietempty=False, updatecheck=None): """update the working directory to node""" - stats = updaterepo(repo, node, False, updatecheck=updatecheck) + stats = mergemod.update(repo[node], updatecheck=updatecheck) _showstats(repo, stats, quietempty) if stats.unresolvedcount: repo.ui.status(_(b"use 'hg resolve' to retry unresolved file merges\n")) diff --git a/mercurial/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -839,7 +839,7 @@ def unshelvecontinue(ui, repo, state, op state.nodestoremove.append(newnode) shelvectx = repo[newnode] - hg.updaterepo(repo, pendingctx.node(), overwrite=False) + merge.update(pendingctx) mergefiles(ui, repo, state.wctx, shelvectx) restorebranch(ui, repo, state.branchtorestore) @@ -1031,7 +1031,7 @@ def _rebaserestoredcommit( ui.status(msg) else: shelvectx = repo[newnode] - hg.updaterepo(repo, tmpwctx.node(), False) + merge.update(tmpwctx) return shelvectx, ispartialunshelve diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -787,7 +787,7 @@ class hgsubrepo(abstractsubrepo): if overwrite: merge.clean_update(repo[revision]) else: - hg.updaterepo(repo, revision, False) + merge.update(repo[revision]) @annotatesubrepoerror def merge(self, state):