Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 22539:6f434ef54222
revset: use `subset &` in bare `p2()`
This takes advantage of the `fullreposet` smartness with a nice
speedup. It's a similar speedup to `p1()` when a merge is in progress
(the non merge case is already lightning fast anyway.)
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 17 Sep 2014 11:00:03 -0700 |
parents | a428db9ab61d |
children | 00c8abe64cf3 |
comparison
equal
deleted
inserted
replaced
22538:a428db9ab61d | 22539:6f434ef54222 |
---|---|
1215 """ | 1215 """ |
1216 if x is None: | 1216 if x is None: |
1217 ps = repo[x].parents() | 1217 ps = repo[x].parents() |
1218 try: | 1218 try: |
1219 p = ps[1].rev() | 1219 p = ps[1].rev() |
1220 return subset.filter(lambda r: r == p) | 1220 if p >= 0: |
1221 return subset & baseset([p]) | |
1222 return baseset([]) | |
1221 except IndexError: | 1223 except IndexError: |
1222 return baseset([]) | 1224 return baseset([]) |
1223 | 1225 |
1224 ps = set() | 1226 ps = set() |
1225 cl = repo.changelog | 1227 cl = repo.changelog |