changeset 22201:269688a398c4

cleanup: fix some list comprehension redefinitions of existing vars In all the remaining cases the comprehension variable is used for the same thing as a previous loop variable. This will mute some pyflakes "list comprehension redefines" warnings.
author Mads Kiilerich <madski@unity3d.com>
date Fri, 15 Aug 2014 04:37:46 +0200
parents b27c3beaaf30
children 684bad8c4265
files hgext/convert/subversion.py mercurial/commands.py mercurial/context.py mercurial/localrepo.py mercurial/wireproto.py
diffstat 5 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/subversion.py	Fri Aug 15 16:20:47 2014 +0200
+++ b/hgext/convert/subversion.py	Fri Aug 15 04:37:46 2014 +0200
@@ -490,10 +490,10 @@
             self._fetch_revisions(revnum, stop)
             if rev not in self.commits:
                 raise util.Abort(_('svn: revision %s not found') % revnum)
-        commit = self.commits[rev]
+        revcommit = self.commits[rev]
         # caller caches the result, so free it here to release memory
         del self.commits[rev]
-        return commit
+        return revcommit
 
     def checkrevformat(self, revstr, mapname='splicemap'):
         """ fails if revision format does not match the correct format"""
--- a/mercurial/commands.py	Fri Aug 15 16:20:47 2014 +0200
+++ b/mercurial/commands.py	Fri Aug 15 04:37:46 2014 +0200
@@ -5593,7 +5593,7 @@
         ui.write(_('commit: %s\n') % t.strip())
 
     # all ancestors of branch heads - all ancestors of parent = new csets
-    new = len(repo.changelog.findmissing([ctx.node() for ctx in parents],
+    new = len(repo.changelog.findmissing([pctx.node() for pctx in parents],
                                          bheads))
 
     if new == 0:
--- a/mercurial/context.py	Fri Aug 15 16:20:47 2014 +0200
+++ b/mercurial/context.py	Fri Aug 15 04:37:46 2014 +0200
@@ -735,9 +735,9 @@
         return True
 
     def parents(self):
-        p = self._path
+        _path = self._path
         fl = self._filelog
-        pl = [(p, n, fl) for n in self._filelog.parents(self._filenode)]
+        pl = [(_path, n, fl) for n in self._filelog.parents(self._filenode)]
 
         r = self._filelog.renamed(self._filenode)
         if r:
--- a/mercurial/localrepo.py	Fri Aug 15 16:20:47 2014 +0200
+++ b/mercurial/localrepo.py	Fri Aug 15 04:37:46 2014 +0200
@@ -676,8 +676,7 @@
         if not self._tagscache.tagslist:
             l = []
             for t, n in self.tags().iteritems():
-                r = self.changelog.rev(n)
-                l.append((r, t, n))
+                l.append((self.changelog.rev(n), t, n))
             self._tagscache.tagslist = [(t, n) for r, t, n in sorted(l)]
 
         return self._tagscache.tagslist
--- a/mercurial/wireproto.py	Fri Aug 15 16:20:47 2014 +0200
+++ b/mercurial/wireproto.py	Fri Aug 15 04:37:46 2014 +0200
@@ -249,7 +249,7 @@
         yield {'nodes': encodelist(nodes)}, f
         d = f.value
         try:
-            yield [bool(int(f)) for f in d]
+            yield [bool(int(b)) for b in d]
         except ValueError:
             self._abort(error.ResponseError(_("unexpected response:"), d))