revset: refactor parents() into a single return point
Both paths are doing similar thing in the end. We refactor the function so that
the `ps` set is commonly used at the end.
This will end excluding `nullrev` from this set in a future patch
--- a/mercurial/revset.py Wed Sep 17 04:40:30 2014 -0700
+++ b/mercurial/revset.py Wed Sep 17 19:44:03 2014 -0700
@@ -1231,13 +1231,12 @@
The set of all parents for all changesets in set, or the working directory.
"""
if x is None:
- ps = tuple(p.rev() for p in repo[x].parents())
- return subset & ps
-
- ps = set()
- cl = repo.changelog
- for r in getset(repo, spanset(repo), x):
- ps.update(cl.parentrevs(r))
+ ps = set(p.rev() for p in repo[x].parents())
+ else:
+ ps = set()
+ cl = repo.changelog
+ for r in getset(repo, spanset(repo), x):
+ ps.update(cl.parentrevs(r))
return baseset(ps) & subset
def parentspec(repo, subset, x, n):