# HG changeset patch # User Martin von Zweigbergk # Date 1601050437 25200 # Node ID d9ee2706487fbbb52c4d93d17e60f13bf2fb356c # Parent 5e71952c8b4acd8d692b4d01720f6082f8ce408e compat: add support for upstream rename of merge.update() to _update() The function was renamed in Mercurial commit 2c86b9587740. diff -r 5e71952c8b4a -r d9ee2706487f hgext3rd/evolve/compat.py --- a/hgext3rd/evolve/compat.py Mon Oct 12 12:33:18 2020 +0200 +++ b/hgext3rd/evolve/compat.py Fri Sep 25 09:13:57 2020 -0700 @@ -401,3 +401,11 @@ scmutil.cleanupnodes(repo, replacements=fixedreplacements, operation=operation, moves=moves, metadata=metadata) + +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 5e71952c8b4a -r d9ee2706487f hgext3rd/evolve/evolvecmd.py --- a/hgext3rd/evolve/evolvecmd.py Mon Oct 12 12:33:18 2020 +0200 +++ b/hgext3rd/evolve/evolvecmd.py Fri Sep 25 09:13:57 2020 -0700 @@ -257,8 +257,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() @@ -605,12 +605,12 @@ with state.saver(evolvestate): mergeancestor = repo.changelog.isancestor(divergent.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 @@ -1007,10 +1007,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 5e71952c8b4a -r d9ee2706487f hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Mon Oct 12 12:33:18 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 5e71952c8b4a -r d9ee2706487f tests/test-evolve-content-divergent-corner-cases.t --- a/tests/test-evolve-content-divergent-corner-cases.t Mon Oct 12 12:33:18 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]