# HG changeset patch # User Martin von Zweigbergk # Date 1601050437 25200 # Node ID 3b7df91c2ba7bb7f2296ca66403ef80d3bf2c76e # Parent 0e23393dda9c55ab5b3be3e03c12d5609860a695 compat: add support for upstream rename of merge.update() to _update() The function was renamed in Mercurial commit 2c86b9587740. diff -r 0e23393dda9c -r 3b7df91c2ba7 hgext3rd/evolve/compat.py --- a/hgext3rd/evolve/compat.py Sat Sep 19 17:56:01 2020 +0200 +++ b/hgext3rd/evolve/compat.py Fri Sep 25 09:13:57 2020 -0700 @@ -386,3 +386,11 @@ # hg <= 5.2 (85c4cd73996b) if util.safehasattr(repo, '_quick_access_changeid_invalidate'): repo._quick_access_changeid_invalidate() + +if util.safehasattr(mergemod, '_update'): + def update(*args, **kwargs): + return mergemod._update(*args, **kwargs) +else: + # hg <= 5.5 (2c86b9587740) + def update(*args, **kwargs): + return mergemod.update(*args, **kwargs) diff -r 0e23393dda9c -r 3b7df91c2ba7 hgext3rd/evolve/evolvecmd.py --- a/hgext3rd/evolve/evolvecmd.py Sat Sep 19 17:56:01 2020 +0200 +++ b/hgext3rd/evolve/evolvecmd.py Fri Sep 25 09:13:57 2020 -0700 @@ -258,8 +258,8 @@ # like reverting to the bumped node. wctx = context.overlayworkingctx(repo) wctx.setbase(prec) - merge.update(repo, bumped.node(), ancestor=prec, mergeancestor=True, - branchmerge=False, force=False, wc=wctx) + compat.update(repo, bumped.node(), ancestor=prec, mergeancestor=True, + branchmerge=False, force=False, wc=wctx) if not wctx.isempty(): text = b'%s update to %s:\n\n' % (TROUBLES['PHASEDIVERGENT'], prec) text += bumped.description() @@ -602,12 +602,12 @@ progresscb() with state.saver(evolvestate): mergeancestor = repo.changelog.isancestor(local.node(), other.node()) - stats = merge.update(repo, - other.node(), - branchmerge=True, - force=False, - ancestor=base.node(), - mergeancestor=mergeancestor) + stats = compat.update(repo, + other.node(), + branchmerge=True, + force=False, + ancestor=base.node(), + mergeancestor=mergeancestor) hg._showstats(repo, stats) # conflicts while merging content-divergent changesets @@ -1006,10 +1006,7 @@ """Used by the evolve function to merge dest on top of pctx. return the same tuple as merge.graft""" if repo[b'.'].rev() != dest.rev(): - merge.update(repo, - dest, - branchmerge=False, - force=True) + compat.update(repo, dest, branchmerge=False, force=True) if repo._activebookmark: repo.ui.status(_(b"(leaving bookmark %s)\n") % repo._activebookmark) bookmarksmod.deactivate(repo) diff -r 0e23393dda9c -r 3b7df91c2ba7 hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Sat Sep 19 17:56:01 2020 +0200 +++ b/hgext3rd/topic/__init__.py Fri Sep 25 09:13:57 2020 -0700 @@ -353,7 +353,11 @@ _(b"topic to push"), _(b'TOPIC'))) extensions.wrapfunction(cmdutil, 'buildcommittext', committextwrap) - extensions.wrapfunction(merge, 'update', mergeupdatewrap) + if util.safehasattr(merge, '_update'): + extensions.wrapfunction(merge, '_update', mergeupdatewrap) + else: + # hg <= 5.5 (2c86b9587740) + extensions.wrapfunction(merge, 'update', mergeupdatewrap) # We need to check whether t0 or b0 or s0 is passed to override the default update # behaviour of changing topic and I can't find a better way # to do that as scmutil.revsingle returns the rev number and hence we can't diff -r 0e23393dda9c -r 3b7df91c2ba7 tests/test-evolve-content-divergent-corner-cases.t --- a/tests/test-evolve-content-divergent-corner-cases.t Sat Sep 19 17:56:01 2020 +0200 +++ b/tests/test-evolve-content-divergent-corner-cases.t Fri Sep 25 09:13:57 2020 -0700 @@ -236,10 +236,10 @@ $ cat >$TESTTMP/test_extension.py << EOF > from mercurial import merge - > origupdate = merge.update + > origupdate = merge._update > def newupdate(*args, **kwargs): > return origupdate(*args, **kwargs) - > merge.update = newupdate + > merge._update = newupdate > EOF $ cat >> $HGRCPATH << EOF > [extensions]