Mercurial > evolve
changeset 3074:8d57acde165d
compat: fix compatibility with new duplicatecopies
Changeset 754b5117622f updated the signature of 'copies.duplicatecopies'.
We can now handle the multiple version of that code for compatiblity.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 17 Oct 2017 17:35:05 +0200 |
parents | 83627d3a7311 |
children | 8feb2cae7eae |
files | hgext3rd/evolve/__init__.py hgext3rd/evolve/compat.py |
diffstat | 2 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py Sat Oct 14 19:14:27 2017 +0200 +++ b/hgext3rd/evolve/__init__.py Tue Oct 17 17:35:05 2017 +0200 @@ -924,7 +924,7 @@ repo.setparents(repo['.'].node(), nullid) repo.dirstate.write(tr) # fix up dirstate for copies and renames - copies.duplicatecopies(repo, dest.rev(), orig.p1().rev()) + compat.duplicatecopies(repo, repo[None], dest.rev(), orig.p1().rev()) class LocalMergeFailure(MergeFailure, exc.__class__): pass
--- a/hgext3rd/evolve/compat.py Sat Oct 14 19:14:27 2017 +0200 +++ b/hgext3rd/evolve/compat.py Tue Oct 17 17:35:05 2017 +0200 @@ -7,6 +7,7 @@ """ from mercurial import ( + copies, context, hg, obsolete, @@ -177,3 +178,12 @@ """function to start a pager in case ui.pager() exists""" if util.safehasattr(ui, 'pager'): ui.pager(cmd) + +def duplicatecopies(repo, wctx, rev, fromrev, skiprev=None): + # cannot use anything else until 4.3 support is dropped. + assert wctx.rev() is None + if copies.duplicatecopies.__code__.co_argcount < 5: + # pre 4.4 duplicatecopies compat + copies.duplicatecopies(repo, rev, fromrev, skiprev=skiprev) + else: + copies.duplicatecopies(repo, wctx, rev, fromrev, skiprev=skiprev)