Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 47042:c5e1cc0b4c77
core: don't hard-code node length
Differential Revision: https://phab.mercurial-scm.org/D10536
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Fri, 30 Apr 2021 03:19:45 +0200 |
parents | a407fe56d6e8 |
children | 4c041c71ec01 |
comparison
equal
deleted
inserted
replaced
47041:a407fe56d6e8 | 47042:c5e1cc0b4c77 |
---|---|
1297 | 1297 |
1298 def _match(self, id): | 1298 def _match(self, id): |
1299 if isinstance(id, int): | 1299 if isinstance(id, int): |
1300 # rev | 1300 # rev |
1301 return self.node(id) | 1301 return self.node(id) |
1302 if len(id) == 20: | 1302 if len(id) == self.nodeconstants.nodelen: |
1303 # possibly a binary node | 1303 # possibly a binary node |
1304 # odds of a binary node being all hex in ASCII are 1 in 10**25 | 1304 # odds of a binary node being all hex in ASCII are 1 in 10**25 |
1305 try: | 1305 try: |
1306 node = id | 1306 node = id |
1307 self.rev(node) # quick search the index | 1307 self.rev(node) # quick search the index |