Mercurial > evolve
changeset 5608:d9ee2706487f stable
compat: add support for upstream rename of merge.update() to _update()
The function was renamed in Mercurial commit 2c86b9587740.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 25 Sep 2020 09:13:57 -0700 |
parents | 5e71952c8b4a |
children | 24a1ff0677a7 |
files | hgext3rd/evolve/compat.py hgext3rd/evolve/evolvecmd.py hgext3rd/topic/__init__.py tests/test-evolve-content-divergent-corner-cases.t |
diffstat | 4 files changed, 24 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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)
--- 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
--- 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]