comparison mercurial/verify.py @ 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 fb92927f9775
children 334a3aa677fb
comparison
equal deleted inserted replaced
28110:2b41f8655bbc 28111:06205989264b
145 (self.revlogv1 and 1 or 0)) 145 (self.revlogv1 and 1 or 0))
146 146
147 mflinkrevs, filelinkrevs = self._verifychangelog() 147 mflinkrevs, filelinkrevs = self._verifychangelog()
148 148
149 filenodes = self._verifymanifest(mflinkrevs) 149 filenodes = self._verifymanifest(mflinkrevs)
150
151 self._crosscheckfiles(mflinkrevs, filelinkrevs, filenodes)
152 del mflinkrevs 150 del mflinkrevs
151
152 self._crosscheckfiles(filelinkrevs, filenodes)
153 153
154 totalfiles, filerevisions = self._verifyfiles(filenodes, filelinkrevs) 154 totalfiles, filerevisions = self._verifyfiles(filenodes, filelinkrevs)
155 155
156 ui.status(_("%d files, %d changesets, %d total revisions\n") % 156 ui.status(_("%d files, %d changesets, %d total revisions\n") %
157 (totalfiles, len(repo.changelog), filerevisions)) 157 (totalfiles, len(repo.changelog), filerevisions))
230 _normpath(f), {}).setdefault(fn, lr) 230 _normpath(f), {}).setdefault(fn, lr)
231 except Exception as inst: 231 except Exception as inst:
232 self.exc(lr, _("reading manifest delta %s") % short(n), inst) 232 self.exc(lr, _("reading manifest delta %s") % short(n), inst)
233 ui.progress(_('checking'), None) 233 ui.progress(_('checking'), None)
234 234
235 if self.havemf:
236 for c, m in sorted([(c, m) for m in mflinkrevs
237 for c in mflinkrevs[m]]):
238 if m == nullid:
239 continue
240 self.err(c, _("changeset refers to unknown manifest %s") %
241 short(m))
242
235 return filenodes 243 return filenodes
236 244
237 def _crosscheckfiles(self, mflinkrevs, filelinkrevs, filenodes): 245 def _crosscheckfiles(self, filelinkrevs, filenodes):
238 repo = self.repo 246 repo = self.repo
239 ui = self.ui 247 ui = self.ui
240 ui.status(_("crosschecking files in changesets and manifests\n")) 248 ui.status(_("crosschecking files in changesets and manifests\n"))
241 249
242 total = len(mflinkrevs) + len(filelinkrevs) + len(filenodes) 250 total = len(filelinkrevs) + len(filenodes)
243 count = 0 251 count = 0
244 if self.havemf: 252 if self.havemf:
245 for c, m in sorted([(c, m) for m in mflinkrevs
246 for c in mflinkrevs[m]]):
247 count += 1
248 if m == nullid:
249 continue
250 ui.progress(_('crosschecking'), count, total=total)
251 self.err(c, _("changeset refers to unknown manifest %s") %
252 short(m))
253
254 for f in sorted(filelinkrevs): 253 for f in sorted(filelinkrevs):
255 count += 1 254 count += 1
256 ui.progress(_('crosschecking'), count, total=total) 255 ui.progress(_('crosschecking'), count, total=total)
257 if f not in filenodes: 256 if f not in filenodes:
258 lr = filelinkrevs[f][0] 257 lr = filelinkrevs[f][0]