Show More
@@ -198,6 +198,7 b' import getpass' | |||
|
198 | 198 | from mercurial.i18n import _ |
|
199 | 199 | from mercurial import ( |
|
200 | 200 | error, |
|
201 | extensions, | |
|
201 | 202 | match, |
|
202 | 203 | registrar, |
|
203 | 204 | util, |
@@ -307,7 +308,23 b' def buildmatch(ui, repo, user, key):' | |||
|
307 | 308 | return match.match(repo.root, '', pats) |
|
308 | 309 | return util.never |
|
309 | 310 | |
|
311 | def ensureenabled(ui): | |
|
312 | """make sure the extension is enabled when used as hook | |
|
313 | ||
|
314 | When acl is used through hooks, the extension is never formally loaded and | |
|
315 | enabled. This has some side effect, for example the config declaration is | |
|
316 | never loaded. This function ensure the extension is enabled when running | |
|
317 | hooks. | |
|
318 | """ | |
|
319 | if 'acl' in ui._knownconfig: | |
|
320 | return | |
|
321 | ui.setconfig('extensions', 'acl', '', source='internal') | |
|
322 | extensions.loadall(ui, ['acl']) | |
|
323 | ||
|
310 | 324 | def hook(ui, repo, hooktype, node=None, source=None, **kwargs): |
|
325 | ||
|
326 | ensureenabled(ui) | |
|
327 | ||
|
311 | 328 | if hooktype not in ['pretxnchangegroup', 'pretxncommit']: |
|
312 | 329 | raise error.Abort(_('config error - hook type "%s" cannot stop ' |
|
313 | 330 | 'incoming changesets nor commits') % hooktype) |
General Comments 0
You need to be logged in to leave comments.
Login now