changeset 16766:9d778f80ad2a

acl: perform some computations earlier, so that returned lambda functions are simpler
author Elifarley Callado Coelho Cruz
date Fri, 18 May 2012 13:47:44 -0300
parents 754e98e0a615
children 363bde4224c8
files hgext/acl.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/acl.py	Fri May 18 12:48:24 2012 -0300
+++ b/hgext/acl.py	Fri May 18 13:47:44 2012 -0300
@@ -193,7 +193,11 @@
     # Branch-based ACL
     if not repo:
         if pats:
-            return lambda b: '*' in pats or b in pats
+            # If there's an asterisk (meaning "any branch"), always return True;
+            # Otherwise, test if b is in pats
+            if '*' in pats:
+                return util.always
+            return lambda b: b in pats
         return util.never
 
     # Path-based ACL