mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
Added support for 'pretxncommit', so that one can call the ACL hook at
pre-commit time too. This is useful because now it's possible to avoid violating ACL permissions much sooner, at commit time, instead of waiting for a PUSH to check if there were any invalid commits.
This commit is contained in:
parent
48a68b6563
commit
060edfe5fe
@ -72,10 +72,11 @@ def buildmatch(ui, repo, user, key):
|
||||
|
||||
|
||||
def hook(ui, repo, hooktype, node=None, source=None, **kwargs):
|
||||
if hooktype != 'pretxnchangegroup':
|
||||
if hooktype not in ['pretxnchangegroup', 'pretxncommit']:
|
||||
raise util.Abort(_('config error - hook type "%s" cannot stop '
|
||||
'incoming changesets') % hooktype)
|
||||
if source not in ui.config('acl', 'sources', 'serve').split():
|
||||
'incoming changesets nor commits') % hooktype)
|
||||
if (hooktype == 'pretxnchangegroup' and
|
||||
source not in ui.config('acl', 'sources', 'serve').split()):
|
||||
ui.debug('acl: changes have source "%s" - skipping\n' % source)
|
||||
return
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user