diff mercurial/verify.py @ 17385:b32a30da608d stable

verify: do not choke on valid changelog without manifest Before this change: $ hg init $ hg branch foo $ hg ci -m branchfoo $ hg verify checking changesets checking manifests 0: empty or missing manifest crosschecking files in changesets and manifests checking files 0 files, 1 changesets, 0 total revisions 1 integrity errors encountered! (first damaged changeset appears to be 0) [1]
author Patrick Mezard <patrick@mezard.eu>
date Tue, 21 Aug 2012 20:51:16 +0200
parents f366d4c2ff34
children 4562570ae0f7
line wrap: on
line diff
--- a/mercurial/verify.py	Tue Aug 21 12:26:53 2012 -0500
+++ b/mercurial/verify.py	Tue Aug 21 20:51:16 2012 +0200
@@ -120,6 +120,7 @@
     havemf = len(mf) > 0
 
     ui.status(_("checking changesets\n"))
+    hasmanifest = False
     seen = {}
     checklog(cl, "changelog", 0)
     total = len(repo)
@@ -130,16 +131,22 @@
 
         try:
             changes = cl.read(n)
-            mflinkrevs.setdefault(changes[0], []).append(i)
+            if changes[0] != nullid:
+                mflinkrevs.setdefault(changes[0], []).append(i)
+                hasmanifest = True
             for f in changes[3]:
                 filelinkrevs.setdefault(f, []).append(i)
         except Exception, inst:
+            hasmanifest = True
             exc(i, _("unpacking changeset %s") % short(n), inst)
     ui.progress(_('checking'), None)
 
     ui.status(_("checking manifests\n"))
     seen = {}
-    checklog(mf, "manifest", 0)
+    if hasmanifest:
+        # Do not check manifest if there are only changelog entries with
+        # null manifests.
+        checklog(mf, "manifest", 0)
     total = len(mf)
     for i in mf:
         ui.progress(_('checking'), i, total=total, unit=_('manifests'))