Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revset.py @ 17804:5a511d255301
clfilter: remove use of xrange in revset
For changelog level filtering to take effect it need to be used for any
iteration. Some remaining use of `xrange` in revset code is replace by proper
use of `changelog.revs` or direct iteration over changelog.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Mon, 08 Oct 2012 15:54:53 +0200 |
parents | 72c234081ae1 |
children | 3cc06457f15e |
comparison
equal
deleted
inserted
replaced
17803:1479572db256 | 17804:5a511d255301 |
---|---|
39 for i in cl: | 39 for i in cl: |
40 yield i | 40 yield i |
41 return | 41 return |
42 | 42 |
43 seen = set(revs) | 43 seen = set(revs) |
44 for i in xrange(first + 1, len(cl)): | 44 for i in cl.revs(first + 1): |
45 for x in cl.parentrevs(i)[:cut]: | 45 for x in cl.parentrevs(i)[:cut]: |
46 if x != nullrev and x in seen: | 46 if x != nullrev and x in seen: |
47 seen.add(i) | 47 seen.add(i) |
48 yield i | 48 yield i |
49 break | 49 break |
1207 specified. You can match more than one field at a time. | 1207 specified. You can match more than one field at a time. |
1208 """ | 1208 """ |
1209 # i18n: "matching" is a keyword | 1209 # i18n: "matching" is a keyword |
1210 l = getargs(x, 1, 2, _("matching takes 1 or 2 arguments")) | 1210 l = getargs(x, 1, 2, _("matching takes 1 or 2 arguments")) |
1211 | 1211 |
1212 revs = getset(repo, xrange(len(repo)), l[0]) | 1212 revs = getset(repo, repo.changelog, l[0]) |
1213 | 1213 |
1214 fieldlist = ['metadata'] | 1214 fieldlist = ['metadata'] |
1215 if len(l) > 1: | 1215 if len(l) > 1: |
1216 fieldlist = getstring(l[1], | 1216 fieldlist = getstring(l[1], |
1217 # i18n: "matching" is a keyword | 1217 # i18n: "matching" is a keyword |
1305 | 1305 |
1306 def roots(repo, subset, x): | 1306 def roots(repo, subset, x): |
1307 """``roots(set)`` | 1307 """``roots(set)`` |
1308 Changesets in set with no parent changeset in set. | 1308 Changesets in set with no parent changeset in set. |
1309 """ | 1309 """ |
1310 s = set(getset(repo, xrange(len(repo)), x)) | 1310 s = set(getset(repo, repo.changelog, x)) |
1311 subset = [r for r in subset if r in s] | 1311 subset = [r for r in subset if r in s] |
1312 cs = _children(repo, subset, s) | 1312 cs = _children(repo, subset, s) |
1313 return [r for r in subset if r not in cs] | 1313 return [r for r in subset if r not in cs] |
1314 | 1314 |
1315 def secret(repo, subset, x): | 1315 def secret(repo, subset, x): |