changeset 50029:5698c5eee12b

storageutil: match node length with repository
author Joerg Sonnenberger <joerg@bec.de>
date Thu, 29 Apr 2021 22:01:04 +0200
parents 380ed77e9ad3
children 1bd33932713d
files mercurial/utils/storageutil.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/utils/storageutil.py	Tue Dec 13 12:50:52 2022 +0100
+++ b/mercurial/utils/storageutil.py	Thu Apr 29 22:01:04 2021 +0200
@@ -190,9 +190,9 @@
 
     ``fileid`` can be:
 
-    * A 20 or 32 byte binary node.
+    * A binary node of appropiate size (e.g. 20/32 Bytes).
     * An integer revision number
-    * A 40 or 64 byte hex node.
+    * A hex node of appropiate size (e.g. 40/64 Bytes).
     * A bytes that can be parsed as an integer representing a revision number.
 
     ``identifier`` is used to populate ``error.LookupError`` with an identifier
@@ -208,14 +208,14 @@
                 b'%d' % fileid, identifier, _(b'no match found')
             )
 
-    if len(fileid) in (20, 32):
+    if len(fileid) == len(store.nullid):
         try:
             store.rev(fileid)
             return fileid
         except error.LookupError:
             pass
 
-    if len(fileid) in (40, 64):
+    if len(fileid) == 2 * len(store.nullid):
         try:
             rawnode = bin(fileid)
             store.rev(rawnode)