Use revlog.delta and mdiff.patchtext to massively speed up processing

of manifests. This lets us verify a 28k changeset kernel repo in under
two minutes.
This commit is contained in:
mpm@selenic.com 2005-05-20 17:44:34 -08:00
parent 4e35c669ab
commit d35617bec8

20
hg
View File

@ -454,13 +454,17 @@ elif cmd == "verify":
errors += 1
try:
m = repo.manifest.read(n)
delta = mdiff.patchtext(repo.manifest.delta(n))
except KeyboardInterrupt:
print "aborted"
sys.exit(0)
except Exception, inst:
ui.warn("unpacking manifest %s: %s\n" % (hg.short(n), inst))
errors += 1
for f, fn in m.items():
filenodes.setdefault(f, {})[fn] = 1
ff = [ l.split('\0') for l in delta.splitlines() ]
for f, fn in ff:
filenodes.setdefault(f, {})[hg.bin(fn)] = 1
ui.status("crosschecking files in changesets and manifests\n")
for f in filenodes:
@ -470,11 +474,14 @@ elif cmd == "verify":
for f in filelinkrevs:
if f not in filenodes:
ui.warn("file %s in changeset but not in manifest" % f)
ui.warn("file %s in changeset but not in manifest\n" % f)
errors += 1
ui.status("checking files\n")
for f in filenodes:
ff = filenodes.keys()
ff.sort()
for f in ff:
if f == "/dev/null": continue
files += 1
fl = repo.file(f)
nodes = { hg.nullid: 1 }
@ -482,7 +489,8 @@ elif cmd == "verify":
n = fl.node(i)
if n not in filenodes[f]:
ui.warn("%s:%s not in manifests\n" % (f, hg.short(n)))
ui.warn("%s: %d:%s not in manifests\n" % (f, i, hg.short(n)))
print len(filenodes[f].keys()), fl.count(), f
errors += 1
else:
del filenodes[f][n]