# HG changeset patch # User Joerg Sonnenberger # Date 1594039759 -7200 # Node ID 19748c73c208921fed7132e892fa3f88f73e8ebf # Parent d0ef8c1dddd45c5ab9dff5e74c04ba779d550008 manifest: use the same logic for handling flags in _parse as elsewhere Differential Revision: https://phab.mercurial-scm.org/D8684 diff -r d0ef8c1dddd4 -r 19748c73c208 mercurial/manifest.py --- a/mercurial/manifest.py Mon Jul 06 03:43:32 2020 +0200 +++ b/mercurial/manifest.py Mon Jul 06 14:49:19 2020 +0200 @@ -58,14 +58,16 @@ prev = l f, n = l.split(b'\0') nl = len(n) - if 64 < nl: - # modern hash, full width - yield f, bin(n[:64]), n[64:] - elif 40 < nl < 45: - # legacy hash, always sha1 - yield f, bin(n[:40]), n[40:] + flags = n[-1:] + if flags in _manifestflags: + n = n[:-1] + nl -= 1 else: - yield f, bin(n), b'' + flags = b'' + if nl not in (40, 64): + raise ValueError(b'Invalid manifest line') + + yield f, bin(n), flags def _text(it):