Patchwork [11,of,18] acl: use configlist to retrieve the source config

login
register
mail settings
Submitter Pierre-Yves David
Date July 2, 2017, 2:57 a.m.
Message ID <c56f424d79532d245316.1498964259@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21901/
State Accepted
Headers show

Comments

Pierre-Yves David - July 2, 2017, 2:57 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1498935514 -7200
#      Sat Jul 01 20:58:34 2017 +0200
# Node ID c56f424d79532d24531612e5c9550d3f62922ab1
# Parent  9092748ab0a571304ac58163ed1e570b06e0bf9d
# EXP-Topic config.register.acl
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r c56f424d7953
acl: use configlist to retrieve the source config

This is what the previous code was about.
Yuya Nishihara - July 2, 2017, 2:39 p.m.
On Sun, 02 Jul 2017 04:57:39 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1498935514 -7200
> #      Sat Jul 01 20:58:34 2017 +0200
> # Node ID c56f424d79532d24531612e5c9550d3f62922ab1
> # Parent  9092748ab0a571304ac58163ed1e570b06e0bf9d
> # EXP-Topic config.register.acl
> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
> #              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r c56f424d7953
> acl: use configlist to retrieve the source config
> 
> This is what the previous code was about.
> 
> diff --git a/hgext/acl.py b/hgext/acl.py
> --- a/hgext/acl.py
> +++ b/hgext/acl.py
> @@ -219,7 +219,7 @@ configitem('acl', 'config',
>      default=None,
>  )
>  configitem('acl', 'sources',
> -    default='serve',
> +    default=['serve'],
>  )

Nit: this list passed directly to the caller, which might be mutated.

Patch

diff --git a/hgext/acl.py b/hgext/acl.py
--- a/hgext/acl.py
+++ b/hgext/acl.py
@@ -219,7 +219,7 @@  configitem('acl', 'config',
     default=None,
 )
 configitem('acl', 'sources',
-    default='serve',
+    default=['serve'],
 )
 
 def _getusers(ui, group):
@@ -292,7 +292,7 @@  def hook(ui, repo, hooktype, node=None, 
         raise error.Abort(_('config error - hook type "%s" cannot stop '
                            'incoming changesets nor commits') % hooktype)
     if (hooktype == 'pretxnchangegroup' and
-        source not in ui.config('acl', 'sources').split()):
+        source not in ui.configlist('acl', 'sources')):
         ui.debug('acl: changes have source "%s" - skipping\n' % source)
         return