changeset 47042:c5e1cc0b4c77

core: don't hard-code node length Differential Revision: https://phab.mercurial-scm.org/D10536
author Joerg Sonnenberger <joerg@bec.de>
date Fri, 30 Apr 2021 03:19:45 +0200
parents a407fe56d6e8
children 12450fbea288
files mercurial/localrepo.py mercurial/revlog.py
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Fri Apr 30 03:09:16 2021 +0200
+++ b/mercurial/localrepo.py	Fri Apr 30 03:19:45 2021 +0200
@@ -1840,7 +1840,7 @@
                 # when we know that '.' won't be hidden
                 node = self.dirstate.p1()
                 rev = self.unfiltered().changelog.rev(node)
-            elif len(changeid) == 20:
+            elif len(changeid) == self.nodeconstants.nodelen:
                 try:
                     node = changeid
                     rev = self.changelog.rev(changeid)
--- a/mercurial/revlog.py	Fri Apr 30 03:09:16 2021 +0200
+++ b/mercurial/revlog.py	Fri Apr 30 03:19:45 2021 +0200
@@ -1299,7 +1299,7 @@
         if isinstance(id, int):
             # rev
             return self.node(id)
-        if len(id) == 20:
+        if len(id) == self.nodeconstants.nodelen:
             # possibly a binary node
             # odds of a binary node being all hex in ASCII are 1 in 10**25
             try: