# HG changeset patch # User Pierre-Yves David # Date 1508254505 -7200 # Node ID 8d57acde165db5eb396094104aaa4625861384d2 # Parent 83627d3a7311516ddf5ec15925bf48a442892430 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. diff -r 83627d3a7311 -r 8d57acde165d hgext3rd/evolve/__init__.py --- 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 diff -r 83627d3a7311 -r 8d57acde165d hgext3rd/evolve/compat.py --- 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)