comparison 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
comparison
equal deleted inserted replaced
17379:7228def3dcc1 17385:b32a30da608d
118 118
119 havecl = len(cl) > 0 119 havecl = len(cl) > 0
120 havemf = len(mf) > 0 120 havemf = len(mf) > 0
121 121
122 ui.status(_("checking changesets\n")) 122 ui.status(_("checking changesets\n"))
123 hasmanifest = False
123 seen = {} 124 seen = {}
124 checklog(cl, "changelog", 0) 125 checklog(cl, "changelog", 0)
125 total = len(repo) 126 total = len(repo)
126 for i in repo: 127 for i in repo:
127 ui.progress(_('checking'), i, total=total, unit=_('changesets')) 128 ui.progress(_('checking'), i, total=total, unit=_('changesets'))
128 n = cl.node(i) 129 n = cl.node(i)
129 checkentry(cl, i, n, seen, [i], "changelog") 130 checkentry(cl, i, n, seen, [i], "changelog")
130 131
131 try: 132 try:
132 changes = cl.read(n) 133 changes = cl.read(n)
133 mflinkrevs.setdefault(changes[0], []).append(i) 134 if changes[0] != nullid:
135 mflinkrevs.setdefault(changes[0], []).append(i)
136 hasmanifest = True
134 for f in changes[3]: 137 for f in changes[3]:
135 filelinkrevs.setdefault(f, []).append(i) 138 filelinkrevs.setdefault(f, []).append(i)
136 except Exception, inst: 139 except Exception, inst:
140 hasmanifest = True
137 exc(i, _("unpacking changeset %s") % short(n), inst) 141 exc(i, _("unpacking changeset %s") % short(n), inst)
138 ui.progress(_('checking'), None) 142 ui.progress(_('checking'), None)
139 143
140 ui.status(_("checking manifests\n")) 144 ui.status(_("checking manifests\n"))
141 seen = {} 145 seen = {}
142 checklog(mf, "manifest", 0) 146 if hasmanifest:
147 # Do not check manifest if there are only changelog entries with
148 # null manifests.
149 checklog(mf, "manifest", 0)
143 total = len(mf) 150 total = len(mf)
144 for i in mf: 151 for i in mf:
145 ui.progress(_('checking'), i, total=total, unit=_('manifests')) 152 ui.progress(_('checking'), i, total=total, unit=_('manifests'))
146 n = mf.node(i) 153 n = mf.node(i)
147 lr = checkentry(mf, i, n, seen, mflinkrevs.get(n, []), "manifest") 154 lr = checkentry(mf, i, n, seen, mflinkrevs.get(n, []), "manifest")