[PATCH] version: show enabled extensions (issue4209)

anatoly techtonik techtonik at gmail.com
Tue Jun 10 05:49:10 CDT 2014


# HG changeset patch
# User anatoly techtonik <techtonik at gmail.com>
# Date 1402397077 -10800
#      Tue Jun 10 13:44:37 2014 +0300
# Branch stable
# Node ID bd3150aeb5949c8ca2304bf52c6206730b73a8f9
# Parent  14560418856dbd2b1b5d0bf1b4ae3bceffc4eef0
version: show enabled extensions (issue4209)

Inspired by:
http://mercurial.selenic.com/wiki/VersionsExtension

diff -r 14560418856d -r bd3150aeb594 mercurial/commands.py
--- a/mercurial/commands.py	Mon May 26 19:02:11 2014 +0200
+++ b/mercurial/commands.py	Tue Jun 10 13:44:37 2014 +0300
@@ -5911,8 +5911,11 @@
 @command('version', [])
 def version_(ui):
     """output version and copyright information"""
+    # output always
     ui.write(_("Mercurial Distributed SCM (version %s)\n")
              % util.version())
+
+    # output when --quiet it not present
     ui.status(_(
         "(see http://mercurial.selenic.com for more information)\n"
         "\nCopyright (C) 2005-2014 Matt Mackall and others\n"
@@ -5921,6 +5924,16 @@
         "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
     ))
 
+    # output when --verbose flag is active
+
+    # This code is inspired by hg-versions extension (GPLv2)
+    # by Markus Zapke-Gruendemann <info at keimlink.de>
+    ui.note(_("\nEnabled extensions:\n\n"))
+    if ui.verbose:
+        for name, module in ui.configitems('extensions'):
+            ui.write("  %s\n" % name)
+
+
 norepo = ("clone init version help debugcommands debugcomplete"
           " debugdate debuginstall debugfsinfo debugpushkey debugwireargs"
           " debugknown debuggetbundle debugbundle")


More information about the Mercurial-devel mailing list