Show More
@@ -62,9 +62,14 b' def _verify(repo):' | |||
|
62 | 62 | repo.ui.status(_("repository uses revlog format %d\n") % |
|
63 | 63 | (revlogv1 and 1 or 0)) |
|
64 | 64 | |
|
65 | havecl = havemf = 1 | |
|
65 | 66 | seen = {} |
|
66 | 67 | repo.ui.status(_("checking changesets\n")) |
|
67 | checksize(repo.changelog, "changelog") | |
|
68 | if repo.changelog.count() == 0 and repo.manifest.count() > 1: | |
|
69 | havecl = 0 | |
|
70 | err(0, _("empty or missing 00changelog.i")) | |
|
71 | else: | |
|
72 | checksize(repo.changelog, "changelog") | |
|
68 | 73 | |
|
69 | 74 | for i in xrange(repo.changelog.count()): |
|
70 | 75 | changesets += 1 |
@@ -96,14 +101,18 b' def _verify(repo):' | |||
|
96 | 101 | |
|
97 | 102 | seen = {} |
|
98 | 103 | repo.ui.status(_("checking manifests\n")) |
|
99 | checkversion(repo.manifest, "manifest") | |
|
100 | checksize(repo.manifest, "manifest") | |
|
104 | if repo.changelog.count() > 0 and repo.manifest.count() == 0: | |
|
105 | havemf = 0 | |
|
106 | err(0, _("empty or missing 00manifest.i")) | |
|
107 | else: | |
|
108 | checkversion(repo.manifest, "manifest") | |
|
109 | checksize(repo.manifest, "manifest") | |
|
101 | 110 | |
|
102 | 111 | for i in xrange(repo.manifest.count()): |
|
103 | 112 | n = repo.manifest.node(i) |
|
104 | 113 | l = repo.manifest.linkrev(n) |
|
105 | 114 | |
|
106 | if l < 0 or l >= repo.changelog.count(): | |
|
115 | if l < 0 or (havecl and l >= repo.changelog.count()): | |
|
107 | 116 | err(None, _("bad link (%d) at manifest revision %d") % (l, i)) |
|
108 | 117 | |
|
109 | 118 | if n in neededmanifests: |
@@ -132,38 +141,51 b' def _verify(repo):' | |||
|
132 | 141 | |
|
133 | 142 | repo.ui.status(_("crosschecking files in changesets and manifests\n")) |
|
134 | 143 | |
|
135 | nm = neededmanifests.items() | |
|
136 | nm.sort() | |
|
137 | for m, c in nm: | |
|
138 | err(m, _("changeset refers to unknown manifest %s") % short(c)) | |
|
139 | del neededmanifests, nm | |
|
144 | if havemf > 0: | |
|
145 | nm = [(c, m) for m, c in neededmanifests.items()] | |
|
146 | nm.sort() | |
|
147 | for c, m in nm: | |
|
148 | err(c, _("changeset refers to unknown manifest %s") % short(m)) | |
|
149 | del neededmanifests, nm | |
|
140 | 150 | |
|
141 | for f in filenodes: | |
|
142 |
|
|
|
143 | lrs = [repo.manifest.linkrev(n) for n in filenodes[f]] | |
|
144 | lrs.sort() | |
|
145 | err(lrs[0], _("in manifest but not in changeset"), f) | |
|
151 | if havecl: | |
|
152 | fl = filenodes.keys() | |
|
153 | fl.sort() | |
|
154 | for f in fl: | |
|
155 | if f not in filelinkrevs: | |
|
156 | lrs = [repo.manifest.linkrev(n) for n in filenodes[f]] | |
|
157 | lrs.sort() | |
|
158 | err(lrs[0], _("in manifest but not in changeset"), f) | |
|
159 | del fl | |
|
146 | 160 | |
|
147 | for f in filelinkrevs: | |
|
148 | if f not in filenodes: | |
|
149 | lr = filelinkrevs[f][0] | |
|
150 | err(lr, _("in changeset but not in manifest"), f) | |
|
161 | if havemf: | |
|
162 | fl = filelinkrevs.keys() | |
|
163 | fl.sort() | |
|
164 | for f in fl: | |
|
165 | if f not in filenodes: | |
|
166 | lr = filelinkrevs[f][0] | |
|
167 | err(lr, _("in changeset but not in manifest"), f) | |
|
168 | del fl | |
|
151 | 169 | |
|
152 | 170 | repo.ui.status(_("checking files\n")) |
|
153 | ff = filenodes.keys() | |
|
171 | ff = dict.fromkeys(filenodes.keys() + filelinkrevs.keys()).keys() | |
|
154 | 172 | ff.sort() |
|
155 | 173 | for f in ff: |
|
156 | 174 | if f == "/dev/null": |
|
157 | 175 | continue |
|
158 | 176 | files += 1 |
|
159 | 177 | if not f: |
|
160 |
lr = |
|
|
161 |
err(lr, _("file without name in manifest |
|
|
178 | lr = filelinkrevs[f][0] | |
|
179 | err(lr, _("file without name in manifest")) | |
|
162 | 180 | continue |
|
163 | 181 | fl = repo.file(f) |
|
164 | 182 | checkversion(fl, f) |
|
165 | 183 | checksize(fl, f) |
|
166 | 184 | |
|
185 | if fl.count() == 0: | |
|
186 | err(filelinkrevs[f][0], _("empty or missing revlog"), f) | |
|
187 | continue | |
|
188 | ||
|
167 | 189 | seen = {} |
|
168 | 190 | nodes = {nullid: 1} |
|
169 | 191 | for i in xrange(fl.count()): |
@@ -171,7 +193,7 b' def _verify(repo):' | |||
|
171 | 193 | n = fl.node(i) |
|
172 | 194 | flr = fl.linkrev(n) |
|
173 | 195 | |
|
174 | if flr not in filelinkrevs.get(f, []): | |
|
196 | if flr < 0 or (havecl and flr not in filelinkrevs.get(f, [])): | |
|
175 | 197 | if flr < 0 or flr >= repo.changelog.count(): |
|
176 | 198 | err(None, _("rev %d point to nonexistent changeset %d") |
|
177 | 199 | % (i, flr), f) |
@@ -182,14 +204,16 b' def _verify(repo):' | |||
|
182 | 204 | warn(_(" (expected %s)") % filelinkrevs[f][0]) |
|
183 | 205 | flr = None # can't be trusted |
|
184 | 206 | else: |
|
185 | filelinkrevs[f].remove(flr) | |
|
207 | if havecl: | |
|
208 | filelinkrevs[f].remove(flr) | |
|
186 | 209 | |
|
187 | 210 | if n in seen: |
|
188 | 211 | err(flr, _("duplicate revision %d") % i, f) |
|
189 |
if |
|
|
190 | err(flr, _("%s not in manifests") % (short(n)), f) | |
|
191 | else: | |
|
192 |
|
|
|
212 | if f in filenodes: | |
|
213 | if havemf and n not in filenodes[f]: | |
|
214 | err(flr, _("%s not in manifests") % (short(n)), f) | |
|
215 | else: | |
|
216 | del filenodes[f][n] | |
|
193 | 217 | |
|
194 | 218 | # verify contents |
|
195 | 219 | try: |
@@ -230,11 +254,12 b' def _verify(repo):' | |||
|
230 | 254 | (short(n), inst), f) |
|
231 | 255 | |
|
232 | 256 | # cross-check |
|
233 | fns = [(repo.manifest.linkrev(filenodes[f][n]), n) | |
|
234 |
|
|
|
235 | fns.sort() | |
|
236 | for lr, node in fns: | |
|
237 | err(lr, _("%s in manifests not found") % short(node), f) | |
|
257 | if f in filenodes: | |
|
258 | fns = [(repo.manifest.linkrev(filenodes[f][n]), n) | |
|
259 | for n in filenodes[f]] | |
|
260 | fns.sort() | |
|
261 | for lr, node in fns: | |
|
262 | err(lr, _("%s in manifests not found") % short(node), f) | |
|
238 | 263 | |
|
239 | 264 | repo.ui.status(_("%d files, %d changesets, %d total revisions\n") % |
|
240 | 265 | (files, changesets, revisions)) |
@@ -247,4 +272,3 b' def _verify(repo):' | |||
|
247 | 272 | repo.ui.warn(_("(first damaged changeset appears to be %d)\n") |
|
248 | 273 | % firstbad[0]) |
|
249 | 274 | return 1 |
|
250 |
General Comments 0
You need to be logged in to leave comments.
Login now