Patchwork [1,of,6,EVOLVE,V2] evolve: do not use _ as an unused variable

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date July 4, 2014, 2:37 p.m.
Message ID <d5d92a9e25a89df42dc5.1404484645@Iris>
Download mbox | patch
Permalink /patch/5100/
State Not Applicable
Headers show

Comments

Jordi Gutiérrez Hermoso - July 4, 2014, 2:37 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1404480553 14400
#      Fri Jul 04 09:29:13 2014 -0400
# Node ID d5d92a9e25a89df42dc53d037cf6237b62b76bca
# Parent  404a000bb38b0139ad93feb4327a5f2d1ea8c0f8
evolve: do not use _ as an unused variable

The _ variable is the i18n function from core Mercurial, so locally
assigning to it can lead to name clashes.
Pierre-Yves David - July 4, 2014, 3:56 p.m.
On 07/04/2014 04:37 PM, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> # Date 1404480553 14400
> #      Fri Jul 04 09:29:13 2014 -0400
> # Node ID d5d92a9e25a89df42dc53d037cf6237b62b76bca
> # Parent  404a000bb38b0139ad93feb4327a5f2d1ea8c0f8
> evolve: do not use _ as an unused variable

Pushed after a few fix, Thanks.

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -454,7 +454,7 @@  def revsettroubled(repo, subset, x):
     """``troubled()``
     Changesets with troubles.
     """
-    _ = revset.getargs(x, 0, 0, 'troubled takes no arguments')
+    revset.getargs(x, 0, 0, 'troubled takes no arguments')
     return repo.revs('%ld and (unstable() + bumped() + divergent())',
                      subset)
 
@@ -2057,9 +2057,9 @@  def touch(ui, repo, *revs, **opts):
                 p2 = ctx.p2().node()
                 p1 = newmapping.get(p1, p1)
                 p2 = newmapping.get(p2, p2)
-                new, _ = rewrite(repo, ctx, [], ctx,
-                                 [p1, p2],
-                                 commitopts={'extra': extra})
+                new, unusedvariable = rewrite(repo, ctx, [], ctx,
+                                              [p1, p2],
+                                              commitopts={'extra': extra})
                 # store touched version to help potential children
                 newmapping[ctx.node()] = new
                 if not duplicate:
@@ -2129,9 +2129,9 @@  def fold(ui, repo, *revs, **opts):
                 commitopts['message'] =  "\n".join(msgs)
                 commitopts['edit'] = True
 
-            newid, _ = rewrite(repo, root, allctx, head,
-                             [root.p1().node(), root.p2().node()],
-                             commitopts=commitopts)
+            newid, unusedvariable = rewrite(repo, root, allctx, head,
+                                            [root.p1().node(), root.p2().node()],
+                                            commitopts=commitopts)
             phases.retractboundary(repo, targetphase, [newid])
             createmarkers(repo, [(ctx, (repo[newid],))
                                  for ctx in allctx])