core: don't hard-code node length
Differential Revision: https://phab.mercurial-scm.org/D10536
--- 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: