changeset 3436:f29989e9746e

use ui.readsections in the acl extension
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Tue, 17 Oct 2006 17:04:26 -0300
parents e4452c3fa736
children d96429ddc8e2
files hgext/acl.py tests/test-acl tests/test-acl.out
diffstat 3 files changed, 52 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/acl.py	Tue Oct 17 17:04:26 2006 -0300
+++ b/hgext/acl.py	Tue Oct 17 17:04:26 2006 -0300
@@ -80,7 +80,7 @@
         self.user = getpass.getuser()
         cfg = self.ui.config('acl', 'config')
         if cfg:
-            self.ui.readconfig(cfg)
+            self.ui.readsections(cfg, 'acl.allow', 'acl.deny')
         self.allow, self.allowable = self.buildmatch('acl.allow')
         self.deny, self.deniable = self.buildmatch('acl.deny')
 
--- a/tests/test-acl	Tue Oct 17 17:04:26 2006 -0300
+++ b/tests/test-acl	Tue Oct 17 17:04:26 2006 -0300
@@ -102,3 +102,8 @@
 echo 'foo/** = betty' >> acl.config
 do_push betty
 
+echo 'acl.config can set only [acl.allow]/[acl.deny]'
+echo '[hooks]' >> acl.config
+echo 'changegroup.acl = false' >> acl.config
+do_push barney
+
--- a/tests/test-acl.out	Tue Oct 17 17:04:26 2006 -0300
+++ b/tests/test-acl.out	Tue Oct 17 17:04:26 2006 -0300
@@ -469,3 +469,49 @@
 no rollback information available
 0:6675d58eff77
 
+acl.config can set only [acl.allow]/[acl.deny]
+Pushing as user barney
+hgrc = """
+[hooks]
+pretxnchangegroup.acl = python:hgext.acl.hook
+[acl]
+sources = push
+[acl.allow]
+foo/** = fred
+[acl.deny]
+foo/bar/** = fred
+foo/Bar/** = fred
+[acl.allow]
+** = barney
+**/*.txt = wilma
+[acl]
+config = ../acl.config
+"""
+acl.config = """
+[acl.allow]
+foo/** = betty
+[hooks]
+changegroup.acl = false
+"""
+pushing to ../b
+searching for changes
+common changesets up to 6675d58eff77
+adding changesets
+add changeset ef1ea85a6374
+add changeset f9cafe1212c8
+add changeset 911600dab2ae
+adding manifests
+adding file changes
+adding foo/Bar/file.txt revisions
+adding foo/file.txt revisions
+adding quux/file.py revisions
+added 3 changesets with 3 changes to 3 files
+calling hook pretxnchangegroup.acl: hgext.acl.hook
+acl: acl.allow enabled, 1 entries for user barney
+acl: acl.deny enabled, 0 entries for user barney
+acl: allowing changeset ef1ea85a6374
+acl: allowing changeset f9cafe1212c8
+acl: allowing changeset 911600dab2ae
+rolling back last transaction
+0:6675d58eff77
+