Mercurial > hg
comparison mercurial/revlog.py @ 49246:31602d471b60
revlog: make round-down pattern clearer
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Mon, 30 May 2022 00:39:53 +0200 |
parents | 2bcf5e14bb7e |
children | 3e5f1fb2aec7 |
comparison
equal
deleted
inserted
replaced
49244:cd51d4957b28 | 49246:31602d471b60 |
---|---|
1525 return self._pcache[id] | 1525 return self._pcache[id] |
1526 | 1526 |
1527 if len(id) <= 40: | 1527 if len(id) <= 40: |
1528 try: | 1528 try: |
1529 # hex(node)[:...] | 1529 # hex(node)[:...] |
1530 l = len(id) // 2 # grab an even number of digits | 1530 l = len(id) // 2 * 2 # grab an even number of digits |
1531 prefix = bin(id[: l * 2]) | 1531 prefix = bin(id[:l]) |
1532 nl = [e[7] for e in self.index if e[7].startswith(prefix)] | 1532 nl = [e[7] for e in self.index if e[7].startswith(prefix)] |
1533 nl = [ | 1533 nl = [ |
1534 n for n in nl if hex(n).startswith(id) and self.hasnode(n) | 1534 n for n in nl if hex(n).startswith(id) and self.hasnode(n) |
1535 ] | 1535 ] |
1536 if self.nodeconstants.nullhex.startswith(id): | 1536 if self.nodeconstants.nullhex.startswith(id): |