changeset 22496:35af9361a049

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
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 17 Sep 2014 19:44:03 -0700
parents 668b26d32bf6
children 8ea3f47bcaff
files mercurial/revset.py
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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):