[PATCH] mercurial: add debugextensions command (issue4676)

liscju piotr.listkiewicz at gmail.com
Thu Sep 10 18:25:55 UTC 2015


# HG changeset patch
# User liscju <piotr.listkiewicz at gmail.com>
# Date 1441896787 -7200
#      Thu Sep 10 16:53:07 2015 +0200
# Node ID a1d762cfc0428911f52b109d1c335a37ea24ff59
# Parent  ea489d94e1dc1fc3dc1dcbef1c86c18c49605ed1
mercurial: add debugextensions command (issue4676)

Add debugextensions command to help users debug their extension
problems. If there are no extensions command prints nothing,
otherwise it prints the table with: extension name, import source,
testedwith and buglink informations. If information about testedwith
or buglink in given module is missing it prints "-" in appropriate
column.

diff -r ea489d94e1dc -r a1d762cfc042 mercurial/commands.py
--- a/mercurial/commands.py	Sat Aug 22 17:08:37 2015 -0700
+++ b/mercurial/commands.py	Thu Sep 10 16:53:07 2015 +0200
@@ -2184,6 +2184,28 @@
     for f in ctx.getfileset(expr):
         ui.write("%s\n" % f)
 
+ at command('debugextensions', [], norepo=True)
+def debugextensions(ui):
+    exts = extensions.extensions(ui)
+    header = ["Extension name", "Import source", "Testedwith", "Buglink"]
+    rows = [header]
+    for extname, extmod in exts:
+        extsource = extmod.__file__
+        try:
+            exttestedwith = extmod.testedwith
+        except AttributeError:
+            exttestedwith = "-"
+        try:
+            extbuglink = extmod.buglink
+        except AttributeError:
+            extbuglink = "-"
+        rows.append([extname, extsource, exttestedwith, extbuglink])
+
+    if len(rows) > 1:
+        rst = minirst.maketable(rows, header=True)
+        table = ''.join(rst)
+        ui.write(table)
+
 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
 def debugfsinfo(ui, path="."):
     """show information detected about current filesystem"""
diff -r ea489d94e1dc -r a1d762cfc042 tests/test-debugextensions.t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-debugextensions.t	Thu Sep 10 16:53:07 2015 +0200
@@ -0,0 +1,21 @@
+  $ hg debugextensions
+
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > color=
+  > histedit=
+  > patchbomb=
+  > rebase=
+  > mq=
+  > EOF
+
+  $ hg debugextensions
+  ==============*=====================*==========*======= (glob)
+  Extension name*Import source        *Testedwith*Buglink (glob)
+  ==============*=====================*==========*======= (glob)
+  color          */hgext/color.pyc    *internal  *-       (glob)
+  histedit       */hgext/histedit.pyc *internal  *-       (glob)
+  patchbomb      */hgext/patchbomb.pyc*internal  *-       (glob)
+  rebase         */hgext/rebase.pyc   *internal  *-       (glob)
+  mq             */hgext/mq.pyc       *internal  *-       (glob)
+  ==============*=====================*==========*======= (glob)


More information about the Mercurial-devel mailing list