hgext3rd/pullbundle.py
changeset 4929 bb2b4f6c99dc
parent 4814 48b30ff742cb
child 5034 1015a1dbaf7c
--- a/hgext3rd/pullbundle.py	Wed Nov 13 13:43:46 2019 +0700
+++ b/hgext3rd/pullbundle.py	Wed Nov 13 13:47:55 2019 +0700
@@ -180,7 +180,7 @@
 
 def sliceoutgoing(repo, outgoing):
     cl = repo.changelog
-    rev = cl.nodemap.get
+    rev = getgetrev(cl)
     node = cl.node
     revsort = repo.stablesort
 
@@ -623,3 +623,11 @@
 
 def fmtdist(name, data):
     return STATSFORMAT.format(name=name, **data)
+
+# nodemap.get and index.[has_node|rev|get_rev]
+# hg <= 5.3 (02802fa87b74)
+def getgetrev(cl):
+    """Returns index.get_rev or nodemap.get (for pre-5.3 Mercurial)."""
+    if util.safehasattr(cl.index, 'get_rev'):
+        return cl.index.get_rev
+    return cl.nodemap.get