revlog: make round-down pattern clearer
authorManuel Jacob <me@manueljacob.de>
Mon, 30 May 2022 00:39:53 +0200
changeset 49246 31602d471b60
parent 49244 cd51d4957b28
child 49247 3e5f1fb2aec7
revlog: make round-down pattern clearer
mercurial/revlog.py
--- 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)