Patchwork censor: rename loop variable to silence pyflakes warning

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 15, 2018, 1:50 a.m.
Message ID <3a3364720695f26ceee3.1536976248@mimosa>
Download mbox | patch
Permalink /patch/34661/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 15, 2018, 1:50 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1536975300 -32400
#      Sat Sep 15 10:35:00 2018 +0900
# Node ID 3a3364720695f26ceee3cd0a056fda59251f4ca5
# Parent  6ecfd12f09cd4fe185ebbc98d254534ebd995b68
censor: rename loop variable to silence pyflakes warning

hgext/censor.py:92: list comprehension redefines 'c' from line 88
Gregory Szorc - Sept. 16, 2018, 9:39 p.m.
On Fri, Sep 14, 2018 at 6:52 PM Yuya Nishihara <yuya@tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1536975300 -32400
> #      Sat Sep 15 10:35:00 2018 +0900
> # Node ID 3a3364720695f26ceee3cd0a056fda59251f4ca5
> # Parent  6ecfd12f09cd4fe185ebbc98d254534ebd995b68
> censor: rename loop variable to silence pyflakes warning
>

Queued, thanks.


>
> hgext/censor.py:92: list comprehension redefines 'c' from line 88
>
> diff --git a/hgext/censor.py b/hgext/censor.py
> --- a/hgext/censor.py
> +++ b/hgext/censor.py
> @@ -85,9 +85,9 @@ def _docensor(ui, repo, path, rev='', to
>      fnode = fctx.filenode()
>      heads = []
>      for headnode in repo.heads():
> -        c = repo[headnode]
> -        if path in c and c.filenode(path) == fnode:
> -            heads.append(c)
> +        hc = repo[headnode]
> +        if path in hc and hc.filenode(path) == fnode:
> +            heads.append(hc)
>      if heads:
>          headlist = ', '.join([short(c.node()) for c in heads])
>          raise error.Abort(_('cannot censor file in heads (%s)') %
> headlist,
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/hgext/censor.py b/hgext/censor.py
--- a/hgext/censor.py
+++ b/hgext/censor.py
@@ -85,9 +85,9 @@  def _docensor(ui, repo, path, rev='', to
     fnode = fctx.filenode()
     heads = []
     for headnode in repo.heads():
-        c = repo[headnode]
-        if path in c and c.filenode(path) == fnode:
-            heads.append(c)
+        hc = repo[headnode]
+        if path in hc and hc.filenode(path) == fnode:
+            heads.append(hc)
     if heads:
         headlist = ', '.join([short(c.node()) for c in heads])
         raise error.Abort(_('cannot censor file in heads (%s)') % headlist,