Show More
@@ -6,12 +6,12 b' import code' | |||||
6 | import mercurial |
|
6 | import mercurial | |
7 | import sys |
|
7 | import sys | |
8 | from mercurial import ( |
|
8 | from mercurial import ( | |
9 | cmdutil, |
|
|||
10 | demandimport, |
|
9 | demandimport, | |
|
10 | registrar, | |||
11 | ) |
|
11 | ) | |
12 |
|
12 | |||
13 | cmdtable = {} |
|
13 | cmdtable = {} | |
14 |
command = |
|
14 | command = registrar.command(cmdtable) | |
15 |
|
15 | |||
16 | def pdb(ui, repo, msg, **opts): |
|
16 | def pdb(ui, repo, msg, **opts): | |
17 | objects = { |
|
17 | objects = { |
@@ -49,6 +49,11 b' try:' | |||||
49 | except ImportError: |
|
49 | except ImportError: | |
50 | pass |
|
50 | pass | |
51 | try: |
|
51 | try: | |
|
52 | from mercurial import registrar # since 3.7 (or 37d50250b696) | |||
|
53 | dir(registrar) # forcibly load it | |||
|
54 | except ImportError: | |||
|
55 | registrar = None | |||
|
56 | try: | |||
52 | from mercurial import repoview # since 2.5 (or 3a6ddacb7198) |
|
57 | from mercurial import repoview # since 2.5 (or 3a6ddacb7198) | |
53 | except ImportError: |
|
58 | except ImportError: | |
54 | pass |
|
59 | pass | |
@@ -101,7 +106,9 b' cmdtable = {}' | |||||
101 | def parsealiases(cmd): |
|
106 | def parsealiases(cmd): | |
102 | return cmd.lstrip("^").split("|") |
|
107 | return cmd.lstrip("^").split("|") | |
103 |
|
108 | |||
104 |
if safehasattr( |
|
109 | if safehasattr(registrar, 'command'): | |
|
110 | command = registrar.command(cmdtable) | |||
|
111 | elif safehasattr(cmdutil, 'command'): | |||
105 | import inspect |
|
112 | import inspect | |
106 | command = cmdutil.command(cmdtable) |
|
113 | command = cmdutil.command(cmdtable) | |
107 | if 'norepo' not in inspect.getargspec(command)[0]: |
|
114 | if 'norepo' not in inspect.getargspec(command)[0]: |
@@ -53,11 +53,11 b' from mercurial.node import (' | |||||
53 | short, |
|
53 | short, | |
54 | ) |
|
54 | ) | |
55 | from mercurial import ( |
|
55 | from mercurial import ( | |
56 | cmdutil, |
|
|||
57 | context, |
|
56 | context, | |
58 | error, |
|
57 | error, | |
59 | hg, |
|
58 | hg, | |
60 | patch, |
|
59 | patch, | |
|
60 | registrar, | |||
61 | scmutil, |
|
61 | scmutil, | |
62 | util, |
|
62 | util, | |
63 | ) |
|
63 | ) | |
@@ -69,7 +69,7 b' from mercurial import (' | |||||
69 | testedwith = 'ships-with-hg-core' |
|
69 | testedwith = 'ships-with-hg-core' | |
70 |
|
70 | |||
71 | cmdtable = {} |
|
71 | cmdtable = {} | |
72 |
command = |
|
72 | command = registrar.command(cmdtable) | |
73 |
|
73 | |||
74 | newfile = {'new fi', 'rename', 'copy f', 'copy t'} |
|
74 | newfile = {'new fi', 'rename', 'copy f', 'copy t'} | |
75 |
|
75 |
@@ -44,13 +44,13 b' from mercurial.i18n import _' | |||||
44 | from mercurial.node import hex |
|
44 | from mercurial.node import hex | |
45 |
|
45 | |||
46 | from mercurial import ( |
|
46 | from mercurial import ( | |
47 | cmdutil, |
|
47 | registrar, | |
48 | ui as uimod, |
|
48 | ui as uimod, | |
49 | util, |
|
49 | util, | |
50 | ) |
|
50 | ) | |
51 |
|
51 | |||
52 | cmdtable = {} |
|
52 | cmdtable = {} | |
53 |
command = |
|
53 | command = registrar.command(cmdtable) | |
54 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
54 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
55 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
55 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
56 | # be specifying the version(s) of Mercurial they are tested with, or |
|
56 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -31,17 +31,17 b' from mercurial.i18n import _' | |||||
31 | from mercurial.node import short |
|
31 | from mercurial.node import short | |
32 |
|
32 | |||
33 | from mercurial import ( |
|
33 | from mercurial import ( | |
34 | cmdutil, |
|
|||
35 | error, |
|
34 | error, | |
36 | filelog, |
|
35 | filelog, | |
37 | lock as lockmod, |
|
36 | lock as lockmod, | |
|
37 | registrar, | |||
38 | revlog, |
|
38 | revlog, | |
39 | scmutil, |
|
39 | scmutil, | |
40 | util, |
|
40 | util, | |
41 | ) |
|
41 | ) | |
42 |
|
42 | |||
43 | cmdtable = {} |
|
43 | cmdtable = {} | |
44 |
command = |
|
44 | command = registrar.command(cmdtable) | |
45 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
45 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
46 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
46 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
47 | # be specifying the version(s) of Mercurial they are tested with, or |
|
47 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -20,12 +20,13 b' from mercurial.i18n import _' | |||||
20 | from mercurial import ( |
|
20 | from mercurial import ( | |
21 | cmdutil, |
|
21 | cmdutil, | |
22 | commands, |
|
22 | commands, | |
|
23 | registrar, | |||
23 | ) |
|
24 | ) | |
24 |
|
25 | |||
25 | templateopts = commands.templateopts |
|
26 | templateopts = commands.templateopts | |
26 |
|
27 | |||
27 | cmdtable = {} |
|
28 | cmdtable = {} | |
28 |
command = |
|
29 | command = registrar.command(cmdtable) | |
29 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
30 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
30 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
31 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
31 | # be specifying the version(s) of Mercurial they are tested with, or |
|
32 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -20,12 +20,13 b' from mercurial import (' | |||||
20 | commands, |
|
20 | commands, | |
21 | encoding, |
|
21 | encoding, | |
22 | patch, |
|
22 | patch, | |
|
23 | registrar, | |||
23 | scmutil, |
|
24 | scmutil, | |
24 | util, |
|
25 | util, | |
25 | ) |
|
26 | ) | |
26 |
|
27 | |||
27 | cmdtable = {} |
|
28 | cmdtable = {} | |
28 |
command = |
|
29 | command = registrar.command(cmdtable) | |
29 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
30 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
30 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
31 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
31 | # be specifying the version(s) of Mercurial they are tested with, or |
|
32 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -11,7 +11,6 b' from __future__ import absolute_import' | |||||
11 |
|
11 | |||
12 | from mercurial.i18n import _ |
|
12 | from mercurial.i18n import _ | |
13 | from mercurial import ( |
|
13 | from mercurial import ( | |
14 | cmdutil, |
|
|||
15 | registrar, |
|
14 | registrar, | |
16 | ) |
|
15 | ) | |
17 |
|
16 | |||
@@ -22,7 +21,7 b' from . import (' | |||||
22 | ) |
|
21 | ) | |
23 |
|
22 | |||
24 | cmdtable = {} |
|
23 | cmdtable = {} | |
25 |
command = |
|
24 | command = registrar.command(cmdtable) | |
26 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
25 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
27 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
26 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
28 | # be specifying the version(s) of Mercurial they are tested with, or |
|
27 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -78,12 +78,13 b' from mercurial import (' | |||||
78 | error, |
|
78 | error, | |
79 | filemerge, |
|
79 | filemerge, | |
80 | pycompat, |
|
80 | pycompat, | |
|
81 | registrar, | |||
81 | scmutil, |
|
82 | scmutil, | |
82 | util, |
|
83 | util, | |
83 | ) |
|
84 | ) | |
84 |
|
85 | |||
85 | cmdtable = {} |
|
86 | cmdtable = {} | |
86 |
command = |
|
87 | command = registrar.command(cmdtable) | |
87 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
88 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
88 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
89 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
89 | # be specifying the version(s) of Mercurial they are tested with, or |
|
90 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -20,12 +20,13 b' from mercurial import (' | |||||
20 | exchange, |
|
20 | exchange, | |
21 | hg, |
|
21 | hg, | |
22 | lock, |
|
22 | lock, | |
|
23 | registrar, | |||
23 | util, |
|
24 | util, | |
24 | ) |
|
25 | ) | |
25 |
|
26 | |||
26 | release = lock.release |
|
27 | release = lock.release | |
27 | cmdtable = {} |
|
28 | cmdtable = {} | |
28 |
command = |
|
29 | command = registrar.command(cmdtable) | |
29 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
30 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
30 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
31 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
31 | # be specifying the version(s) of Mercurial they are tested with, or |
|
32 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -19,11 +19,12 b' from mercurial import (' | |||||
19 | match, |
|
19 | match, | |
20 | node as hgnode, |
|
20 | node as hgnode, | |
21 | pycompat, |
|
21 | pycompat, | |
|
22 | registrar, | |||
22 | util, |
|
23 | util, | |
23 | ) |
|
24 | ) | |
24 |
|
25 | |||
25 | cmdtable = {} |
|
26 | cmdtable = {} | |
26 |
command = |
|
27 | command = registrar.command(cmdtable) | |
27 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
28 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
28 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
29 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
29 | # be specifying the version(s) of Mercurial they are tested with, or |
|
30 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -19,12 +19,12 b' from __future__ import absolute_import' | |||||
19 |
|
19 | |||
20 | from mercurial.i18n import _ |
|
20 | from mercurial.i18n import _ | |
21 | from mercurial import ( |
|
21 | from mercurial import ( | |
22 | cmdutil, |
|
|||
23 | commands, |
|
22 | commands, | |
|
23 | registrar, | |||
24 | ) |
|
24 | ) | |
25 |
|
25 | |||
26 | cmdtable = {} |
|
26 | cmdtable = {} | |
27 |
command = |
|
27 | command = registrar.command(cmdtable) | |
28 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
28 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
29 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
29 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
30 | # be specifying the version(s) of Mercurial they are tested with, or |
|
30 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -45,15 +45,15 b' from mercurial.node import (' | |||||
45 | short, |
|
45 | short, | |
46 | ) |
|
46 | ) | |
47 | from mercurial import ( |
|
47 | from mercurial import ( | |
48 | cmdutil, |
|
|||
49 | commands, |
|
48 | commands, | |
50 | obsolete, |
|
49 | obsolete, | |
51 | patch, |
|
50 | patch, | |
|
51 | registrar, | |||
52 | scmutil, |
|
52 | scmutil, | |
53 | ) |
|
53 | ) | |
54 |
|
54 | |||
55 | cmdtable = {} |
|
55 | cmdtable = {} | |
56 |
command = |
|
56 | command = registrar.command(cmdtable) | |
57 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
57 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
58 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
58 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
59 | # be specifying the version(s) of Mercurial they are tested with, or |
|
59 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -201,6 +201,7 b' from mercurial import (' | |||||
201 | mergeutil, |
|
201 | mergeutil, | |
202 | node, |
|
202 | node, | |
203 | obsolete, |
|
203 | obsolete, | |
|
204 | registrar, | |||
204 | repair, |
|
205 | repair, | |
205 | scmutil, |
|
206 | scmutil, | |
206 | util, |
|
207 | util, | |
@@ -209,7 +210,7 b' from mercurial import (' | |||||
209 | pickle = util.pickle |
|
210 | pickle = util.pickle | |
210 | release = lock.release |
|
211 | release = lock.release | |
211 | cmdtable = {} |
|
212 | cmdtable = {} | |
212 |
command = |
|
213 | command = registrar.command(cmdtable) | |
213 |
|
214 | |||
214 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
215 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
215 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
216 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
@@ -31,13 +31,14 b' from mercurial import (' | |||||
31 | localrepo, |
|
31 | localrepo, | |
32 | lock, |
|
32 | lock, | |
33 | node, |
|
33 | node, | |
|
34 | registrar, | |||
34 | util, |
|
35 | util, | |
35 | ) |
|
36 | ) | |
36 |
|
37 | |||
37 | from . import share |
|
38 | from . import share | |
38 |
|
39 | |||
39 | cmdtable = {} |
|
40 | cmdtable = {} | |
40 |
command = |
|
41 | command = registrar.command(cmdtable) | |
41 |
|
42 | |||
42 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
43 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
43 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
44 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
@@ -111,7 +111,7 b' from mercurial import (' | |||||
111 | ) |
|
111 | ) | |
112 |
|
112 | |||
113 | cmdtable = {} |
|
113 | cmdtable = {} | |
114 |
command = |
|
114 | command = registrar.command(cmdtable) | |
115 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
115 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
116 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
116 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
117 | # be specifying the version(s) of Mercurial they are tested with, or |
|
117 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -25,6 +25,7 b' from mercurial import (' | |||||
25 | lock, |
|
25 | lock, | |
26 | match as matchmod, |
|
26 | match as matchmod, | |
27 | node, |
|
27 | node, | |
|
28 | registrar, | |||
28 | scmutil, |
|
29 | scmutil, | |
29 | util, |
|
30 | util, | |
30 | ) |
|
31 | ) | |
@@ -44,7 +45,7 b' release = lock.release' | |||||
44 | # -- Commands ---------------------------------------------------------- |
|
45 | # -- Commands ---------------------------------------------------------- | |
45 |
|
46 | |||
46 | cmdtable = {} |
|
47 | cmdtable = {} | |
47 |
command = |
|
48 | command = registrar.command(cmdtable) | |
48 |
|
49 | |||
49 | @command('lfconvert', |
|
50 | @command('lfconvert', | |
50 | [('s', 'size', '', |
|
51 | [('s', 'size', '', |
@@ -101,7 +101,7 b' release = lockmod.release' | |||||
101 | seriesopts = [('s', 'summary', None, _('print first line of patch header'))] |
|
101 | seriesopts = [('s', 'summary', None, _('print first line of patch header'))] | |
102 |
|
102 | |||
103 | cmdtable = {} |
|
103 | cmdtable = {} | |
104 |
command = |
|
104 | command = registrar.command(cmdtable) | |
105 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
105 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
106 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
106 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
107 | # be specifying the version(s) of Mercurial they are tested with, or |
|
107 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -89,6 +89,7 b' from mercurial import (' | |||||
89 | mail, |
|
89 | mail, | |
90 | node as nodemod, |
|
90 | node as nodemod, | |
91 | patch, |
|
91 | patch, | |
|
92 | registrar, | |||
92 | scmutil, |
|
93 | scmutil, | |
93 | templater, |
|
94 | templater, | |
94 | util, |
|
95 | util, | |
@@ -96,7 +97,7 b' from mercurial import (' | |||||
96 | stringio = util.stringio |
|
97 | stringio = util.stringio | |
97 |
|
98 | |||
98 | cmdtable = {} |
|
99 | cmdtable = {} | |
99 |
command = |
|
100 | command = registrar.command(cmdtable) | |
100 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
101 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
101 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
102 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
102 | # be specifying the version(s) of Mercurial they are tested with, or |
|
103 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -29,15 +29,15 b' import os' | |||||
29 |
|
29 | |||
30 | from mercurial.i18n import _ |
|
30 | from mercurial.i18n import _ | |
31 | from mercurial import ( |
|
31 | from mercurial import ( | |
32 | cmdutil, |
|
|||
33 | commands, |
|
32 | commands, | |
34 | error, |
|
33 | error, | |
|
34 | registrar, | |||
35 | scmutil, |
|
35 | scmutil, | |
36 | util, |
|
36 | util, | |
37 | ) |
|
37 | ) | |
38 |
|
38 | |||
39 | cmdtable = {} |
|
39 | cmdtable = {} | |
40 |
command = |
|
40 | command = registrar.command(cmdtable) | |
41 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
41 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
42 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
42 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
43 | # be specifying the version(s) of Mercurial they are tested with, or |
|
43 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -68,7 +68,7 b' revpruned = -5' | |||||
68 | revskipped = (revignored, revprecursor, revpruned) |
|
68 | revskipped = (revignored, revprecursor, revpruned) | |
69 |
|
69 | |||
70 | cmdtable = {} |
|
70 | cmdtable = {} | |
71 |
command = |
|
71 | command = registrar.command(cmdtable) | |
72 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
72 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
73 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
73 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
74 | # be specifying the version(s) of Mercurial they are tested with, or |
|
74 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -18,10 +18,11 b' from mercurial import (' | |||||
18 | commands, |
|
18 | commands, | |
19 | error, |
|
19 | error, | |
20 | extensions, |
|
20 | extensions, | |
|
21 | registrar, | |||
21 | ) |
|
22 | ) | |
22 |
|
23 | |||
23 | cmdtable = {} |
|
24 | cmdtable = {} | |
24 |
command = |
|
25 | command = registrar.command(cmdtable) | |
25 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
26 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
26 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
27 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
27 | # be specifying the version(s) of Mercurial they are tested with, or |
|
28 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -13,14 +13,14 b' import stat' | |||||
13 |
|
13 | |||
14 | from mercurial.i18n import _ |
|
14 | from mercurial.i18n import _ | |
15 | from mercurial import ( |
|
15 | from mercurial import ( | |
16 | cmdutil, |
|
|||
17 | error, |
|
16 | error, | |
18 | hg, |
|
17 | hg, | |
|
18 | registrar, | |||
19 | util, |
|
19 | util, | |
20 | ) |
|
20 | ) | |
21 |
|
21 | |||
22 | cmdtable = {} |
|
22 | cmdtable = {} | |
23 |
command = |
|
23 | command = registrar.command(cmdtable) | |
24 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
24 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
25 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
25 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
26 | # be specifying the version(s) of Mercurial they are tested with, or |
|
26 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -46,17 +46,17 b' import re' | |||||
46 |
|
46 | |||
47 | from mercurial.i18n import _ |
|
47 | from mercurial.i18n import _ | |
48 | from mercurial import ( |
|
48 | from mercurial import ( | |
49 | cmdutil, |
|
|||
50 | error, |
|
49 | error, | |
51 | extensions, |
|
50 | extensions, | |
52 | hg, |
|
51 | hg, | |
53 | pycompat, |
|
52 | pycompat, | |
|
53 | registrar, | |||
54 | templater, |
|
54 | templater, | |
55 | util, |
|
55 | util, | |
56 | ) |
|
56 | ) | |
57 |
|
57 | |||
58 | cmdtable = {} |
|
58 | cmdtable = {} | |
59 |
command = |
|
59 | command = registrar.command(cmdtable) | |
60 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
60 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
61 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
61 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
62 | # be specifying the version(s) of Mercurial they are tested with, or |
|
62 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -43,11 +43,11 b' import errno' | |||||
43 | from mercurial.i18n import _ |
|
43 | from mercurial.i18n import _ | |
44 | from mercurial import ( |
|
44 | from mercurial import ( | |
45 | bookmarks, |
|
45 | bookmarks, | |
46 | cmdutil, |
|
|||
47 | commands, |
|
46 | commands, | |
48 | error, |
|
47 | error, | |
49 | extensions, |
|
48 | extensions, | |
50 | hg, |
|
49 | hg, | |
|
50 | registrar, | |||
51 | txnutil, |
|
51 | txnutil, | |
52 | util, |
|
52 | util, | |
53 | ) |
|
53 | ) | |
@@ -56,7 +56,7 b' repository = hg.repository' | |||||
56 | parseurl = hg.parseurl |
|
56 | parseurl = hg.parseurl | |
57 |
|
57 | |||
58 | cmdtable = {} |
|
58 | cmdtable = {} | |
59 |
command = |
|
59 | command = registrar.command(cmdtable) | |
60 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
60 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
61 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
61 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
62 | # be specifying the version(s) of Mercurial they are tested with, or |
|
62 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -43,6 +43,7 b' from mercurial import (' | |||||
43 | node as nodemod, |
|
43 | node as nodemod, | |
44 | patch, |
|
44 | patch, | |
45 | phases, |
|
45 | phases, | |
|
46 | registrar, | |||
46 | repair, |
|
47 | repair, | |
47 | scmutil, |
|
48 | scmutil, | |
48 | templatefilters, |
|
49 | templatefilters, | |
@@ -55,7 +56,7 b' from . import (' | |||||
55 | ) |
|
56 | ) | |
56 |
|
57 | |||
57 | cmdtable = {} |
|
58 | cmdtable = {} | |
58 |
command = |
|
59 | command = registrar.command(cmdtable) | |
59 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
60 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
60 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
61 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
61 | # be specifying the version(s) of Mercurial they are tested with, or |
|
62 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -34,7 +34,7 b' from mercurial import (' | |||||
34 | testedwith = 'ships-with-hg-core' |
|
34 | testedwith = 'ships-with-hg-core' | |
35 |
|
35 | |||
36 | cmdtable = {} |
|
36 | cmdtable = {} | |
37 |
command = |
|
37 | command = registrar.command(cmdtable) | |
38 | revsetpredicate = registrar.revsetpredicate() |
|
38 | revsetpredicate = registrar.revsetpredicate() | |
39 |
|
39 | |||
40 | class showcmdfunc(registrar._funcregistrarbase): |
|
40 | class showcmdfunc(registrar._funcregistrarbase): |
@@ -14,6 +14,7 b' from mercurial import (' | |||||
14 | lock as lockmod, |
|
14 | lock as lockmod, | |
15 | merge, |
|
15 | merge, | |
16 | node as nodemod, |
|
16 | node as nodemod, | |
|
17 | registrar, | |||
17 | repair, |
|
18 | repair, | |
18 | scmutil, |
|
19 | scmutil, | |
19 | util, |
|
20 | util, | |
@@ -22,7 +23,7 b' nullid = nodemod.nullid' | |||||
22 | release = lockmod.release |
|
23 | release = lockmod.release | |
23 |
|
24 | |||
24 | cmdtable = {} |
|
25 | cmdtable = {} | |
25 |
command = |
|
26 | command = registrar.command(cmdtable) | |
26 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
27 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
27 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
28 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
28 | # be specifying the version(s) of Mercurial they are tested with, or |
|
29 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -42,7 +42,7 b' class TransplantError(error.Abort):' | |||||
42 | pass |
|
42 | pass | |
43 |
|
43 | |||
44 | cmdtable = {} |
|
44 | cmdtable = {} | |
45 |
command = |
|
45 | command = registrar.command(cmdtable) | |
46 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
46 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
47 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
47 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
48 | # be specifying the version(s) of Mercurial they are tested with, or |
|
48 | # be specifying the version(s) of Mercurial they are tested with, or |
@@ -38,6 +38,7 b' from . import (' | |||||
38 | pathutil, |
|
38 | pathutil, | |
39 | phases, |
|
39 | phases, | |
40 | pycompat, |
|
40 | pycompat, | |
|
41 | registrar, | |||
41 | repair, |
|
42 | repair, | |
42 | revlog, |
|
43 | revlog, | |
43 | revset, |
|
44 | revset, | |
@@ -3334,50 +3335,7 b' def _performrevert(repo, parents, ctx, a' | |||||
3334 | if f in copied: |
|
3335 | if f in copied: | |
3335 | repo.dirstate.copy(copied[f], f) |
|
3336 | repo.dirstate.copy(copied[f], f) | |
3336 |
|
3337 | |||
3337 | def command(table): |
|
3338 | command = registrar.command | |
3338 | """Returns a function object to be used as a decorator for making commands. |
|
|||
3339 |
|
||||
3340 | This function receives a command table as its argument. The table should |
|
|||
3341 | be a dict. |
|
|||
3342 |
|
||||
3343 | The returned function can be used as a decorator for adding commands |
|
|||
3344 | to that command table. This function accepts multiple arguments to define |
|
|||
3345 | a command. |
|
|||
3346 |
|
||||
3347 | The first argument is the command name. |
|
|||
3348 |
|
||||
3349 | The options argument is an iterable of tuples defining command arguments. |
|
|||
3350 | See ``mercurial.fancyopts.fancyopts()`` for the format of each tuple. |
|
|||
3351 |
|
||||
3352 | The synopsis argument defines a short, one line summary of how to use the |
|
|||
3353 | command. This shows up in the help output. |
|
|||
3354 |
|
||||
3355 | The norepo argument defines whether the command does not require a |
|
|||
3356 | local repository. Most commands operate against a repository, thus the |
|
|||
3357 | default is False. |
|
|||
3358 |
|
||||
3359 | The optionalrepo argument defines whether the command optionally requires |
|
|||
3360 | a local repository. |
|
|||
3361 |
|
||||
3362 | The inferrepo argument defines whether to try to find a repository from the |
|
|||
3363 | command line arguments. If True, arguments will be examined for potential |
|
|||
3364 | repository locations. See ``findrepo()``. If a repository is found, it |
|
|||
3365 | will be used. |
|
|||
3366 | """ |
|
|||
3367 | def cmd(name, options=(), synopsis=None, norepo=False, optionalrepo=False, |
|
|||
3368 | inferrepo=False): |
|
|||
3369 | def decorator(func): |
|
|||
3370 | func.norepo = norepo |
|
|||
3371 | func.optionalrepo = optionalrepo |
|
|||
3372 | func.inferrepo = inferrepo |
|
|||
3373 | if synopsis: |
|
|||
3374 | table[name] = func, list(options), synopsis |
|
|||
3375 | else: |
|
|||
3376 | table[name] = func, list(options) |
|
|||
3377 | return func |
|
|||
3378 | return decorator |
|
|||
3379 |
|
||||
3380 | return cmd |
|
|||
3381 |
|
3339 | |||
3382 | # a list of (ui, repo, otherpeer, opts, missing) functions called by |
|
3340 | # a list of (ui, repo, otherpeer, opts, missing) functions called by | |
3383 | # commands.outgoing. "missing" is "missing" of the result of |
|
3341 | # commands.outgoing. "missing" is "missing" of the result of |
@@ -44,6 +44,7 b' from . import (' | |||||
44 | phases, |
|
44 | phases, | |
45 | pycompat, |
|
45 | pycompat, | |
46 | rcutil, |
|
46 | rcutil, | |
|
47 | registrar, | |||
47 | revsetlang, |
|
48 | revsetlang, | |
48 | scmutil, |
|
49 | scmutil, | |
49 | server, |
|
50 | server, | |
@@ -59,7 +60,7 b' release = lockmod.release' | |||||
59 |
|
60 | |||
60 | table = {} |
|
61 | table = {} | |
61 |
|
62 | |||
62 |
command = |
|
63 | command = registrar.command(table) | |
63 |
|
64 | |||
64 | # label constants |
|
65 | # label constants | |
65 | # until 3.5, bookmarks.current was the advertised name, not |
|
66 | # until 3.5, bookmarks.current was the advertised name, not |
@@ -51,6 +51,7 b' from . import (' | |||||
51 | policy, |
|
51 | policy, | |
52 | pvec, |
|
52 | pvec, | |
53 | pycompat, |
|
53 | pycompat, | |
|
54 | registrar, | |||
54 | repair, |
|
55 | repair, | |
55 | revlog, |
|
56 | revlog, | |
56 | revset, |
|
57 | revset, | |
@@ -72,7 +73,7 b' release = lockmod.release' | |||||
72 |
|
73 | |||
73 | # We reuse the command table from commands because it is easier than |
|
74 | # We reuse the command table from commands because it is easier than | |
74 | # teaching dispatch about multiple tables. |
|
75 | # teaching dispatch about multiple tables. | |
75 |
command = |
|
76 | command = registrar.command(commands.table) | |
76 |
|
77 | |||
77 | @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True) |
|
78 | @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True) | |
78 | def debugancestor(ui, repo, *args): |
|
79 | def debugancestor(ui, repo, *args): |
@@ -96,6 +96,51 b' class _funcregistrarbase(object):' | |||||
96 | """ |
|
96 | """ | |
97 | pass |
|
97 | pass | |
98 |
|
98 | |||
|
99 | def command(table): | |||
|
100 | """Returns a function object to be used as a decorator for making commands. | |||
|
101 | ||||
|
102 | This function receives a command table as its argument. The table should | |||
|
103 | be a dict. | |||
|
104 | ||||
|
105 | The returned function can be used as a decorator for adding commands | |||
|
106 | to that command table. This function accepts multiple arguments to define | |||
|
107 | a command. | |||
|
108 | ||||
|
109 | The first argument is the command name. | |||
|
110 | ||||
|
111 | The options argument is an iterable of tuples defining command arguments. | |||
|
112 | See ``mercurial.fancyopts.fancyopts()`` for the format of each tuple. | |||
|
113 | ||||
|
114 | The synopsis argument defines a short, one line summary of how to use the | |||
|
115 | command. This shows up in the help output. | |||
|
116 | ||||
|
117 | The norepo argument defines whether the command does not require a | |||
|
118 | local repository. Most commands operate against a repository, thus the | |||
|
119 | default is False. | |||
|
120 | ||||
|
121 | The optionalrepo argument defines whether the command optionally requires | |||
|
122 | a local repository. | |||
|
123 | ||||
|
124 | The inferrepo argument defines whether to try to find a repository from the | |||
|
125 | command line arguments. If True, arguments will be examined for potential | |||
|
126 | repository locations. See ``findrepo()``. If a repository is found, it | |||
|
127 | will be used. | |||
|
128 | """ | |||
|
129 | def cmd(name, options=(), synopsis=None, norepo=False, optionalrepo=False, | |||
|
130 | inferrepo=False): | |||
|
131 | def decorator(func): | |||
|
132 | func.norepo = norepo | |||
|
133 | func.optionalrepo = optionalrepo | |||
|
134 | func.inferrepo = inferrepo | |||
|
135 | if synopsis: | |||
|
136 | table[name] = func, list(options), synopsis | |||
|
137 | else: | |||
|
138 | table[name] = func, list(options) | |||
|
139 | return func | |||
|
140 | return decorator | |||
|
141 | ||||
|
142 | return cmd | |||
|
143 | ||||
99 | class revsetpredicate(_funcregistrarbase): |
|
144 | class revsetpredicate(_funcregistrarbase): | |
100 | """Decorator to register revset predicate |
|
145 | """Decorator to register revset predicate | |
101 |
|
146 |
@@ -3,14 +3,14 b'' | |||||
3 | from __future__ import absolute_import |
|
3 | from __future__ import absolute_import | |
4 |
|
4 | |||
5 | from mercurial import ( |
|
5 | from mercurial import ( | |
6 | cmdutil, |
|
|||
7 | error, |
|
6 | error, | |
8 | patch, |
|
7 | patch, | |
|
8 | registrar, | |||
9 | scmutil, |
|
9 | scmutil, | |
10 | ) |
|
10 | ) | |
11 |
|
11 | |||
12 | cmdtable = {} |
|
12 | cmdtable = {} | |
13 |
command = |
|
13 | command = registrar.command(cmdtable) | |
14 |
|
14 | |||
15 | @command('autodiff', |
|
15 | @command('autodiff', | |
16 | [('', 'git', '', 'git upgrade mode (yes/no/auto/warn/abort)')], |
|
16 | [('', 'git', '', 'git upgrade mode (yes/no/auto/warn/abort)')], |
@@ -80,16 +80,16 b' import itertools' | |||||
80 |
|
80 | |||
81 | from mercurial.i18n import _ |
|
81 | from mercurial.i18n import _ | |
82 | from mercurial import ( |
|
82 | from mercurial import ( | |
83 | cmdutil, |
|
|||
84 | context, |
|
83 | context, | |
85 | error, |
|
84 | error, | |
86 | node, |
|
85 | node, | |
|
86 | registrar, | |||
87 | scmutil, |
|
87 | scmutil, | |
88 | tags as tagsmod, |
|
88 | tags as tagsmod, | |
89 | ) |
|
89 | ) | |
90 |
|
90 | |||
91 | cmdtable = {} |
|
91 | cmdtable = {} | |
92 |
command = |
|
92 | command = registrar.command(cmdtable) | |
93 |
|
93 | |||
94 | _pipechars = '\\/+-|' |
|
94 | _pipechars = '\\/+-|' | |
95 | _nonpipechars = ''.join(chr(i) for i in xrange(33, 127) |
|
95 | _nonpipechars = ''.join(chr(i) for i in xrange(33, 127) |
@@ -5,12 +5,12 b'' | |||||
5 | from __future__ import absolute_import |
|
5 | from __future__ import absolute_import | |
6 |
|
6 | |||
7 | from mercurial import ( |
|
7 | from mercurial import ( | |
8 | cmdutil, |
|
|||
9 | merge, |
|
8 | merge, | |
|
9 | registrar, | |||
10 | ) |
|
10 | ) | |
11 |
|
11 | |||
12 | cmdtable = {} |
|
12 | cmdtable = {} | |
13 |
command = |
|
13 | command = registrar.command(cmdtable) | |
14 |
|
14 | |||
15 | @command('fakemergerecord', |
|
15 | @command('fakemergerecord', | |
16 | [('X', 'mandatory', None, 'add a fake mandatory record'), |
|
16 | [('X', 'mandatory', None, 'add a fake mandatory record'), |
@@ -62,9 +62,9 b' show traceback' | |||||
62 | names of extensions failed to load can be accessed via extensions.notloaded() |
|
62 | names of extensions failed to load can be accessed via extensions.notloaded() | |
63 |
|
63 | |||
64 | $ cat <<EOF > showbadexts.py |
|
64 | $ cat <<EOF > showbadexts.py | |
65 |
> from mercurial import |
|
65 | > from mercurial import commands, extensions, registrar | |
66 | > cmdtable = {} |
|
66 | > cmdtable = {} | |
67 |
> command = |
|
67 | > command = registrar.command(cmdtable) | |
68 | > @command('showbadexts', norepo=True) |
|
68 | > @command('showbadexts', norepo=True) | |
69 | > def showbadexts(ui, *pats, **opts): |
|
69 | > def showbadexts(ui, *pats, **opts): | |
70 | > ui.write('BADEXTS: %s\n' % ' '.join(sorted(extensions.notloaded()))) |
|
70 | > ui.write('BADEXTS: %s\n' % ' '.join(sorted(extensions.notloaded()))) |
@@ -14,7 +14,6 b' Create an extension to test bundle2 API' | |||||
14 | > """ |
|
14 | > """ | |
15 | > |
|
15 | > | |
16 | > import sys, os, gc |
|
16 | > import sys, os, gc | |
17 | > from mercurial import cmdutil |
|
|||
18 | > from mercurial import util |
|
17 | > from mercurial import util | |
19 | > from mercurial import bundle2 |
|
18 | > from mercurial import bundle2 | |
20 | > from mercurial import scmutil |
|
19 | > from mercurial import scmutil | |
@@ -22,6 +21,7 b' Create an extension to test bundle2 API' | |||||
22 | > from mercurial import changegroup |
|
21 | > from mercurial import changegroup | |
23 | > from mercurial import error |
|
22 | > from mercurial import error | |
24 | > from mercurial import obsolete |
|
23 | > from mercurial import obsolete | |
|
24 | > from mercurial import registrar | |||
25 | > |
|
25 | > | |
26 | > |
|
26 | > | |
27 | > try: |
|
27 | > try: | |
@@ -33,7 +33,7 b' Create an extension to test bundle2 API' | |||||
33 | > pass |
|
33 | > pass | |
34 | > |
|
34 | > | |
35 | > cmdtable = {} |
|
35 | > cmdtable = {} | |
36 |
> command = |
|
36 | > command = registrar.command(cmdtable) | |
37 | > |
|
37 | > | |
38 | > ELEPHANTSSONG = """Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko |
|
38 | > ELEPHANTSSONG = """Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko | |
39 | > Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
39 | > Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
@@ -105,9 +105,9 b' pager should be enabled if the attached ' | |||||
105 | chg waits for pager if runcommand raises |
|
105 | chg waits for pager if runcommand raises | |
106 |
|
106 | |||
107 | $ cat > $TESTTMP/crash.py <<EOF |
|
107 | $ cat > $TESTTMP/crash.py <<EOF | |
108 |
> from mercurial import |
|
108 | > from mercurial import registrar | |
109 | > cmdtable = {} |
|
109 | > cmdtable = {} | |
110 |
> command = |
|
110 | > command = registrar.command(cmdtable) | |
111 | > @command('crash') |
|
111 | > @command('crash') | |
112 | > def pagercrash(ui, repo, *pats, **opts): |
|
112 | > def pagercrash(ui, repo, *pats, **opts): | |
113 | > ui.write('going to crash\n') |
|
113 | > ui.write('going to crash\n') |
@@ -579,9 +579,9 b' changelog and manifest would have invali' | |||||
579 |
|
579 | |||
580 | $ cat <<EOF > dbgui.py |
|
580 | $ cat <<EOF > dbgui.py | |
581 | > import os, sys |
|
581 | > import os, sys | |
582 |
> from mercurial import c |
|
582 | > from mercurial import commands, registrar | |
583 | > cmdtable = {} |
|
583 | > cmdtable = {} | |
584 |
> command = |
|
584 | > command = registrar.command(cmdtable) | |
585 | > @command("debuggetpass", norepo=True) |
|
585 | > @command("debuggetpass", norepo=True) | |
586 | > def debuggetpass(ui): |
|
586 | > def debuggetpass(ui): | |
587 | > ui.write("%s\\n" % ui.getpass()) |
|
587 | > ui.write("%s\\n" % ui.getpass()) |
@@ -3,10 +3,10 b'' | |||||
3 | > """A small extension that tests our developer warnings |
|
3 | > """A small extension that tests our developer warnings | |
4 | > """ |
|
4 | > """ | |
5 | > |
|
5 | > | |
6 |
> from mercurial import |
|
6 | > from mercurial import registrar, repair, util | |
7 | > |
|
7 | > | |
8 | > cmdtable = {} |
|
8 | > cmdtable = {} | |
9 |
> command = |
|
9 | > command = registrar.command(cmdtable) | |
10 | > |
|
10 | > | |
11 | > @command('buggylocking', [], '') |
|
11 | > @command('buggylocking', [], '') | |
12 | > def buggylocking(ui, repo): |
|
12 | > def buggylocking(ui, repo): |
@@ -16,9 +16,9 b' Test alignment of multibyte characters' | |||||
16 | > f = file('l', 'w'); f.write(l); f.close() |
|
16 | > f = file('l', 'w'); f.write(l); f.close() | |
17 | > # instant extension to show list of options |
|
17 | > # instant extension to show list of options | |
18 | > f = file('showoptlist.py', 'w'); f.write("""# encoding: utf-8 |
|
18 | > f = file('showoptlist.py', 'w'); f.write("""# encoding: utf-8 | |
19 |
> from mercurial import |
|
19 | > from mercurial import registrar | |
20 | > cmdtable = {} |
|
20 | > cmdtable = {} | |
21 |
> command = |
|
21 | > command = registrar.command(cmdtable) | |
22 | > |
|
22 | > | |
23 | > @command('showoptlist', |
|
23 | > @command('showoptlist', | |
24 | > [('s', 'opt1', '', 'short width' + ' %(s)s' * 8, '%(s)s'), |
|
24 | > [('s', 'opt1', '', 'short width' + ' %(s)s' * 8, '%(s)s'), |
@@ -6,10 +6,10 b' Test text wrapping for multibyte charact' | |||||
6 | define commands to display help text |
|
6 | define commands to display help text | |
7 |
|
7 | |||
8 | $ cat << EOF > show.py |
|
8 | $ cat << EOF > show.py | |
9 |
> from mercurial import |
|
9 | > from mercurial import registrar | |
10 | > |
|
10 | > | |
11 | > cmdtable = {} |
|
11 | > cmdtable = {} | |
12 |
> command = |
|
12 | > command = registrar.command(cmdtable) | |
13 | > |
|
13 | > | |
14 | > # Japanese full-width characters: |
|
14 | > # Japanese full-width characters: | |
15 | > @command('show_full_ja', [], '') |
|
15 | > @command('show_full_ja', [], '') |
@@ -2,9 +2,9 b' Test basic extension support' | |||||
2 |
|
2 | |||
3 | $ cat > foobar.py <<EOF |
|
3 | $ cat > foobar.py <<EOF | |
4 | > import os |
|
4 | > import os | |
5 |
> from mercurial import c |
|
5 | > from mercurial import commands, registrar | |
6 | > cmdtable = {} |
|
6 | > cmdtable = {} | |
7 |
> command = |
|
7 | > command = registrar.command(cmdtable) | |
8 | > def uisetup(ui): |
|
8 | > def uisetup(ui): | |
9 | > ui.write("uisetup called\\n") |
|
9 | > ui.write("uisetup called\\n") | |
10 | > ui.flush() |
|
10 | > ui.flush() | |
@@ -380,9 +380,9 b' Setup main procedure of extension.' | |||||
380 |
|
380 | |||
381 | $ cat > $TESTTMP/absextroot/__init__.py <<EOF |
|
381 | $ cat > $TESTTMP/absextroot/__init__.py <<EOF | |
382 | > from __future__ import absolute_import |
|
382 | > from __future__ import absolute_import | |
383 |
> from mercurial import |
|
383 | > from mercurial import registrar | |
384 | > cmdtable = {} |
|
384 | > cmdtable = {} | |
385 |
> command = |
|
385 | > command = registrar.command(cmdtable) | |
386 | > |
|
386 | > | |
387 | > # "absolute" and "relative" shouldn't be imported before actual |
|
387 | > # "absolute" and "relative" shouldn't be imported before actual | |
388 | > # command execution, because (1) they import same modules, and (2) |
|
388 | > # command execution, because (1) they import same modules, and (2) | |
@@ -444,9 +444,9 b' See also issue5208 for detail about exam' | |||||
444 | > EOF |
|
444 | > EOF | |
445 |
|
445 | |||
446 | $ cat > $TESTTMP/checkrelativity.py <<EOF |
|
446 | $ cat > $TESTTMP/checkrelativity.py <<EOF | |
447 |
> from mercurial import |
|
447 | > from mercurial import registrar | |
448 | > cmdtable = {} |
|
448 | > cmdtable = {} | |
449 |
> command = |
|
449 | > command = registrar.command(cmdtable) | |
450 | > |
|
450 | > | |
451 | > # demand import avoids failure of importing notexist here |
|
451 | > # demand import avoids failure of importing notexist here | |
452 | > import extlibroot.lsub1.lsub2.notexist |
|
452 | > import extlibroot.lsub1.lsub2.notexist | |
@@ -487,9 +487,9 b' hide outer repo' | |||||
487 | $ cat > debugextension.py <<EOF |
|
487 | $ cat > debugextension.py <<EOF | |
488 | > '''only debugcommands |
|
488 | > '''only debugcommands | |
489 | > ''' |
|
489 | > ''' | |
490 |
> from mercurial import |
|
490 | > from mercurial import registrar | |
491 | > cmdtable = {} |
|
491 | > cmdtable = {} | |
492 |
> command = |
|
492 | > command = registrar.command(cmdtable) | |
493 | > @command('debugfoobar', [], 'hg debugfoobar') |
|
493 | > @command('debugfoobar', [], 'hg debugfoobar') | |
494 | > def debugfoobar(ui, repo, *args, **opts): |
|
494 | > def debugfoobar(ui, repo, *args, **opts): | |
495 | > "yet another debug command" |
|
495 | > "yet another debug command" | |
@@ -726,9 +726,9 b' Extension module help vs command help:' | |||||
726 | Test help topic with same name as extension |
|
726 | Test help topic with same name as extension | |
727 |
|
727 | |||
728 | $ cat > multirevs.py <<EOF |
|
728 | $ cat > multirevs.py <<EOF | |
729 |
> from mercurial import c |
|
729 | > from mercurial import commands, registrar | |
730 | > cmdtable = {} |
|
730 | > cmdtable = {} | |
731 |
> command = |
|
731 | > command = registrar.command(cmdtable) | |
732 | > """multirevs extension |
|
732 | > """multirevs extension | |
733 | > Big multi-line module docstring.""" |
|
733 | > Big multi-line module docstring.""" | |
734 | > @command('multirevs', [], 'ARG', norepo=True) |
|
734 | > @command('multirevs', [], 'ARG', norepo=True) | |
@@ -803,9 +803,9 b' along with extension help itself' | |||||
803 | > This is an awesome 'dodo' extension. It does nothing and |
|
803 | > This is an awesome 'dodo' extension. It does nothing and | |
804 | > writes 'Foo foo' |
|
804 | > writes 'Foo foo' | |
805 | > """ |
|
805 | > """ | |
806 |
> from mercurial import c |
|
806 | > from mercurial import commands, registrar | |
807 | > cmdtable = {} |
|
807 | > cmdtable = {} | |
808 |
> command = |
|
808 | > command = registrar.command(cmdtable) | |
809 | > @command('dodo', [], 'hg dodo') |
|
809 | > @command('dodo', [], 'hg dodo') | |
810 | > def dodo(ui, *args, **kwargs): |
|
810 | > def dodo(ui, *args, **kwargs): | |
811 | > """Does nothing""" |
|
811 | > """Does nothing""" | |
@@ -914,9 +914,9 b' along with extension help' | |||||
914 | > This is an awesome 'dudu' extension. It does something and |
|
914 | > This is an awesome 'dudu' extension. It does something and | |
915 | > also writes 'Beep beep' |
|
915 | > also writes 'Beep beep' | |
916 | > """ |
|
916 | > """ | |
917 |
> from mercurial import c |
|
917 | > from mercurial import commands, registrar | |
918 | > cmdtable = {} |
|
918 | > cmdtable = {} | |
919 |
> command = |
|
919 | > command = registrar.command(cmdtable) | |
920 | > @command('something', [], 'hg something') |
|
920 | > @command('something', [], 'hg something') | |
921 | > def something(ui, *args, **kwargs): |
|
921 | > def something(ui, *args, **kwargs): | |
922 | > """Does something""" |
|
922 | > """Does something""" | |
@@ -1157,9 +1157,9 b' Broken disabled extension and command:' | |||||
1157 | [255] |
|
1157 | [255] | |
1158 |
|
1158 | |||
1159 | $ cat > throw.py <<EOF |
|
1159 | $ cat > throw.py <<EOF | |
1160 |
> from mercurial import c |
|
1160 | > from mercurial import commands, registrar, util | |
1161 | > cmdtable = {} |
|
1161 | > cmdtable = {} | |
1162 |
> command = |
|
1162 | > command = registrar.command(cmdtable) | |
1163 | > class Bogon(Exception): pass |
|
1163 | > class Bogon(Exception): pass | |
1164 | > @command('throw', [], 'hg throw', norepo=True) |
|
1164 | > @command('throw', [], 'hg throw', norepo=True) | |
1165 | > def throw(ui, **opts): |
|
1165 | > def throw(ui, **opts): |
@@ -680,10 +680,10 b' this is a section and erroring out weird' | |||||
680 |
|
680 | |||
681 | $ cat > helpext.py <<EOF |
|
681 | $ cat > helpext.py <<EOF | |
682 | > import os |
|
682 | > import os | |
683 |
> from mercurial import c |
|
683 | > from mercurial import commands, registrar | |
684 | > |
|
684 | > | |
685 | > cmdtable = {} |
|
685 | > cmdtable = {} | |
686 |
> command = |
|
686 | > command = registrar.command(cmdtable) | |
687 | > |
|
687 | > | |
688 | > @command('nohelp', |
|
688 | > @command('nohelp', | |
689 | > [('', 'longdesc', 3, 'x'*90), |
|
689 | > [('', 'longdesc', 3, 'x'*90), |
@@ -14,10 +14,10 b' Prepare' | |||||
14 | Test that raising an exception in the release function doesn't cause the lock to choke |
|
14 | Test that raising an exception in the release function doesn't cause the lock to choke | |
15 |
|
15 | |||
16 | $ cat > testlock.py << EOF |
|
16 | $ cat > testlock.py << EOF | |
17 |
> from mercurial import |
|
17 | > from mercurial import error, registrar | |
18 | > |
|
18 | > | |
19 | > cmdtable = {} |
|
19 | > cmdtable = {} | |
20 |
> command = |
|
20 | > command = registrar.command(cmdtable) | |
21 | > |
|
21 | > | |
22 | > def acquiretestlock(repo, releaseexc): |
|
22 | > def acquiretestlock(repo, releaseexc): | |
23 | > def unlock(): |
|
23 | > def unlock(): |
@@ -6,10 +6,10 b' Test if logtoprocess correctly captures ' | |||||
6 |
|
6 | |||
7 | $ hg init |
|
7 | $ hg init | |
8 | $ cat > $TESTTMP/foocommand.py << EOF |
|
8 | $ cat > $TESTTMP/foocommand.py << EOF | |
9 |
> from mercurial import |
|
9 | > from mercurial import registrar | |
10 | > from time import sleep |
|
10 | > from time import sleep | |
11 | > cmdtable = {} |
|
11 | > cmdtable = {} | |
12 |
> command = |
|
12 | > command = registrar.command(cmdtable) | |
13 | > @command('foo', []) |
|
13 | > @command('foo', []) | |
14 | > def foo(ui, repo): |
|
14 | > def foo(ui, repo): | |
15 | > ui.log('foo', 'a message: %(bar)s\n', bar='spam') |
|
15 | > ui.log('foo', 'a message: %(bar)s\n', bar='spam') |
@@ -1065,11 +1065,11 b' Test issue 4506' | |||||
1065 | Test heads computation on pending index changes with obsolescence markers |
|
1065 | Test heads computation on pending index changes with obsolescence markers | |
1066 | $ cd .. |
|
1066 | $ cd .. | |
1067 | $ cat >$TESTTMP/test_extension.py << EOF |
|
1067 | $ cat >$TESTTMP/test_extension.py << EOF | |
1068 | > from mercurial import cmdutil |
|
1068 | > from mercurial import cmdutil, registrar | |
1069 | > from mercurial.i18n import _ |
|
1069 | > from mercurial.i18n import _ | |
1070 | > |
|
1070 | > | |
1071 | > cmdtable = {} |
|
1071 | > cmdtable = {} | |
1072 |
> command = |
|
1072 | > command = registrar.command(cmdtable) | |
1073 | > @command("amendtransient",[], _('hg amendtransient [rev]')) |
|
1073 | > @command("amendtransient",[], _('hg amendtransient [rev]')) | |
1074 | > def amend(ui, repo, *pats, **opts): |
|
1074 | > def amend(ui, repo, *pats, **opts): | |
1075 | > def commitfunc(ui, repo, message, match, opts): |
|
1075 | > def commitfunc(ui, repo, message, match, opts): |
@@ -214,9 +214,9 b' pager is globally set to off using a fla' | |||||
214 | Pager should not override the exit code of other commands |
|
214 | Pager should not override the exit code of other commands | |
215 |
|
215 | |||
216 | $ cat >> $TESTTMP/fortytwo.py <<'EOF' |
|
216 | $ cat >> $TESTTMP/fortytwo.py <<'EOF' | |
217 |
> from mercurial import |
|
217 | > from mercurial import registrar, commands | |
218 | > cmdtable = {} |
|
218 | > cmdtable = {} | |
219 |
> command = |
|
219 | > command = registrar.command(cmdtable) | |
220 | > @command('fortytwo', [], 'fortytwo', norepo=True) |
|
220 | > @command('fortytwo', [], 'fortytwo', norepo=True) | |
221 | > def fortytwo(ui, *opts): |
|
221 | > def fortytwo(ui, *opts): | |
222 | > ui.write('42\n') |
|
222 | > ui.write('42\n') |
@@ -223,9 +223,9 b' pager is globally set to off using a fla' | |||||
223 | Pager should not override the exit code of other commands |
|
223 | Pager should not override the exit code of other commands | |
224 |
|
224 | |||
225 | $ cat >> $TESTTMP/fortytwo.py <<'EOF' |
|
225 | $ cat >> $TESTTMP/fortytwo.py <<'EOF' | |
226 |
> from mercurial import c |
|
226 | > from mercurial import commands, registrar | |
227 | > cmdtable = {} |
|
227 | > cmdtable = {} | |
228 |
> command = |
|
228 | > command = registrar.command(cmdtable) | |
229 | > @command('fortytwo', [], 'fortytwo', norepo=True) |
|
229 | > @command('fortytwo', [], 'fortytwo', norepo=True) | |
230 | > def fortytwo(ui, *opts): |
|
230 | > def fortytwo(ui, *opts): | |
231 | > ui.write('42\n') |
|
231 | > ui.write('42\n') |
@@ -51,9 +51,9 b' Install an extension that can sleep and ' | |||||
51 |
|
51 | |||
52 | $ cat >> sleepext.py << EOF |
|
52 | $ cat >> sleepext.py << EOF | |
53 | > import time |
|
53 | > import time | |
54 |
> from mercurial import |
|
54 | > from mercurial import registrar, commands | |
55 | > cmdtable = {} |
|
55 | > cmdtable = {} | |
56 |
> command = |
|
56 | > command = registrar.command(cmdtable) | |
57 | > @command('sleep', [], 'hg sleep') |
|
57 | > @command('sleep', [], 'hg sleep') | |
58 | > def sleep(ui, *args, **kwargs): |
|
58 | > def sleep(ui, *args, **kwargs): | |
59 | > time.sleep(0.1) |
|
59 | > time.sleep(0.1) |
@@ -1,10 +1,10 b'' | |||||
1 |
|
1 | |||
2 | $ cat > loop.py <<EOF |
|
2 | $ cat > loop.py <<EOF | |
3 |
> from mercurial import c |
|
3 | > from mercurial import commands, registrar | |
4 | > import time |
|
4 | > import time | |
5 | > |
|
5 | > | |
6 | > cmdtable = {} |
|
6 | > cmdtable = {} | |
7 |
> command = |
|
7 | > command = registrar.command(cmdtable) | |
8 | > |
|
8 | > | |
9 | > class incrementingtime(object): |
|
9 | > class incrementingtime(object): | |
10 | > def __init__(self): |
|
10 | > def __init__(self): |
@@ -1,8 +1,8 b'' | |||||
1 |
|
1 | |||
2 | $ cat > adddrop.py <<EOF |
|
2 | $ cat > adddrop.py <<EOF | |
3 |
> from mercurial import |
|
3 | > from mercurial import registrar | |
4 | > cmdtable = {} |
|
4 | > cmdtable = {} | |
5 |
> command = |
|
5 | > command = registrar.command(cmdtable) | |
6 | > @command('debugadddrop', |
|
6 | > @command('debugadddrop', | |
7 | > [('', 'drop', False, 'drop file from dirstate', 'FILE'), |
|
7 | > [('', 'drop', False, 'drop file from dirstate', 'FILE'), | |
8 | > ('', 'normal-lookup', False, 'add file to dirstate', 'FILE')], |
|
8 | > ('', 'normal-lookup', False, 'add file to dirstate', 'FILE')], |
@@ -85,9 +85,9 b" don't allow marking or unmarking driver-" | |||||
85 |
|
85 | |||
86 | $ cat > $TESTTMP/markdriver.py << EOF |
|
86 | $ cat > $TESTTMP/markdriver.py << EOF | |
87 | > '''mark and unmark files as driver-resolved''' |
|
87 | > '''mark and unmark files as driver-resolved''' | |
88 |
> from mercurial import |
|
88 | > from mercurial import merge, registrar, scmutil | |
89 | > cmdtable = {} |
|
89 | > cmdtable = {} | |
90 |
> command = |
|
90 | > command = registrar.command(cmdtable) | |
91 | > @command('markdriver', |
|
91 | > @command('markdriver', | |
92 | > [('u', 'unmark', None, '')], |
|
92 | > [('u', 'unmark', None, '')], | |
93 | > 'FILE...') |
|
93 | > 'FILE...') |
@@ -37,14 +37,14 b" these predicates use '\\0' as a separator" | |||||
37 | $ cat <<EOF > debugrevlistspec.py |
|
37 | $ cat <<EOF > debugrevlistspec.py | |
38 | > from __future__ import absolute_import |
|
38 | > from __future__ import absolute_import | |
39 | > from mercurial import ( |
|
39 | > from mercurial import ( | |
40 | > cmdutil, |
|
|||
41 | > node as nodemod, |
|
40 | > node as nodemod, | |
|
41 | > registrar, | |||
42 | > revset, |
|
42 | > revset, | |
43 | > revsetlang, |
|
43 | > revsetlang, | |
44 | > smartset, |
|
44 | > smartset, | |
45 | > ) |
|
45 | > ) | |
46 | > cmdtable = {} |
|
46 | > cmdtable = {} | |
47 |
> command = |
|
47 | > command = registrar.command(cmdtable) | |
48 | > @command('debugrevlistspec', |
|
48 | > @command('debugrevlistspec', | |
49 | > [('', 'optimize', None, 'print parsed tree after optimizing'), |
|
49 | > [('', 'optimize', None, 'print parsed tree after optimizing'), | |
50 | > ('', 'bin', None, 'unhexlify arguments')]) |
|
50 | > ('', 'bin', None, 'unhexlify arguments')]) |
@@ -4,8 +4,8 b' Test UI worker interaction' | |||||
4 | > from __future__ import absolute_import, print_function |
|
4 | > from __future__ import absolute_import, print_function | |
5 | > import time |
|
5 | > import time | |
6 | > from mercurial import ( |
|
6 | > from mercurial import ( | |
7 | > cmdutil, |
|
|||
8 | > error, |
|
7 | > error, | |
|
8 | > registrar, | |||
9 | > ui as uimod, |
|
9 | > ui as uimod, | |
10 | > worker, |
|
10 | > worker, | |
11 | > ) |
|
11 | > ) | |
@@ -30,7 +30,7 b' Test UI worker interaction' | |||||
30 | > 'runme': runme, |
|
30 | > 'runme': runme, | |
31 | > } |
|
31 | > } | |
32 | > cmdtable = {} |
|
32 | > cmdtable = {} | |
33 |
> command = |
|
33 | > command = registrar.command(cmdtable) | |
34 | > @command('test', [], 'hg test [COST] [FUNC]') |
|
34 | > @command('test', [], 'hg test [COST] [FUNC]') | |
35 | > def t(ui, repo, cost=1.0, func='runme'): |
|
35 | > def t(ui, repo, cost=1.0, func='runme'): | |
36 | > cost = float(cost) |
|
36 | > cost = float(cost) |
General Comments 0
You need to be logged in to leave comments.
Login now