equal
deleted
inserted
replaced
18 from mercurial.i18n import _ |
18 from mercurial.i18n import _ |
19 from mercurial.error import ParseError, RepoLookupError, Abort |
19 from mercurial.error import ParseError, RepoLookupError, Abort |
20 from mercurial import revset |
20 from mercurial import revset |
21 |
21 |
22 __all__ = [] |
22 __all__ = [] |
|
23 commands = {} |
23 |
24 |
24 class webcommand(object): |
25 class webcommand(object): |
25 """Decorator used to register a web command handler. |
26 """Decorator used to register a web command handler. |
26 |
27 |
27 The decorator takes as its positional arguments the name/path the |
28 The decorator takes as its positional arguments the name/path the |
37 def __init__(self, name): |
38 def __init__(self, name): |
38 self.name = name |
39 self.name = name |
39 |
40 |
40 def __call__(self, func): |
41 def __call__(self, func): |
41 __all__.append(self.name) |
42 __all__.append(self.name) |
|
43 commands[self.name] = func |
42 return func |
44 return func |
43 |
45 |
44 @webcommand('log') |
46 @webcommand('log') |
45 def log(web, req, tmpl): |
47 def log(web, req, tmpl): |
46 if 'file' in req.form and req.form['file'][0]: |
48 if 'file' in req.form and req.form['file'][0]: |