This is an archive of the discontinued Mercurial Phabricator instance.

manifest: remove a final 40-byte assumption from pure-python parser
ClosedPublic

Authored by durin42 on Apr 2 2020, 4:32 PM.

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

durin42 created this revision.Apr 2 2020, 4:32 PM
Alphare accepted this revision.Apr 14 2020, 4:58 AM
durin42 updated this revision to Diff 21054.Apr 14 2020, 11:29 AM
pulkit accepted this revision.Apr 14 2020, 2:57 PM
This revision is now accepted and ready to land.Apr 14 2020, 2:57 PM
yuja added a subscriber: yuja.Apr 15 2020, 7:05 AM

diff --git a/mercurial/manifest.py b/mercurial/manifest.py

  • a/mercurial/manifest.py

+++ b/mercurial/manifest.py
@@ -57,7 +57,10 @@

    raise ValueError(b'Manifest lines not in sorted order.')
prev = l
f, n = l.split(b'\0')
  • if len(n) > 40:

+ nl = len(n)
+ if 64 < nl:
+ yield f, bin(n[:64]), n[64:]
+ if 40 < nl < 45:

    yield f, bin(n[:40]), n[40:]
else:
    yield f, bin(n), b''

elif 40 < nl:

otherwise full-width hash would be yielded twice.