comparison mercurial/verify.py @ 42157:7755b89cadaf

verify: also check full manifest validity during verify runs Before this changes, `hg verify` only checked if a manifest revision existed and referenced the proper files. However it never checked the manifest revision content itself. Mercurial is expecting manifest entries to be sorted and will crash otherwise. Since `hg verify` did not attempted a full restoration of manifest entry, it could ignore this kind of corruption. This new check significantly increases the cost of a `hg verify` run. This especially affects large repository not using `sparse-revlog`. For now, this is hidden behind the `--full` experimental flag.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 06 Mar 2019 15:06:53 +0100
parents 496ac8a02380
children 91452f62dd53
comparison
equal deleted inserted replaced
42156:496ac8a02380 42157:7755b89cadaf
335 if not match(fullpath): 335 if not match(fullpath):
336 continue 336 continue
337 filenodes.setdefault(fullpath, {}).setdefault(fn, lr) 337 filenodes.setdefault(fullpath, {}).setdefault(fn, lr)
338 except Exception as inst: 338 except Exception as inst:
339 self._exc(lr, _("reading delta %s") % short(n), inst, label) 339 self._exc(lr, _("reading delta %s") % short(n), inst, label)
340 if self._level >= VERIFY_FULL:
341 try:
342 # Various issues can affect manifest. So we read each full
343 # text from storage. This triggers the checks from the core
344 # code (eg: hash verification, filename are ordered, etc.)
345 mfdelta = mfl.get(dir, n).read()
346 except Exception as inst:
347 self._exc(lr, _("reading full manifest %s") % short(n),
348 inst, label)
349
340 if not dir: 350 if not dir:
341 progress.complete() 351 progress.complete()
342 352
343 if self.havemf: 353 if self.havemf:
344 # since we delete entry in `mflinkrevs` during iteration, any 354 # since we delete entry in `mflinkrevs` during iteration, any