[PATCH v4] version: show enabled extensions (issue4209)

Augie Fackler raf at durin42.com
Tue Jul 8 22:03:28 CDT 2014


On Jul 8, 2014, at 10:35 PM, Augie Fackler <raf at durin42.com> wrote:

> 
> On Jul 4, 2014, at 4:02 AM, anatoly techtonik <techtonik at gmail.com> wrote:
> 
>> # 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 867f0469a179167b2eeb70337beafcf2ae9524d9
>> # Parent  2392b9e1936628faeec818368169a68b1fadd95f
>> version: show enabled extensions (issue4209)
> 
> Queud! I'm satisfied enough with this that I'd like to see it land now - folks should feel encouraged to send follow-ups if needed.
> 
> Thanks for bearing with us!

I neglected to mention one change I decided to make for consistency with the rest of hg: s/get_version/getversion/, but other than that I'm pushing the patch as-is.

> 
>> 
>> This code is based by hg-versions extension (GPLv2)
>> by Markus Zapke-Gruendemann <info at keimlink.de>
>> 
>> 
>> http://mercurial.selenic.com/wiki/VersionsExtension
>> 
>> diff -r 2392b9e19366 -r 867f0469a179 mercurial/commands.py
>> --- a/mercurial/commands.py	Tue Jul 01 23:32:18 2014 -0500
>> +++ b/mercurial/commands.py	Tue Jun 10 13:44:37 2014 +0300
>> @@ -14,6 +14,7 @@
>> import patch, help, encoding, templatekw, discovery
>> import archival, changegroup, cmdutil, hbisect
>> import sshserver, hgweb, commandserver
>> +import extensions
>> from hgweb import server as hgweb_server
>> import merge as mergemod
>> import minirst, revset, fileset
>> @@ -5921,6 +5922,19 @@
>>        "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
>>    ))
>> 
>> +    ui.note(_("\nEnabled extensions:\n\n"))
>> +    if ui.verbose:
>> +        # format names and versions into columns
>> +        names = []
>> +        vers = []
>> +        for name, module in extensions.extensions():
>> +            names.append(name)
>> +            vers.append(extensions.moduleversion(module))
>> +        maxnamelen = max(len(n) for n in names)
>> +        for i, name in enumerate(names):
>> +            ui.write("  %-*s  %s\n" % (maxnamelen, name, vers[i]))
>> +
>> +
>> norepo = ("clone init version help debugcommands debugcomplete"
>>          " debugdate debuginstall debugfsinfo debugpushkey debugwireargs"
>>          " debugknown debuggetbundle debugbundle")
>> diff -r 2392b9e19366 -r 867f0469a179 mercurial/extensions.py
>> --- a/mercurial/extensions.py	Tue Jul 01 23:32:18 2014 -0500
>> +++ b/mercurial/extensions.py	Tue Jun 10 13:44:37 2014 +0300
>> @@ -367,3 +367,16 @@
>>        exts[ename] = doc.splitlines()[0].strip()
>> 
>>    return exts
>> +
>> +def moduleversion(module):
>> +    '''return version information from given module as a string'''
>> +    if (util.safehasattr(module, 'get_version')
>> +          and callable(module.get_version)):
>> +        version = module.get_version()
>> +    elif util.safehasattr(module, '__version__'):
>> +        version = module.__version__
>> +    else:
>> +        version = ''
>> +    if isinstance(version, (list, tuple)):
>> +        version = '.'.join(str(o) for o in version)
>> +    return version
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at selenic.com
>> http://selenic.com/mailman/listinfo/mercurial-devel
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20140708/fd03a46d/attachment.pgp>


More information about the Mercurial-devel mailing list