Patchwork repair: define explicit local variable, don't reuse a comprehension variable

login
register
mail settings
Submitter adgar@google.com
Date March 10, 2015, 8:26 p.m.
Message ID <f62035326469b8e72d0e.1426019189@adgar.nyc.corp.google.com>
Download mbox | patch
Permalink /patch/7977/
State Accepted
Commit f962692853c07855b9ab343029d1e9643f5cc298
Headers show

Comments

adgar@google.com - March 10, 2015, 8:26 p.m.
# HG changeset patch
# User Mike Edgar <adgar@google.com>
# Date 1426019110 14400
#      Tue Mar 10 16:25:10 2015 -0400
# Node ID f62035326469b8e72d0e72166400c9f9226a6bb8
# Parent  02d7b5cd373bbb4e8263dad9bfbf9c4c3b0e4e3a
repair: define explicit local variable, don't reuse a comprehension variable

The node ID used in strip bundle names is currently taken as the last
iterated value in a list comprehension found much earlier in the function.
This change makes the node selection more explicit at the cost of redundancy.
Pierre-Yves David - March 10, 2015, 8:39 p.m.
On 03/10/2015 01:26 PM, Mike Edgar wrote:
> # HG changeset patch
> # User Mike Edgar <adgar@google.com>
> # Date 1426019110 14400
> #      Tue Mar 10 16:25:10 2015 -0400
> # Node ID f62035326469b8e72d0e72166400c9f9226a6bb8
> # Parent  02d7b5cd373bbb4e8263dad9bfbf9c4c3b0e4e3a
> repair: define explicit local variable, don't reuse a comprehension variable
>
> The node ID used in strip bundle names is currently taken as the last
> iterated value in a list comprehension found much earlier in the function.
> This change makes the node selection more explicit at the cost of redundancy.
>
> diff -r 02d7b5cd373b -r f62035326469 mercurial/repair.py
> --- a/mercurial/repair.py	Tue Feb 10 15:59:12 2015 -0500
> +++ b/mercurial/repair.py	Tue Mar 10 16:25:10 2015 -0400
> @@ -137,6 +137,7 @@
>       # create a changegroup for all the branches we need to keep
>       backupfile = None
>       vfs = repo.vfs
> +    node = nodelist[-1]


-sure-

Pushed to the clowncopter.

Patch

diff -r 02d7b5cd373b -r f62035326469 mercurial/repair.py
--- a/mercurial/repair.py	Tue Feb 10 15:59:12 2015 -0500
+++ b/mercurial/repair.py	Tue Mar 10 16:25:10 2015 -0400
@@ -137,6 +137,7 @@ 
     # create a changegroup for all the branches we need to keep
     backupfile = None
     vfs = repo.vfs
+    node = nodelist[-1]
     if backup:
         backupfile = _bundle(repo, stripbases, cl.heads(), node, topic)
         repo.ui.status(_("saved backup bundle to %s\n") %