comparison hgext3rd/pullbundle.py @ 4929:bb2b4f6c99dc

compat: compatibility for cl.nodemap.get vs cl.index.get_rev
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 13 Nov 2019 13:47:55 +0700
parents 48b30ff742cb
children 1015a1dbaf7c
comparison
equal deleted inserted replaced
4928:379ce8ba150d 4929:bb2b4f6c99dc
178 178
179 DEBUG = False 179 DEBUG = False
180 180
181 def sliceoutgoing(repo, outgoing): 181 def sliceoutgoing(repo, outgoing):
182 cl = repo.changelog 182 cl = repo.changelog
183 rev = cl.nodemap.get 183 rev = getgetrev(cl)
184 node = cl.node 184 node = cl.node
185 revsort = repo.stablesort 185 revsort = repo.stablesort
186 186
187 missingrevs = set(rev(n) for n in outgoing.missing) 187 missingrevs = set(rev(n) for n in outgoing.missing)
188 if DEBUG: 188 if DEBUG:
621 max: {max} 621 max: {max}
622 """ 622 """
623 623
624 def fmtdist(name, data): 624 def fmtdist(name, data):
625 return STATSFORMAT.format(name=name, **data) 625 return STATSFORMAT.format(name=name, **data)
626
627 # nodemap.get and index.[has_node|rev|get_rev]
628 # hg <= 5.3 (02802fa87b74)
629 def getgetrev(cl):
630 """Returns index.get_rev or nodemap.get (for pre-5.3 Mercurial)."""
631 if util.safehasattr(cl.index, 'get_rev'):
632 return cl.index.get_rev
633 return cl.nodemap.get