# HG changeset patch # User Matt Harbison # Date 2023-01-06 17:20:09 # Node ID 8b369bcbadf1c6914e34bc49120d9189bc6a8bb9 # Parent 8cb848601bec06248059371c36fc05fe1f41ef6e remotefilelog: byteify the message for a few StorageErrors Flagged by pytype locally. diff --git a/hgext/remotefilelog/shallowutil.py b/hgext/remotefilelog/shallowutil.py --- a/hgext/remotefilelog/shallowutil.py +++ b/hgext/remotefilelog/shallowutil.py @@ -247,7 +247,7 @@ def parsesizeflags(raw): index = raw.index(b'\0') except ValueError: raise BadRemotefilelogHeader( - "unexpected remotefilelog header: illegal format" + b"unexpected remotefilelog header: illegal format" ) header = raw[:index] if header.startswith(b'v'): @@ -267,7 +267,7 @@ def parsesizeflags(raw): size = int(header) if size is None: raise BadRemotefilelogHeader( - "unexpected remotefilelog header: no size found" + b"unexpected remotefilelog header: no size found" ) return index + 1, size, flags diff --git a/tests/test-remotefilelog-corrupt-cache.t b/tests/test-remotefilelog-corrupt-cache.t --- a/tests/test-remotefilelog-corrupt-cache.t +++ b/tests/test-remotefilelog-corrupt-cache.t @@ -38,7 +38,7 @@ Verify corrupt cache error message $ chmod u+w $CACHEDIR/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0 $ echo x > $CACHEDIR/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0 $ hg up tip 2>&1 | egrep "^[^ ].*unexpected remotefilelog" - hgext.remotefilelog.shallowutil.BadRemotefilelogHeader: unexpected remotefilelog header: illegal format (py3 !) + abort: unexpected remotefilelog header: illegal format Verify detection and remediation when remotefilelog.validatecachelog is set