[PATCH] cmdutil: avoid recycling variable name "name" in namespaces code

timeless timeless at gmail.com
Thu Apr 14 16:16:53 EDT 2016


Makes sense
On Apr 14, 2016 3:29 PM, "Augie Fackler" <raf at durin42.com> wrote:

> # HG changeset patch
> # User Nathaniel Manista <nathaniel at google.com>
> # Date 1460661978 14400
> #      Thu Apr 14 15:26:18 2016 -0400
> # Node ID 5887cc01e877d1e486a3bd9ca47fc39e3735a8c0
> # Parent  99a2bdad0fda4fe16830376ad81c1065a5080cb9
> cmdutil: avoid recycling variable name "name" in namespaces code
>
> This just feels like asking for future trouble and confusion.
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -1275,10 +1275,10 @@ class changeset_printer(object):
>              self.ui.write(_("branch:      %s\n") % branch,
>                            label='log.branch')
>
> -        for name, ns in self.repo.names.iteritems():
> +        for nsname, ns in self.repo.names.iteritems():
>              # branches has special logic already handled above, so here
> we just
>              # skip it
> -            if name == 'branches':
> +            if nsname == 'branches':
>                  continue
>              # we will use the templatename as the color name since those
> two
>              # should be the same
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160414/f6879bd9/attachment.html>


More information about the Mercurial-devel mailing list