Mercurial > evolve
comparison hgext3rd/topic/compat.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 | f9743b13de6d |
children | acc7e27fa5c6 |
comparison
equal
deleted
inserted
replaced
4928:379ce8ba150d | 4929:bb2b4f6c99dc |
---|---|
9 | 9 |
10 from mercurial import ( | 10 from mercurial import ( |
11 obsolete, | 11 obsolete, |
12 pycompat, | 12 pycompat, |
13 registrar, | 13 registrar, |
14 util, | |
14 ) | 15 ) |
15 | 16 |
16 getmarkers = None | 17 getmarkers = None |
17 successorssets = None | 18 successorssets = None |
18 try: | 19 try: |
42 """Backwards-compatible specification of the helpategory argument.""" | 43 """Backwards-compatible specification of the helpategory argument.""" |
43 category = getattr(registrar.command, categoryname, None) | 44 category = getattr(registrar.command, categoryname, None) |
44 if not category: | 45 if not category: |
45 return {} | 46 return {} |
46 return {'helpcategory': category} | 47 return {'helpcategory': category} |
48 | |
49 # nodemap.get and index.[has_node|rev|get_rev] | |
50 # hg <= 5.3 (02802fa87b74) | |
51 def getgetrev(cl): | |
52 """Returns index.get_rev or nodemap.get (for pre-5.3 Mercurial).""" | |
53 if util.safehasattr(cl.index, 'get_rev'): | |
54 return cl.index.get_rev | |
55 return cl.nodemap.get |