acl: perform some computations earlier, so that returned lambda functions are simpler
authorElifarley Callado Coelho Cruz
Fri, 18 May 2012 13:47:44 -0300
changeset 16766 9d778f80ad2a
parent 16765 754e98e0a615
child 16767 363bde4224c8
acl: perform some computations earlier, so that returned lambda functions are simpler
hgext/acl.py
--- 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