Show More
@@ -308,7 +308,7 b' class basestore(object):' | |||
|
308 | 308 | # Content matches the intended path |
|
309 | 309 | return True |
|
310 | 310 | return False |
|
311 |
except (ValueError, |
|
|
311 | except (ValueError, shallowutil.BadRemotefilelogHeader): | |
|
312 | 312 | pass |
|
313 | 313 | |
|
314 | 314 | return False |
@@ -233,6 +233,10 b' def bin2int(buf):' | |||
|
233 | 233 | return x |
|
234 | 234 | |
|
235 | 235 | |
|
236 | class BadRemotefilelogHeader(error.StorageError): | |
|
237 | """Exception raised when parsing a remotefilelog blob header fails.""" | |
|
238 | ||
|
239 | ||
|
236 | 240 | def parsesizeflags(raw): |
|
237 | 241 | """given a remotefilelog blob, return (headersize, rawtextsize, flags) |
|
238 | 242 | |
@@ -253,16 +257,20 b' def parsesizeflags(raw):' | |||
|
253 | 257 | elif s.startswith(constants.METAKEYFLAG): |
|
254 | 258 | flags = int(s[len(constants.METAKEYFLAG) :]) |
|
255 | 259 | else: |
|
256 |
raise |
|
|
260 | raise BadRemotefilelogHeader( | |
|
257 | 261 | b'unsupported remotefilelog header: %s' % header |
|
258 | 262 | ) |
|
259 | 263 | else: |
|
260 | 264 | # v0, str(int(size)) is the header |
|
261 | 265 | size = int(header) |
|
262 | 266 | except ValueError: |
|
263 | raise RuntimeError("unexpected remotefilelog header: illegal format") | |
|
267 | raise BadRemotefilelogHeader( | |
|
268 | "unexpected remotefilelog header: illegal format" | |
|
269 | ) | |
|
264 | 270 | if size is None: |
|
265 | raise RuntimeError("unexpected remotefilelog header: no size found") | |
|
271 | raise BadRemotefilelogHeader( | |
|
272 | "unexpected remotefilelog header: no size found" | |
|
273 | ) | |
|
266 | 274 | return index + 1, size, flags |
|
267 | 275 | |
|
268 | 276 |
@@ -38,7 +38,8 b' Verify corrupt cache error message' | |||
|
38 | 38 | $ chmod u+w $CACHEDIR/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0 |
|
39 | 39 | $ echo x > $CACHEDIR/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0 |
|
40 | 40 | $ hg up tip 2>&1 | egrep "^[^ ].*unexpected remotefilelog" |
|
41 |
|
|
|
41 | abort: unexpected remotefilelog header: illegal format (no-py3 !) | |
|
42 | hgext.remotefilelog.shallowutil.BadRemotefilelogHeader: unexpected remotefilelog header: illegal format (py3 !) | |
|
42 | 43 | |
|
43 | 44 | Verify detection and remediation when remotefilelog.validatecachelog is set |
|
44 | 45 |
General Comments 0
You need to be logged in to leave comments.
Login now