##// END OF EJS Templates
core: don't hard-code hex node lengths...
Joerg Sonnenberger -
r47815:a407fe56 default
parent child Browse files
Show More
@@ -1861,7 +1861,7 b' class localrepository(object):'
1861 changeid = hex(changeid) # for the error message
1861 changeid = hex(changeid) # for the error message
1862 raise
1862 raise
1863
1863
1864 elif len(changeid) == 40:
1864 elif len(changeid) == 2 * self.nodeconstants.nodelen:
1865 node = bin(changeid)
1865 node = bin(changeid)
1866 rev = self.changelog.rev(node)
1866 rev = self.changelog.rev(node)
1867 else:
1867 else:
@@ -1320,7 +1320,7 b' class revlog(object):'
1320 return self.node(rev)
1320 return self.node(rev)
1321 except (ValueError, OverflowError):
1321 except (ValueError, OverflowError):
1322 pass
1322 pass
1323 if len(id) == 40:
1323 if len(id) == 2 * self.nodeconstants.nodelen:
1324 try:
1324 try:
1325 # a full hex nodeid?
1325 # a full hex nodeid?
1326 node = bin(id)
1326 node = bin(id)
@@ -1724,7 +1724,7 b' def named(repo, subset, x):'
1724 def _node(repo, n):
1724 def _node(repo, n):
1725 """process a node input"""
1725 """process a node input"""
1726 rn = None
1726 rn = None
1727 if len(n) == 40:
1727 if len(n) == 2 * repo.nodeconstants.nodelen:
1728 try:
1728 try:
1729 rn = repo.changelog.rev(bin(n))
1729 rn = repo.changelog.rev(bin(n))
1730 except error.WdirUnsupported:
1730 except error.WdirUnsupported:
@@ -643,7 +643,7 b' def revsymbol(repo, symbol):'
643 except (ValueError, OverflowError, IndexError):
643 except (ValueError, OverflowError, IndexError):
644 pass
644 pass
645
645
646 if len(symbol) == 40:
646 if len(symbol) == 2 * repo.nodeconstants.nodelen:
647 try:
647 try:
648 node = bin(symbol)
648 node = bin(symbol)
649 rev = repo.changelog.rev(node)
649 rev = repo.changelog.rev(node)
@@ -764,9 +764,10 b' def shortest(context, mapping, args):'
764 )
764 )
765
765
766 repo = context.resource(mapping, b'repo')
766 repo = context.resource(mapping, b'repo')
767 if len(hexnode) > 40:
767 hexnodelen = 2 * repo.nodeconstants.nodelen
768 if len(hexnode) > hexnodelen:
768 return hexnode
769 return hexnode
769 elif len(hexnode) == 40:
770 elif len(hexnode) == hexnodelen:
770 try:
771 try:
771 node = bin(hexnode)
772 node = bin(hexnode)
772 except TypeError:
773 except TypeError:
General Comments 0
You need to be logged in to leave comments. Login now