compat: fallback to compatible partial lookup prior to 4.6
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 17 Apr 2018 19:42:26 +0200
changeset 3674 51adc7e6a617
parent 3673 9c12b6520a20
child 3675 1dccccde82bb
compat: fallback to compatible partial lookup prior to 4.6
hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Tue Apr 17 18:30:56 2018 +0200
+++ b/hgext3rd/evolve/evolvecmd.py	Tue Apr 17 19:42:26 2018 +0200
@@ -508,7 +508,10 @@
     sha1s = re.findall(sha1re, commitmsg)
     unfi = repo.unfiltered()
     for sha1 in sha1s:
-        fullnode = scmutil.resolvepartialhexnodeid(unfi, sha1)
+        if util.safehasattr(scmutil, 'resolvepartialhexnodeid'): # > hg-4.6
+            fullnode = scmutil.resolvepartialhexnodeid(unfi, sha1)
+        else:
+            fullnode = unfi.changelog.index.partialmatch(sha1)
         if fullnode is None:
             continue
         ctx = unfi[fullnode]