commands.debugindexdot: use cmdutil.openrevlog()
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 05 Dec 2015 21:40:38 -0800
changeset 27256 45124eaab4e2
parent 27255 5606f7d0d063
child 27257 49a76d3d43b1
commands.debugindexdot: use cmdutil.openrevlog() This pattern is used for all the other debug* commands that operate on revlogs. debugindexdot is an outlier. Make it conform.
mercurial/commands.py
tests/test-completion.t
--- a/mercurial/commands.py	Sat Dec 05 21:47:39 2015 -0800
+++ b/mercurial/commands.py	Sat Dec 05 21:40:38 2015 -0800
@@ -2487,16 +2487,11 @@
                     i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
                     base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
 
-@command('debugindexdot', [], _('FILE'), optionalrepo=True)
-def debugindexdot(ui, repo, file_):
+@command('debugindexdot', debugrevlogopts,
+    _('-c|-m|FILE'), optionalrepo=True)
+def debugindexdot(ui, repo, file_=None, **opts):
     """dump an index DAG as a graphviz dot file"""
-    r = None
-    if repo:
-        filelog = repo.file(file_)
-        if len(filelog):
-            r = filelog
-    if not r:
-        r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_)
+    r = cmdutil.openrevlog(repo, 'debugindexdot', file_, opts)
     ui.write(("digraph G {\n"))
     for i in r:
         node = r.node(i)
--- a/tests/test-completion.t	Sat Dec 05 21:47:39 2015 -0800
+++ b/tests/test-completion.t	Sat Dec 05 21:40:38 2015 -0800
@@ -251,7 +251,7 @@
   debuggetbundle: head, common, type
   debugignore: 
   debugindex: changelog, manifest, dir, format
-  debugindexdot: 
+  debugindexdot: changelog, manifest, dir
   debuginstall: 
   debugknown: 
   debuglabelcomplete: