D11685: rewrite: fix issue6599
Alphare (Raphaël Gomès)
phabricator at mercurial-scm.org
Mon Oct 18 15:12:08 UTC 2021
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
Explanation inside.
REPOSITORY
rHG Mercurial
BRANCH
stable
REVISION DETAIL
https://phab.mercurial-scm.org/D11685
AFFECTED FILES
mercurial/revlogutils/rewrite.py
CHANGE DETAILS
diff --git a/mercurial/revlogutils/rewrite.py b/mercurial/revlogutils/rewrite.py
--- a/mercurial/revlogutils/rewrite.py
+++ b/mercurial/revlogutils/rewrite.py
@@ -589,7 +589,9 @@
except error.CensoredNodeError:
# We don't care about censored nodes as they never carry metadata
return False
- has_meta = raw_text.startswith(b'\x01\n')
+
+ # raw text can be a `memoryview`, which doesn't implement `startswith`
+ has_meta = len(raw_text) >= 2 and bytes(raw_text[:2]) == b'\x01\n'
if metadata_cache is not None:
metadata_cache[filerev] = has_meta
if has_meta:
To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list