Patchwork cmdutil: avoid recycling variable name "name" in namespaces code

login
register
mail settings
Submitter Augie Fackler
Date April 14, 2016, 7:29 p.m.
Message ID <5887cc01e877d1e486a3.1460662183@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/14633/
State Accepted
Headers show

Comments

Augie Fackler - April 14, 2016, 7:29 p.m.
# HG changeset patch
# User Nathaniel Manista <nathaniel@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.
timeless - April 14, 2016, 8:16 p.m.
Makes sense
On Apr 14, 2016 3:29 PM, "Augie Fackler" <raf@durin42.com> wrote:

> # HG changeset patch
> # User Nathaniel Manista <nathaniel@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@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
Sean Farley - April 14, 2016, 8:36 p.m.
Augie Fackler <raf@durin42.com> writes:

> # HG changeset patch
> # User Nathaniel Manista <nathaniel@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.

Sure, why not.
Pierre-Yves David - April 14, 2016, 8:51 p.m.
Pushed, thanks

On 04/14/2016 01:16 PM, timeless wrote:
>
> Makes sense
>
> On Apr 14, 2016 3:29 PM, "Augie Fackler" <raf@durin42.com 
> <mailto:raf@durin42.com>> wrote:
>
>     # HG changeset patch
>     # User Nathaniel Manista <nathaniel@google.com
>     <mailto:nathaniel@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@mercurial-scm.org
>     <mailto:Mercurial-devel@mercurial-scm.org>
>     https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
>
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

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