changeset 45418:c4a4a49589bf

storageutil: allow modern hash sizes for fileids Differential Revision: https://phab.mercurial-scm.org/D8783
author Joerg Sonnenberger <joerg@bec.de>
date Tue, 21 Jul 2020 22:41:45 +0200
parents 6a0e7bf73bb2
children 601ec3faeb6b
files mercurial/utils/storageutil.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/utils/storageutil.py	Tue Sep 01 22:28:41 2020 -0400
+++ b/mercurial/utils/storageutil.py	Tue Jul 21 22:41:45 2020 +0200
@@ -180,9 +180,9 @@
 
     ``fileid`` can be:
 
-    * A 20 byte binary node.
+    * A 20 or 32 byte binary node.
     * An integer revision number
-    * A 40 byte hex node.
+    * A 40 or 64 byte hex node.
     * A bytes that can be parsed as an integer representing a revision number.
 
     ``identifier`` is used to populate ``error.LookupError`` with an identifier
@@ -198,14 +198,14 @@
                 b'%d' % fileid, identifier, _(b'no match found')
             )
 
-    if len(fileid) == 20:
+    if len(fileid) in (20, 32):
         try:
             store.rev(fileid)
             return fileid
         except error.LookupError:
             pass
 
-    if len(fileid) == 40:
+    if len(fileid) in (40, 64):
         try:
             rawnode = bin(fileid)
             store.rev(rawnode)