comparison mercurial/debugcommands.py @ 30518:a8b17859684a

debugcommands: move 'debugextensions' to the new module
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 17 Aug 2016 20:57:15 -0700
parents a3ec6db36315
children 20a42325fdef
comparison
equal deleted inserted replaced
30517:a3ec6db36315 30518:a8b17859684a
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 from __future__ import absolute_import 8 from __future__ import absolute_import
9 9
10 import operator
10 import os 11 import os
11 import random 12 import random
12 13
13 from .i18n import _ 14 from .i18n import _
14 from .node import ( 15 from .node import (
23 context, 24 context,
24 dagparser, 25 dagparser,
25 dagutil, 26 dagutil,
26 error, 27 error,
27 exchange, 28 exchange,
29 extensions,
28 hg, 30 hg,
29 localrepo, 31 localrepo,
30 lock as lockmod, 32 lock as lockmod,
31 revlog, 33 revlog,
32 scmutil, 34 scmutil,
521 else: 523 else:
522 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, 524 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches,
523 opts.get('remote_head')) 525 opts.get('remote_head'))
524 localrevs = opts.get('local_head') 526 localrevs = opts.get('local_head')
525 doit(localrevs, remoterevs) 527 doit(localrevs, remoterevs)
528
529 @command('debugextensions', commands.formatteropts, [], norepo=True)
530 def debugextensions(ui, **opts):
531 '''show information about active extensions'''
532 exts = extensions.extensions(ui)
533 hgver = util.version()
534 fm = ui.formatter('debugextensions', opts)
535 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
536 isinternal = extensions.ismoduleinternal(extmod)
537 extsource = extmod.__file__
538 if isinternal:
539 exttestedwith = [] # never expose magic string to users
540 else:
541 exttestedwith = getattr(extmod, 'testedwith', '').split()
542 extbuglink = getattr(extmod, 'buglink', None)
543
544 fm.startitem()
545
546 if ui.quiet or ui.verbose:
547 fm.write('name', '%s\n', extname)
548 else:
549 fm.write('name', '%s', extname)
550 if isinternal or hgver in exttestedwith:
551 fm.plain('\n')
552 elif not exttestedwith:
553 fm.plain(_(' (untested!)\n'))
554 else:
555 lasttestedversion = exttestedwith[-1]
556 fm.plain(' (%s!)\n' % lasttestedversion)
557
558 fm.condwrite(ui.verbose and extsource, 'source',
559 _(' location: %s\n'), extsource or "")
560
561 if ui.verbose:
562 fm.plain(_(' bundled: %s\n') % ['no', 'yes'][isinternal])
563 fm.data(bundled=isinternal)
564
565 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
566 _(' tested with: %s\n'),
567 fm.formatlist(exttestedwith, name='ver'))
568
569 fm.condwrite(ui.verbose and extbuglink, 'buglink',
570 _(' bug reporting: %s\n'), extbuglink or "")
571
572 fm.end()