Show More
@@ -62,8 +62,13 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")) |
|
68 | if repo.changelog.count() == 0 and repo.manifest.count() > 1: | |
|
69 | havecl = 0 | |
|
70 | err(0, _("empty or missing 00changelog.i")) | |
|
71 | else: | |
|
67 | 72 | checksize(repo.changelog, "changelog") |
|
68 | 73 | |
|
69 | 74 | for i in xrange(repo.changelog.count()): |
@@ -96,6 +101,10 b' def _verify(repo):' | |||
|
96 | 101 | |
|
97 | 102 | seen = {} |
|
98 | 103 | repo.ui.status(_("checking manifests\n")) |
|
104 | if repo.changelog.count() > 0 and repo.manifest.count() == 0: | |
|
105 | havemf = 0 | |
|
106 | err(0, _("empty or missing 00manifest.i")) | |
|
107 | else: | |
|
99 | 108 | checkversion(repo.manifest, "manifest") |
|
100 | 109 | checksize(repo.manifest, "manifest") |
|
101 | 110 | |
@@ -103,7 +112,7 b' def _verify(repo):' | |||
|
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() | |
|
144 | if havemf > 0: | |
|
145 | nm = [(c, m) for m, c in neededmanifests.items()] | |
|
136 | 146 | nm.sort() |
|
137 |
for |
|
|
138 |
err( |
|
|
147 | for c, m in nm: | |
|
148 | err(c, _("changeset refers to unknown manifest %s") % short(m)) | |
|
139 | 149 | del neededmanifests, nm |
|
140 | 150 | |
|
141 | for f in filenodes: | |
|
151 | if havecl: | |
|
152 | fl = filenodes.keys() | |
|
153 | fl.sort() | |
|
154 | for f in fl: | |
|
142 | 155 | if f not in filelinkrevs: |
|
143 | 156 | lrs = [repo.manifest.linkrev(n) for n in filenodes[f]] |
|
144 | 157 | lrs.sort() |
|
145 | 158 | err(lrs[0], _("in manifest but not in changeset"), f) |
|
159 | del fl | |
|
146 | 160 | |
|
147 | for f in filelinkrevs: | |
|
161 | if havemf: | |
|
162 | fl = filelinkrevs.keys() | |
|
163 | fl.sort() | |
|
164 | for f in fl: | |
|
148 | 165 | if f not in filenodes: |
|
149 | 166 | lr = filelinkrevs[f][0] |
|
150 | 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,11 +204,13 b' def _verify(repo):' | |||
|
182 | 204 | warn(_(" (expected %s)") % filelinkrevs[f][0]) |
|
183 | 205 | flr = None # can't be trusted |
|
184 | 206 | else: |
|
207 | if havecl: | |
|
185 | 208 | filelinkrevs[f].remove(flr) |
|
186 | 209 | |
|
187 | 210 | if n in seen: |
|
188 | 211 | err(flr, _("duplicate revision %d") % i, f) |
|
189 |
if |
|
|
212 | if f in filenodes: | |
|
213 | if havemf and n not in filenodes[f]: | |
|
190 | 214 | err(flr, _("%s not in manifests") % (short(n)), f) |
|
191 | 215 | else: |
|
192 | 216 | del filenodes[f][n] |
@@ -230,6 +254,7 b' def _verify(repo):' | |||
|
230 | 254 | (short(n), inst), f) |
|
231 | 255 | |
|
232 | 256 | # cross-check |
|
257 | if f in filenodes: | |
|
233 | 258 | fns = [(repo.manifest.linkrev(filenodes[f][n]), n) |
|
234 | 259 | for n in filenodes[f]] |
|
235 | 260 | fns.sort() |
@@ -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