Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 28394:dcb4209bd30d
revset: replace extpredicate by revsetpredicate of registrar
This patch consists of changes below (these can't be applied
separately).
- replace revset.extpredicate by registrar.revsetpredicate in
extensions
- remove setup() on an instance named as revsetpredicate in
uisetup()/extsetup() of each extensions
registrar.revsetpredicate doesn't have setup() API.
- put new entry for revsetpredicate into extraloaders in dispatch
This causes implicit loading predicate functions at loading
extension.
This loading mechanism requires that an extension has an instance
named as revsetpredicate, and this is reason why
largefiles/__init__.py is also changed in this patch.
Before this patch, test-revset.t tests that all decorated revset
predicates are loaded by explicit setup() at once ("all or nothing").
Now, test-revset.t tests that any revset predicate isn't loaded at
failure of loading extension, because loading itself is executed by
dispatch and it can't be controlled on extension side.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Tue, 08 Mar 2016 23:04:53 +0900 |
parents | 73905484ef70 |
children | 4eb5496c2bd4 |
comparison
equal
deleted
inserted
replaced
28393:ac11ba7c2e56 | 28394:dcb4209bd30d |
---|---|
31 error, | 31 error, |
32 extensions, | 32 extensions, |
33 fancyopts, | 33 fancyopts, |
34 hg, | 34 hg, |
35 hook, | 35 hook, |
36 revset, | |
36 ui as uimod, | 37 ui as uimod, |
37 util, | 38 util, |
38 ) | 39 ) |
39 | 40 |
40 class request(object): | 41 class request(object): |
750 # - loadermod is the module where loader is placed | 751 # - loadermod is the module where loader is placed |
751 # - loadername is the name of the function, which takes (ui, extensionname, | 752 # - loadername is the name of the function, which takes (ui, extensionname, |
752 # extraobj) arguments | 753 # extraobj) arguments |
753 extraloaders = [ | 754 extraloaders = [ |
754 ('cmdtable', commands, 'loadcmdtable'), | 755 ('cmdtable', commands, 'loadcmdtable'), |
756 ('revsetpredicate', revset, 'loadpredicate'), | |
755 ] | 757 ] |
756 | 758 |
757 def _dispatch(req): | 759 def _dispatch(req): |
758 args = req.args | 760 args = req.args |
759 ui = req.ui | 761 ui = req.ui |