Patchwork [1,of,2] version: show enabled extensions (issue4209)

login
register
mail settings
Submitter anatoly techtonik
Date June 10, 2014, 11:57 a.m.
Message ID <bd3150aeb5949c8ca230.1402401430@BlackBox>
Download mbox | patch
Permalink /patch/4962/
State Superseded
Headers show

Comments

anatoly techtonik - June 10, 2014, 11:57 a.m.
# HG changeset patch
# User anatoly techtonik <techtonik@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

Patch

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@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")