##// END OF EJS Templates
mercurial: add debugextensions command (issue4676)...
liscju -
r26351:8c7d8d5e default
parent child Browse files
Show More
@@ -0,0 +1,83 b''
1 $ hg debugextensions
2
3 $ debugpath=`pwd`/extwithoutinfos.py
4
5 $ cat > extwithoutinfos.py <<EOF
6 > EOF
7
8 $ cat >> $HGRCPATH <<EOF
9 > [extensions]
10 > color=
11 > histedit=
12 > patchbomb=
13 > rebase=
14 > mq=
15 > ext1 = $debugpath
16 > EOF
17
18 $ hg debugextensions
19 color
20 ext1 (untested!)
21 histedit
22 mq
23 patchbomb
24 rebase
25
26 $ hg debugextensions -v
27 color
28 location: */hgext/color.pyc (glob)
29 tested with: internal
30 ext1
31 location: */extwithoutinfos.pyc (glob)
32 histedit
33 location: */hgext/histedit.pyc (glob)
34 tested with: internal
35 mq
36 location: */hgext/mq.pyc (glob)
37 tested with: internal
38 patchbomb
39 location: */hgext/patchbomb.pyc (glob)
40 tested with: internal
41 rebase
42 location: */hgext/rebase.pyc (glob)
43 tested with: internal
44
45 $ hg debugextensions -Tjson
46 [
47 {
48 "buglink": "",
49 "name": "color",
50 "source": "*/hgext/color.pyc", (glob)
51 "testedwith": "internal"
52 },
53 {
54 "buglink": "",
55 "name": "ext1",
56 "source": "*/extwithoutinfos.pyc", (glob)
57 "testedwith": ""
58 },
59 {
60 "buglink": "",
61 "name": "histedit",
62 "source": "*/hgext/histedit.pyc", (glob)
63 "testedwith": "internal"
64 },
65 {
66 "buglink": "",
67 "name": "mq",
68 "source": "*/hgext/mq.pyc", (glob)
69 "testedwith": "internal"
70 },
71 {
72 "buglink": "",
73 "name": "patchbomb",
74 "source": "*/hgext/patchbomb.pyc", (glob)
75 "testedwith": "internal"
76 },
77 {
78 "buglink": "",
79 "name": "rebase",
80 "source": "*/hgext/rebase.pyc", (glob)
81 "testedwith": "internal"
82 }
83 ]
@@ -19,7 +19,7 b' from hgweb import server as hgweb_server'
19 19 import merge as mergemod
20 20 import minirst, revset, fileset
21 21 import dagparser, context, simplemerge, graphmod, copies
22 import random
22 import random, operator
23 23 import setdiscovery, treediscovery, dagutil, pvec, localrepo
24 24 import phases, obsolete, exchange, bundle2, repair, lock as lockmod
25 25 import ui as uimod
@@ -2171,6 +2171,45 b' def debugdiscovery(ui, repo, remoteurl="'
2171 2171 localrevs = opts.get('local_head')
2172 2172 doit(localrevs, remoterevs)
2173 2173
2174 @command('debugextensions', formatteropts, [], norepo=True)
2175 def debugextensions(ui, **opts):
2176 '''show information about active extensions'''
2177 exts = extensions.extensions(ui)
2178 fm = ui.formatter('debugextensions', opts)
2179 for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
2180 extsource = extmod.__file__
2181 exttestedwith = getattr(extmod, 'testedwith', None)
2182 if exttestedwith is not None:
2183 exttestedwith = exttestedwith.split()
2184 extbuglink = getattr(extmod, 'buglink', None)
2185
2186 fm.startitem()
2187
2188 if ui.quiet or ui.verbose:
2189 fm.write('name', '%s\n', extname)
2190 else:
2191 fm.write('name', '%s', extname)
2192 if not exttestedwith:
2193 fm.plain(_(' (untested!)\n'))
2194 else:
2195 if exttestedwith == ['internal'] or \
2196 util.version() in exttestedwith:
2197 fm.plain('\n')
2198 else:
2199 lasttestedversion = exttestedwith[-1]
2200 fm.plain(' (%s!)\n' % lasttestedversion)
2201
2202 fm.condwrite(ui.verbose and extsource, 'source',
2203 _(' location: %s\n'), extsource or "")
2204
2205 fm.condwrite(ui.verbose and exttestedwith, 'testedwith',
2206 _(' tested with: %s\n'), ' '.join(exttestedwith or []))
2207
2208 fm.condwrite(ui.verbose and extbuglink, 'buglink',
2209 _(' bug reporting: %s\n'), extbuglink or "")
2210
2211 fm.end()
2212
2174 2213 @command('debugfileset',
2175 2214 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
2176 2215 _('[-r REV] FILESPEC'))
@@ -80,6 +80,7 b' Show debug commands if there are no othe'
80 80 debugdate
81 81 debugdirstate
82 82 debugdiscovery
83 debugextensions
83 84 debugfileset
84 85 debugfsinfo
85 86 debuggetbundle
@@ -239,6 +240,7 b' Show all commands + options'
239 240 debugdate: extended
240 241 debugdirstate: nodates, datesort
241 242 debugdiscovery: old, nonheads, ssh, remotecmd, insecure
243 debugextensions: template
242 244 debugfileset: rev
243 245 debugfsinfo:
244 246 debuggetbundle: head, common, type
@@ -287,17 +287,23 b' hide outer repo'
287 287 $ echo "debugextension = $debugpath" >> $HGRCPATH
288 288
289 289 $ hg help debugextension
290 debugextension extension - only debugcommands
290 hg debugextensions
291
292 show information about active extensions
291 293
292 no commands defined
294 options:
295
296 (some details hidden, use --verbose to show complete help)
293 297
294 298
295 299 $ hg --verbose help debugextension
296 debugextension extension - only debugcommands
300 hg debugextensions
301
302 show information about active extensions
297 303
298 list of commands:
304 options:
299 305
300 foo yet another foo command
306 -T --template TEMPLATE display with template (EXPERIMENTAL)
301 307
302 308 global options ([+] can be repeated):
303 309
@@ -326,12 +332,13 b' hide outer repo'
326 332
327 333
328 334 $ hg --debug help debugextension
329 debugextension extension - only debugcommands
335 hg debugextensions
336
337 show information about active extensions
330 338
331 list of commands:
339 options:
332 340
333 debugfoobar yet another debug command
334 foo yet another foo command
341 -T --template TEMPLATE display with template (EXPERIMENTAL)
335 342
336 343 global options ([+] can be repeated):
337 344
@@ -545,20 +552,7 b' Test help topic with same name as extens'
545 552
546 553 Issue811: Problem loading extensions twice (by site and by user)
547 554
548 $ debugpath=`pwd`/debugissue811.py
549 $ cat > debugissue811.py <<EOF
550 > '''show all loaded extensions
551 > '''
552 > from mercurial import cmdutil, commands, extensions
553 > cmdtable = {}
554 > command = cmdutil.command(cmdtable)
555 > @command('debugextensions', [], 'hg debugextensions', norepo=True)
556 > def debugextensions(ui):
557 > "yet another debug command"
558 > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()]))
559 > EOF
560 555 $ cat <<EOF >> $HGRCPATH
561 > debugissue811 = $debugpath
562 556 > mq =
563 557 > strip =
564 558 > hgext.mq =
@@ -569,9 +563,8 b' Show extensions:'
569 563 (note that mq force load strip, also checking it's not loaded twice)
570 564
571 565 $ hg debugextensions
572 debugissue811
566 mq
573 567 strip
574 mq
575 568
576 569 For extensions, which name matches one of its commands, help
577 570 message should ask '-v -e' to get list of built-in aliases
@@ -775,6 +775,8 b' Test list of internal help commands'
775 775 show the contents of the current dirstate
776 776 debugdiscovery
777 777 runs the changeset discovery protocol in isolation
778 debugextensions
779 show information about active extensions
778 780 debugfileset parse and apply a fileset specification
779 781 debugfsinfo show information detected about current filesystem
780 782 debuggetbundle
General Comments 0
You need to be logged in to leave comments. Login now