Patchwork [1,of,3] revset: eliminate temporary reference to subset in limit() and last()

login
register
mail settings
Submitter Yuya Nishihara
Date Oct. 13, 2015, 3:57 p.m.
Message ID <bbddf707ae6cb5806524.1444751844@mimosa>
Download mbox | patch
Permalink /patch/11007/
State Accepted
Headers show

Comments

Yuya Nishihara - Oct. 13, 2015, 3:57 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1444637687 -32400
#      Mon Oct 12 17:14:47 2015 +0900
# Node ID bbddf707ae6cb58065249f14bc8e0fcf2c8e004e
# Parent  5a95fe44121d96805daacb2d9a84b947d8c68a03
revset: eliminate temporary reference to subset in limit() and last()

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1297,7 +1297,6 @@  def limit(repo, subset, x):
     except (TypeError, ValueError):
         # i18n: "limit" is a keyword
         raise error.ParseError(_("limit expects a number"))
-    ss = subset
     os = getset(repo, fullreposet(repo), l[0])
     result = []
     it = iter(os)
@@ -1305,7 +1304,7 @@  def limit(repo, subset, x):
         y = next(it, None)
         if y is None:
             break
-        elif y in ss:
+        elif y in subset:
             result.append(y)
     return baseset(result)
 
@@ -1323,7 +1322,6 @@  def last(repo, subset, x):
     except (TypeError, ValueError):
         # i18n: "last" is a keyword
         raise error.ParseError(_("last expects a number"))
-    ss = subset
     os = getset(repo, fullreposet(repo), l[0])
     os.reverse()
     result = []
@@ -1332,7 +1330,7 @@  def last(repo, subset, x):
         y = next(it, None)
         if y is None:
             break
-        elif y in ss:
+        elif y in subset:
             result.append(y)
     return baseset(result)