Mercurial > hg
changeset 28111:06205989264b
verify: move cross-checking of changeset/manifest out of _crosscheckfiles()
Reasons:
* _crosscheckfiles(), as the name suggests, is about checking that
the set of files files mentioned in changesets match the set of
files mentioned in the manifests.
* The "checking" in _crosscheckfiles() looked rather strange, as it
just emitted an error for *every* entry in mflinkrevs. The reason
was that these were the entries remaining after the call to
_verifymanifest(). Moving all the processing of mflinkrevs into
_verifymanifest() makes it much clearer that it's the remaining
entries that are a problem.
Functional change: progress is no longer reported for "crosschecking"
of missing manifest entries. Since the crosschecking phase takes a
tiny fraction of the verification, I don't think this is a
problem. Also, any reports of "changeset refers to unknown manifest"
will now come before "crosschecking files in changesets and
manifests".
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sun, 31 Jan 2016 00:10:56 -0800 |
parents | 2b41f8655bbc |
children | 334a3aa677fb |
files | mercurial/verify.py |
diffstat | 1 files changed, 12 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/verify.py Sun Jan 31 21:55:52 2016 -0800 +++ b/mercurial/verify.py Sun Jan 31 00:10:56 2016 -0800 @@ -147,9 +147,9 @@ mflinkrevs, filelinkrevs = self._verifychangelog() filenodes = self._verifymanifest(mflinkrevs) + del mflinkrevs - self._crosscheckfiles(mflinkrevs, filelinkrevs, filenodes) - del mflinkrevs + self._crosscheckfiles(filelinkrevs, filenodes) totalfiles, filerevisions = self._verifyfiles(filenodes, filelinkrevs) @@ -232,25 +232,24 @@ self.exc(lr, _("reading manifest delta %s") % short(n), inst) ui.progress(_('checking'), None) + if self.havemf: + for c, m in sorted([(c, m) for m in mflinkrevs + for c in mflinkrevs[m]]): + if m == nullid: + continue + self.err(c, _("changeset refers to unknown manifest %s") % + short(m)) + return filenodes - def _crosscheckfiles(self, mflinkrevs, filelinkrevs, filenodes): + def _crosscheckfiles(self, filelinkrevs, filenodes): repo = self.repo ui = self.ui ui.status(_("crosschecking files in changesets and manifests\n")) - total = len(mflinkrevs) + len(filelinkrevs) + len(filenodes) + total = len(filelinkrevs) + len(filenodes) count = 0 if self.havemf: - for c, m in sorted([(c, m) for m in mflinkrevs - for c in mflinkrevs[m]]): - count += 1 - if m == nullid: - continue - ui.progress(_('crosschecking'), count, total=total) - self.err(c, _("changeset refers to unknown manifest %s") % - short(m)) - for f in sorted(filelinkrevs): count += 1 ui.progress(_('crosschecking'), count, total=total)