File mercurial-5.9.1-bsc1210707.patch of Package mercurial.29030

# HG changeset patch
# User Raphaël Gomès <rgomes@octobus.net>
# Date 1634569908 -7200
# Node ID 531d26b1390a5662afca71bd8e942173f9470774
# Parent  690dbe1f07bf4df29292d3ecd73cf68837cc617a
rewrite: fix issue6599

Explanation inside.

Differential Revision: https://phab.mercurial-scm.org/D11685

diff -r 690dbe1f07bf -r 531d26b1390a mercurial/revlogutils/rewrite.py
--- a/mercurial/revlogutils/rewrite.py	Tue Oct 05 21:17:31 2021 +0530
+++ b/mercurial/revlogutils/rewrite.py	Mon Oct 18 17:11:48 2021 +0200
@@ -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 = bytes(raw_text[:2]) == b'\x01\n'
     if metadata_cache is not None:
         metadata_cache[filerev] = has_meta
     if has_meta:

openSUSE Build Service is sponsored by