[PATCH 2 of 2] acl: Allow non-exact matches for deny/allow branches

elifarley elifarley at gmail.com
Wed Aug 1 09:20:55 CDT 2012


Hi all,

Changeset 2dd91779eb27 introduced branch-based access control.

Before that changeset, the calls to buildmatch were:

allow = buildmatch(ui, repo, user, 'acl.allow')
deny = buildmatch(ui, repo, user, 'acl.deny')

My change added 2 more calls and to buildmatch and a change in buildmatch
itself, which gives:

allowbranches = buildmatch(ui, None, user, 'acl.allow.branches')
denybranches = buildmatch(ui, None, user, 'acl.deny.branches')
allow = buildmatch(ui, repo, user, 'acl.allow')
deny = buildmatch(ui, repo, user, 'acl.deny')

buildmatch:
[...]
+    if not repo:
(if repo is None, then we know for sure we're in the branch-based context)
+        if pats:
+            return lambda b: '*' in pats or b in pats
+        return lambda b: False

So, by calling buildmatch with repo set to None, I was able to differentiate
between the branch context and the filepath context.
I saw that there's no need to know anything about 'repo' inside the
'buildmatch' function if you're calling it in the branch-based access
control context.

I could've removed the 'repo' parameter altogether, but it looked like it
was necessary for the filepath-based access control context (the attribute
'repo.root' is read in "return match.match(repo.root, '', pats)")





--
View this message in context: http://mercurial.808500.n3.nabble.com/PATCH-0-of-2-Two-patches-for-Mercurial-tp3990600p3991325.html
Sent from the Development mailing list archive at Nabble.com.


More information about the Mercurial-devel mailing list