# HG changeset patch # User Martin von Zweigbergk # Date 1454227856 28800 # Node ID 06205989264b8cd8a4405d0c3b4f2a57e8cc36cc # Parent 2b41f8655bbca63d17249f37a12a7d3f7887b9bd 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". diff -r 2b41f8655bbc -r 06205989264b mercurial/verify.py --- 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)