Mercurial > hg-stable
changeset 12132:8a0e5b0c0ba9
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.
author | Sune Foldager <sune.foldager@edlund.dk> |
---|---|
date | Wed, 01 Sep 2010 15:03:45 +0200 |
parents | c061f9882ff7 |
children | b6cc68ef2702 |
files | mercurial/commands.py |
diffstat | 1 files changed, 18 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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")