Patchwork [3,of,9,pyflakes] filemerge: avoid shadowing a variable in a list comprehension

login
register
mail settings
Submitter Augie Fackler
Date Nov. 10, 2016, 9:52 p.m.
Message ID <87382e400db545de3001.1478814746@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/17455/
State Accepted
Headers show

Comments

Augie Fackler - Nov. 10, 2016, 9:52 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1478813587 18000
#      Thu Nov 10 16:33:07 2016 -0500
# Node ID 87382e400db545de30015c477a16e682d8ef36c3
# Parent  77dce11c461ed9d6668fbbe6ff2ea1149ded4e94
filemerge: avoid shadowing a variable in a list comprehension
Yuya Nishihara - Nov. 13, 2016, 11:33 a.m.
On Thu, 10 Nov 2016 16:52:26 -0500, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1478813587 18000
> #      Thu Nov 10 16:33:07 2016 -0500
> # Node ID 87382e400db545de30015c477a16e682d8ef36c3
> # Parent  77dce11c461ed9d6668fbbe6ff2ea1149ded4e94
> filemerge: avoid shadowing a variable in a list comprehension
> 
> diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
> --- a/mercurial/filemerge.py
> +++ b/mercurial/filemerge.py
> @@ -189,7 +189,7 @@ def _picktool(repo, ui, path, binary, sy
>          if _toolbool(ui, t, "disabled", False):
>              disabled.add(t)
>      names = tools.keys()
> -    tools = sorted([(-p, t) for t, p in tools.items() if t not in disabled])
> +    tools = sorted([(-p, tool) for tool, p in tools.items() if tool not in disabled])

check-code says line too long. Fixed in flight.

Patch

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -189,7 +189,7 @@  def _picktool(repo, ui, path, binary, sy
         if _toolbool(ui, t, "disabled", False):
             disabled.add(t)
     names = tools.keys()
-    tools = sorted([(-p, t) for t, p in tools.items() if t not in disabled])
+    tools = sorted([(-p, tool) for tool, p in tools.items() if tool not in disabled])
     uimerge = ui.config("ui", "merge")
     if uimerge:
         # external tools defined in uimerge won't be able to handle