Show More
@@ -13,6 +13,7 b' from __future__ import absolute_import' | |||||
13 |
|
13 | |||
14 | from . import ( |
|
14 | from . import ( | |
15 | commands, |
|
15 | commands, | |
|
16 | error, | |||
16 | extensions, |
|
17 | extensions, | |
17 | registrar, |
|
18 | registrar, | |
18 | ) |
|
19 | ) | |
@@ -80,8 +81,8 b' class exthelper(object):' | |||||
80 | for command, wrapper, opts in self._commandwrappers: |
|
81 | for command, wrapper, opts in self._commandwrappers: | |
81 | entry = extensions.wrapcommand(commands.table, command, wrapper) |
|
82 | entry = extensions.wrapcommand(commands.table, command, wrapper) | |
82 | if opts: |
|
83 | if opts: | |
83 |
for |
|
84 | for opt in opts: | |
84 |
entry[1].append( |
|
85 | entry[1].append(opt) | |
85 | for cont, funcname, wrapper in self._functionwrappers: |
|
86 | for cont, funcname, wrapper in self._functionwrappers: | |
86 | extensions.wrapfunction(cont, funcname, wrapper) |
|
87 | extensions.wrapfunction(cont, funcname, wrapper) | |
87 | for c in self._uicallables: |
|
88 | for c in self._uicallables: | |
@@ -121,8 +122,8 b' class exthelper(object):' | |||||
121 | knownexts[ext] = e.cmdtable |
|
122 | knownexts[ext] = e.cmdtable | |
122 | entry = extensions.wrapcommand(knownexts[ext], command, wrapper) |
|
123 | entry = extensions.wrapcommand(knownexts[ext], command, wrapper) | |
123 | if opts: |
|
124 | if opts: | |
124 |
for |
|
125 | for opt in opts: | |
125 |
entry[1].append( |
|
126 | entry[1].append(opt) | |
126 |
|
127 | |||
127 | for c in self._extcallables: |
|
128 | for c in self._extcallables: | |
128 | c(ui) |
|
129 | c(ui) | |
@@ -206,12 +207,21 b' class exthelper(object):' | |||||
206 | ui.note('Barry!') |
|
207 | ui.note('Barry!') | |
207 | return orig(ui, repo, *args, **kwargs) |
|
208 | return orig(ui, repo, *args, **kwargs) | |
208 |
|
209 | |||
209 |
The `opts` argument allows specifying a |
|
210 | The `opts` argument allows specifying a list of tuples for additional | |
210 | command. |
|
211 | arguments for the command. See ``mercurial.fancyopts.fancyopts()`` for | |
|
212 | the format of the tuple. | |||
211 |
|
213 | |||
212 | """ |
|
214 | """ | |
213 | if opts is None: |
|
215 | if opts is None: | |
214 | opts = [] |
|
216 | opts = [] | |
|
217 | else: | |||
|
218 | for opt in opts: | |||
|
219 | if not isinstance(opt, tuple): | |||
|
220 | raise error.ProgrammingError('opts must be list of tuples') | |||
|
221 | if len(opt) not in (4, 5): | |||
|
222 | msg = 'each opt tuple must contain 4 or 5 values' | |||
|
223 | raise error.ProgrammingError(msg) | |||
|
224 | ||||
215 | def dec(wrapper): |
|
225 | def dec(wrapper): | |
216 | if extension is None: |
|
226 | if extension is None: | |
217 | self._commandwrappers.append((command, wrapper, opts)) |
|
227 | self._commandwrappers.append((command, wrapper, opts)) |
General Comments 0
You need to be logged in to leave comments.
Login now