diff --git a/remotefilelog/debugcommands.py b/remotefilelog/debugcommands.py --- a/remotefilelog/debugcommands.py +++ b/remotefilelog/debugcommands.py @@ -215,7 +215,6 @@ hashformatter = short hashlen = 14 - lastfilename = None totaldeltasize = 0 totalblobsize = 0 def printtotals(): @@ -233,6 +232,9 @@ deltastr )) + lastfilename = None + seennodes = {nullid: True} + failures = 0 for filename, node, deltabase, deltalen in dpack.iterentries(): if filename != lastfilename: printtotals() @@ -246,6 +248,7 @@ lastfilename = filename totalblobsize = 0 totaldeltasize = 0 + # Metadata could be missing, in which case it will be an empty dict. meta = dpack.getmeta(filename, node) if constants.METAKEYSIZE in meta: @@ -259,8 +262,19 @@ hashformatter(deltabase), str(deltalen).ljust(14), blobsize)) + + # The only integrity constraint is that all deltabases must exist + # earlier in the pack. + if not deltabase in seennodes: + ui.warn("^ BAD ENTRY - unknown delta base of %s\n" % + short(deltabase)) + failures += 1 + seennodes[node] = True if filename is not None: printtotals() + if failures > 1: + ui.warn("\n%d invalid entries\n" % failures) + return 1 def dumpdeltachain(ui, deltachain, **opts): hashformatter = hex