[PATCH] Fixing the treatment of reposubs (according to what happens for usersubs.

Matt Mackall mpm at selenic.com
Mon Feb 6 14:48:54 CST 2012


You have a bizarre character in your "Subject:" line.

On Sun, 2012-02-05 at 15:59 +0100, Massimo Santini wrote:
> hgext.nofity: striping spaces after splitting on ',' the config value (related to issue2603)

> When reading the configuration values for reposubs and usersubs split
> is performed, but then strip is only applied to parts for the
> usersubs; this causes a difference in behavior that can confuse the
> user.

This text counts for nothing because it will not be preserved in the
repository history.

> # HG changeset patch
> # User Massimo Santini <santini at dsi.unimi.it>
> # Date 1328452205 -3600
> # Node ID 45111f1cf4bc23aa2a576dccce1773ac0e044feb
> # Parent  8af9e08a094ff43f828085e1102b320995e0c1b2
> Adding strip to repo path in reposub processing

This is the text that matters, and it is not in the appropriate style
like your first line (almost) is.

Note that the commit robot cannot be expected to make sense of "(related
to issue2603)".

I don't see that this is actually related to that issue anyway? In fact,
what issue this patch is trying to fix is a bit of a mystery as the
regex used for config parsing is:

        itemre = re.compile(r'([^=\s][^=]*?)\s*=\s*(.*\S|)')

This pattern says that config keys:

- start with any character other than = or whitespace
- contain any number of non-= characters (including whitespace)
- but because that's a non-greedy match (*?), we treat any trailing
whitespace as part of the \s*= separator

So why would we ever need to strip a pattern? Give us an example of what
this fixes.

> diff -r 8af9e08a094f -r 45111f1cf4bc hgext/notify.py
> --- a/hgext/notify.py	Fri Feb 03 15:45:13 2012 -0600
> +++ b/hgext/notify.py	Sun Feb 05 15:30:05 2012 +0100
> @@ -214,7 +214,7 @@
>                  if fnmatch.fnmatch(self.repo.root, pat.strip()):
>                      subs.add(self.fixmail(user))
>          for pat, users in self.ui.configitems('reposubs'):
> -            if fnmatch.fnmatch(self.repo.root, pat):
> +            if fnmatch.fnmatch(self.repo.root, pat.strip()):
>                  for user in users.split(','):
>                      subs.add(self.fixmail(user))
>          return [mail.addressencode(self.ui, s, self.charsets, self.test)
> 
> 
> 
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list