[PATCH - ACL Extension] Added support for 'pretxncommit'.

Elifarley Callado Coelho Cruz elifarley at gmail.com
Tue Apr 6 20:47:41 CDT 2010


With this patch, one can call the ACL hook at pre-commit time too.

This is useful because now we can avoid violating ACL permissions much
sooner, at commit time, instead of waiting for a PUSH to check if
there were any invalid commits.

--

# HG changeset patch
# User Elifarley Callado Coelho Cruz <elifarley at gmail.com>
# Date 1270602943 10800
# Node ID 15c35780ef7bb48accf34d7cc627c6a2c3834a1d
# Parent  f97b98db6fd1de6c60c1b60254c9240337dadc01
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.

diff --git a/hgext/acl.py b/hgext/acl.py
--- a/hgext/acl.py
+++ b/hgext/acl.py
@@ -72,10 +72,10 @@


 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 'pretxnchangegroup' == hooktype and source not in
ui.config('acl', 'sources', 'serve').split():
         ui.debug('acl: changes have source "%s" - skipping\n' % source)
         return
-------------- next part --------------
A non-text attachment was scrubbed...
Name: commit-support.diff
Type: text/x-patch
Size: 986 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100406/fbe40951/attachment.bin>


More information about the Mercurial-devel mailing list