debugdata: 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.
--- a/mercurial/commands.py Wed Sep 01 12:28:34 2010 +0200
+++ b/mercurial/commands.py Wed Sep 01 14:55:03 2010 +0200
@@ -1214,9 +1214,15 @@
ui.write(line)
ui.write("\n")
-def debugdata(ui, file_, rev):
+def debugdata(ui, repo, file_, rev):
"""dump the contents of a data file revision"""
- r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_[:-2] + ".i")
+ 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_[:-2] + ".i")
try:
ui.write(r.revision(r.lookup(rev)))
except KeyError:
@@ -4476,7 +4482,8 @@
"version": (version_, []),
}
-norepo = ("clone init version help debugcommands debugcomplete debugdata"
+norepo = ("clone init version help debugcommands debugcomplete"
" debugindex debugindexdot debugdate debuginstall debugfsinfo"
" debugpushkey")
-optionalrepo = ("identify paths serve showconfig debugancestor debugdag")
+optionalrepo = ("identify paths serve showconfig debugancestor debugdag"
+ " debugdata")