evolve: compatibility with copies.graftcopies() from hg 5.3 stable
authorAnton Shestakov <av6@dwimlabs.net>
Thu, 23 Jan 2020 19:33:40 +0700
branchstable
changeset 5094 a2391f919141
parent 5093 fd1d12497fdb
child 5095 2fcaee044a8c
evolve: compatibility with copies.graftcopies() from hg 5.3
hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Fri Nov 15 08:14:06 2019 -0800
+++ b/hgext3rd/evolve/evolvecmd.py	Thu Jan 23 19:33:40 2020 +0700
@@ -1009,8 +1009,12 @@
             repo.setparents(dest.node(), orig.node())
             repo.dirstate.write(tr)
             # fix up dirstate for copies and renames
-            copies.duplicatecopies(repo, repo[None], dest.rev(),
-                                   orig.p1().rev())
+            if util.safehasattr(copies, 'graftcopies'):
+                copies.graftcopies(repo[None], dest, orig.p1())
+            else:
+                # hg <= 5.2 (2f0a44c69e07)
+                copies.duplicatecopies(repo, repo[None], dest.rev(),
+                                       orig.p1().rev())
             dirstatedance(repo, dest, orig.node(), None)
         hint = _(b"see 'hg help evolve.interrupted'")
         raise error.InterventionRequired(_(b"unresolved merge conflicts"),