comparison hg @ 121:66fb61d9d97d

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.
author mpm@selenic.com
date Fri, 20 May 2005 17:44:34 -0800
parents 707a7481a861
children 82fd709deb8e
comparison
equal deleted inserted replaced
120:bae6f0328f63 121:66fb61d9d97d
452 ui.warn("manifest %s points to %s, not %s\n" % 452 ui.warn("manifest %s points to %s, not %s\n" %
453 (hg.hex(n), hg.hex(ca), hg.hex(cc))) 453 (hg.hex(n), hg.hex(ca), hg.hex(cc)))
454 errors += 1 454 errors += 1
455 455
456 try: 456 try:
457 m = repo.manifest.read(n) 457 delta = mdiff.patchtext(repo.manifest.delta(n))
458 except KeyboardInterrupt:
459 print "aborted"
460 sys.exit(0)
458 except Exception, inst: 461 except Exception, inst:
459 ui.warn("unpacking manifest %s: %s\n" % (hg.short(n), inst)) 462 ui.warn("unpacking manifest %s: %s\n" % (hg.short(n), inst))
460 errors += 1 463 errors += 1
461 464
462 for f, fn in m.items(): 465 ff = [ l.split('\0') for l in delta.splitlines() ]
463 filenodes.setdefault(f, {})[fn] = 1 466 for f, fn in ff:
467 filenodes.setdefault(f, {})[hg.bin(fn)] = 1
464 468
465 ui.status("crosschecking files in changesets and manifests\n") 469 ui.status("crosschecking files in changesets and manifests\n")
466 for f in filenodes: 470 for f in filenodes:
467 if f not in filelinkrevs: 471 if f not in filelinkrevs:
468 ui.warn("file %s in manifest but not in changesets\n" % f) 472 ui.warn("file %s in manifest but not in changesets\n" % f)
469 errors += 1 473 errors += 1
470 474
471 for f in filelinkrevs: 475 for f in filelinkrevs:
472 if f not in filenodes: 476 if f not in filenodes:
473 ui.warn("file %s in changeset but not in manifest" % f) 477 ui.warn("file %s in changeset but not in manifest\n" % f)
474 errors += 1 478 errors += 1
475 479
476 ui.status("checking files\n") 480 ui.status("checking files\n")
477 for f in filenodes: 481 ff = filenodes.keys()
482 ff.sort()
483 for f in ff:
484 if f == "/dev/null": continue
478 files += 1 485 files += 1
479 fl = repo.file(f) 486 fl = repo.file(f)
480 nodes = { hg.nullid: 1 } 487 nodes = { hg.nullid: 1 }
481 for i in range(fl.count()): 488 for i in range(fl.count()):
482 n = fl.node(i) 489 n = fl.node(i)
483 490
484 if n not in filenodes[f]: 491 if n not in filenodes[f]:
485 ui.warn("%s:%s not in manifests\n" % (f, hg.short(n))) 492 ui.warn("%s: %d:%s not in manifests\n" % (f, i, hg.short(n)))
493 print len(filenodes[f].keys()), fl.count(), f
486 errors += 1 494 errors += 1
487 else: 495 else:
488 del filenodes[f][n] 496 del filenodes[f][n]
489 497
490 flr = fl.linkrev(n) 498 flr = fl.linkrev(n)