# HG changeset patch # User mpm@selenic.com # Date 2005-05-04 18:50:21 # Node ID ffe6a5ca1a89071e08aa29a39a83db907ece2a7a # Parent 7eca4cfa8aad5fce9a04f7d8acadcd0452e2f34e Make hg verify do more thorough cross-checking. diff --git a/hg b/hg --- a/hg +++ b/hg @@ -220,19 +220,37 @@ elif cmd == "verify": nodes = {"\0"*20: 1} for i in range(fl.count()): n = fl.node(i) + if n not in filenodes[f]: print "%s:%s not in manifests" % (f, hg.hex(n)) - if fl.linkrev(n) not in filelinkrevs[f]: + else: + del filenodes[f][n] + + flr = fl.linkrev(n) + if flr not in filelinkrevs[f]: print "%s:%s points to unexpected changeset rev %d" \ % (f, hg.hex(n), fl.linkrev(n)) + else: + filelinkrevs[f].remove(flr) + + # verify contents t = fl.read(n) + + # verify parents (p1, p2) = fl.parents(n) if p1 not in nodes: print "%s:%s unknown parent 1 %s" % (f, hg.hex(n), hg.hex(p1)) if p2 not in nodes: print "file %s:%s unknown parent %s" % (f, hg.hex(n), hg.hex(p1)) + nodes[n] = 1 - nodes[n] = 1 + # cross-check + for flr in filelinkrevs[f]: + print "changeset rev %d not in %s" % (flr, f) + + for node in filenodes[f]: + print "node %s in manifests not in %s" % (hg.hex(n), f) + print "%d files, %d changesets, %d total revisions" % (files, changesets, revisions)