##// END OF EJS Templates
revset: eliminate temporary reference to subset in limit() and last()
Yuya Nishihara -
r26636:ff6baf32 default
parent child Browse files
Show More
@@ -1297,7 +1297,6 def limit(repo, subset, x):
1297 except (TypeError, ValueError):
1297 except (TypeError, ValueError):
1298 # i18n: "limit" is a keyword
1298 # i18n: "limit" is a keyword
1299 raise error.ParseError(_("limit expects a number"))
1299 raise error.ParseError(_("limit expects a number"))
1300 ss = subset
1301 os = getset(repo, fullreposet(repo), l[0])
1300 os = getset(repo, fullreposet(repo), l[0])
1302 result = []
1301 result = []
1303 it = iter(os)
1302 it = iter(os)
@@ -1305,7 +1304,7 def limit(repo, subset, x):
1305 y = next(it, None)
1304 y = next(it, None)
1306 if y is None:
1305 if y is None:
1307 break
1306 break
1308 elif y in ss:
1307 elif y in subset:
1309 result.append(y)
1308 result.append(y)
1310 return baseset(result)
1309 return baseset(result)
1311
1310
@@ -1323,7 +1322,6 def last(repo, subset, x):
1323 except (TypeError, ValueError):
1322 except (TypeError, ValueError):
1324 # i18n: "last" is a keyword
1323 # i18n: "last" is a keyword
1325 raise error.ParseError(_("last expects a number"))
1324 raise error.ParseError(_("last expects a number"))
1326 ss = subset
1327 os = getset(repo, fullreposet(repo), l[0])
1325 os = getset(repo, fullreposet(repo), l[0])
1328 os.reverse()
1326 os.reverse()
1329 result = []
1327 result = []
@@ -1332,7 +1330,7 def last(repo, subset, x):
1332 y = next(it, None)
1330 y = next(it, None)
1333 if y is None:
1331 if y is None:
1334 break
1332 break
1335 elif y in ss:
1333 elif y in subset:
1336 result.append(y)
1334 result.append(y)
1337 return baseset(result)
1335 return baseset(result)
1338
1336
General Comments 0
You need to be logged in to leave comments. Login now