# HG changeset patch # User Sune Foldager # Date 1283346225 -7200 # Node ID 8a0e5b0c0ba9ffef55ba406775055b789ac41ca2 # Parent c061f9882ff75e2dd9d2bd31903d3b1e01cd7084 debugindex(dot): try to access filelogs through repo, if possible If a repository is accesible, first treat the filename as a working copy file and try to open its filelog. Fallback to opening the file directly as a revlog, as before. diff -r c061f9882ff7 -r 8a0e5b0c0ba9 mercurial/commands.py --- a/mercurial/commands.py Wed Sep 01 14:55:03 2010 +0200 +++ b/mercurial/commands.py Wed Sep 01 15:03:45 2010 +0200 @@ -1240,9 +1240,15 @@ m = util.matchdate(range) ui.write("match: %s\n" % m(d[0])) -def debugindex(ui, file_): +def debugindex(ui, repo, file_): """dump the contents of an index file""" - r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_) + r = None + if repo: + filelog = repo.file(file_) + if len(filelog): + r = filelog + if not r: + r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_) ui.write(" rev offset length base linkrev" " nodeid p1 p2\n") for i in r: @@ -1255,9 +1261,15 @@ i, r.start(i), r.length(i), r.base(i), r.linkrev(i), short(node), short(pp[0]), short(pp[1]))) -def debugindexdot(ui, file_): +def debugindexdot(ui, repo, file_): """dump an index DAG as a graphviz dot file""" - r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_) + r = None + if repo: + filelog = repo.file(file_) + if len(filelog): + r = filelog + if not r: + r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_) ui.write("digraph G {\n") for i in r: node = r.node(i) @@ -4483,7 +4495,6 @@ } norepo = ("clone init version help debugcommands debugcomplete" - " debugindex debugindexdot debugdate debuginstall debugfsinfo" - " debugpushkey") + " debugdate debuginstall debugfsinfo debugpushkey") optionalrepo = ("identify paths serve showconfig debugancestor debugdag" - " debugdata") + " debugdata debugindex debugindexdot")