Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 22495:668b26d32bf6
revset: remove nullrev from set computed in p1() and p2()
The old code relied on the subset contents to get rid of invalid values. We would
like to be able to rely more on the computation in p1() and p2() so we filter out
the invalid value
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 17 Sep 2014 04:40:30 -0700 |
parents | 14f6cebfcb8a |
children | 35af9361a049 |
comparison
equal
deleted
inserted
replaced
22494:14f6cebfcb8a | 22495:668b26d32bf6 |
---|---|
1202 | 1202 |
1203 ps = set() | 1203 ps = set() |
1204 cl = repo.changelog | 1204 cl = repo.changelog |
1205 for r in getset(repo, spanset(repo), x): | 1205 for r in getset(repo, spanset(repo), x): |
1206 ps.add(cl.parentrevs(r)[0]) | 1206 ps.add(cl.parentrevs(r)[0]) |
1207 ps -= set([node.nullrev]) | |
1207 return subset & ps | 1208 return subset & ps |
1208 | 1209 |
1209 def p2(repo, subset, x): | 1210 def p2(repo, subset, x): |
1210 """``p2([set])`` | 1211 """``p2([set])`` |
1211 Second parent of changesets in set, or the working directory. | 1212 Second parent of changesets in set, or the working directory. |
1220 | 1221 |
1221 ps = set() | 1222 ps = set() |
1222 cl = repo.changelog | 1223 cl = repo.changelog |
1223 for r in getset(repo, spanset(repo), x): | 1224 for r in getset(repo, spanset(repo), x): |
1224 ps.add(cl.parentrevs(r)[1]) | 1225 ps.add(cl.parentrevs(r)[1]) |
1226 ps -= set([node.nullrev]) | |
1225 return subset & ps | 1227 return subset & ps |
1226 | 1228 |
1227 def parents(repo, subset, x): | 1229 def parents(repo, subset, x): |
1228 """``parents([set])`` | 1230 """``parents([set])`` |
1229 The set of all parents for all changesets in set, or the working directory. | 1231 The set of all parents for all changesets in set, or the working directory. |