changeset 49246:31602d471b60

revlog: make round-down pattern clearer
author Manuel Jacob <me@manueljacob.de>
date Mon, 30 May 2022 00:39:53 +0200
parents cd51d4957b28
children 3e5f1fb2aec7
files mercurial/revlog.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Thu Jun 02 16:24:06 2022 +0200
+++ b/mercurial/revlog.py	Mon May 30 00:39:53 2022 +0200
@@ -1527,8 +1527,8 @@
         if len(id) <= 40:
             try:
                 # hex(node)[:...]
-                l = len(id) // 2  # grab an even number of digits
-                prefix = bin(id[: l * 2])
+                l = len(id) // 2 * 2  # grab an even number of digits
+                prefix = bin(id[:l])
                 nl = [e[7] for e in self.index if e[7].startswith(prefix)]
                 nl = [
                     n for n in nl if hex(n).startswith(id) and self.hasnode(n)