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

Mads Kiilerich mads at kiilerich.com
Tue Jul 31 13:33:15 CDT 2012


On 12/07/12 22:48, Vitaliy Filippov wrote:
> # HG changeset patch
> # User Vitaliy Filippov <vitalif at yourcmc.ru>
> # Date 1342116963 -14400
> # Node ID 82a1fa32f162636c01f6af5b00b2080eea1f986c
> # Parent  2422f58a70bcfbf20ec42edf9e1353fdc3f2bfc2
> acl: Allow non-exact matches for deny/allow branches
>
> Usage example (does not work without this patch):
>
> [acl.deny.branches]
> re:\d+ = *
>
> diff -r 2422f58a70bc -r 82a1fa32f162 hgext/acl.py
> --- a/hgext/acl.py	Thu Jul 12 22:14:33 2012 +0400
> +++ b/hgext/acl.py	Thu Jul 12 22:16:03 2012 +0400
> @@ -287,8 +287,8 @@
>           ui.readconfig(cfg, sections = ['acl.groups', 'acl.allow.branches',
>           'acl.deny.branches', 'acl.allow', 'acl.deny'])
>   
> -    allowbranches = buildmatch(ui, None, user, 'acl.allow.branches')
> -    denybranches = buildmatch(ui, None, user, 'acl.deny.branches')
> +    allowbranches = buildmatch(ui, repo, user, 'acl.allow.branches')
> +    denybranches = buildmatch(ui, repo, user, 'acl.deny.branches')
>       allow = buildmatch(ui, repo, user, 'acl.allow')
>       deny = buildmatch(ui, repo, user, 'acl.deny')

The buildmatch invocations with repo=None was added by 
http://selenic.com/repo/hg/rev/2dd91779eb27 . There must have been a 
reason for that. It shouldn't be changed without understanding the 
reason. The mailing list archives might reveal something. The old and 
new reasoning should probably be mentioned briefly in the commit 
description.

And shouldn't the buildmatch checks for repo = None be removed when it 
no longer can happen?

(It is now obvious that 2dd91779eb27 was a bad changeset. It did a lot 
of refactoring while adding a new feature and it is thus hard to see 
what the feature itself changed in the documentation. It should have 
been split up in two changesets that both would have been good ... if 
only they had added some tests for the new functionality. The lack of 
existing tests is however not an excuse for not adding any tests now.)

/Mads



More information about the Mercurial-devel mailing list