Show More
@@ -198,6 +198,7 b' import getpass' | |||||
198 | from mercurial.i18n import _ |
|
198 | from mercurial.i18n import _ | |
199 | from mercurial import ( |
|
199 | from mercurial import ( | |
200 | error, |
|
200 | error, | |
|
201 | extensions, | |||
201 | match, |
|
202 | match, | |
202 | registrar, |
|
203 | registrar, | |
203 | util, |
|
204 | util, | |
@@ -307,7 +308,23 b' def buildmatch(ui, repo, user, key):' | |||||
307 | return match.match(repo.root, '', pats) |
|
308 | return match.match(repo.root, '', pats) | |
308 | return util.never |
|
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 | def hook(ui, repo, hooktype, node=None, source=None, **kwargs): |
|
324 | def hook(ui, repo, hooktype, node=None, source=None, **kwargs): | |
|
325 | ||||
|
326 | ensureenabled(ui) | |||
|
327 | ||||
311 | if hooktype not in ['pretxnchangegroup', 'pretxncommit']: |
|
328 | if hooktype not in ['pretxnchangegroup', 'pretxncommit']: | |
312 | raise error.Abort(_('config error - hook type "%s" cannot stop ' |
|
329 | raise error.Abort(_('config error - hook type "%s" cannot stop ' | |
313 | 'incoming changesets nor commits') % hooktype) |
|
330 | 'incoming changesets nor commits') % hooktype) |
General Comments 0
You need to be logged in to leave comments.
Login now