Mercurial > public > mercurial-scm > hg
comparison mercurial/extensions.py @ 27111:9de814b35808
extensions: rename _ignore to _builtin, add descriptive comment
It was previously not at all obvious what this was for.
We also change it to a set to avoid iterating over an admittedly
small list repeatedly at startup time.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Tue, 24 Nov 2015 16:38:54 -0800 |
parents | 1aee2ab0f902 |
children | 0214cc0a0e97 |
comparison
equal
deleted
inserted
replaced
27110:f04bd381e8c0 | 27111:9de814b35808 |
---|---|
22 ) | 22 ) |
23 | 23 |
24 _extensions = {} | 24 _extensions = {} |
25 _aftercallbacks = {} | 25 _aftercallbacks = {} |
26 _order = [] | 26 _order = [] |
27 _ignore = ['hbisect', 'bookmarks', 'parentrevspec', 'interhg', 'inotify'] | 27 # former extensions now in core - we ignore these if found in hgrc |
28 _builtin = set(['hbisect', 'bookmarks', 'parentrevspec', 'interhg', 'inotify']) | |
28 | 29 |
29 def extensions(ui=None): | 30 def extensions(ui=None): |
30 if ui: | 31 if ui: |
31 def enabled(name): | 32 def enabled(name): |
32 for format in ['%s', 'hgext.%s']: | 33 for format in ['%s', 'hgext.%s']: |
73 def load(ui, name, path): | 74 def load(ui, name, path): |
74 if name.startswith('hgext.') or name.startswith('hgext/'): | 75 if name.startswith('hgext.') or name.startswith('hgext/'): |
75 shortname = name[6:] | 76 shortname = name[6:] |
76 else: | 77 else: |
77 shortname = name | 78 shortname = name |
78 if shortname in _ignore: | 79 if shortname in _builtin: |
79 return None | 80 return None |
80 if shortname in _extensions: | 81 if shortname in _extensions: |
81 return _extensions[shortname] | 82 return _extensions[shortname] |
82 _extensions[shortname] = None | 83 _extensions[shortname] = None |
83 if path: | 84 if path: |