# HG changeset patch # User Pierre-Yves David # Date 1411008243 25200 # Node ID 35af9361a049ad2e8c59a8b985cf7a7bc563c486 # Parent 668b26d32bf68e610430930c203abe45633c47af 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 diff -r 668b26d32bf6 -r 35af9361a049 mercurial/revset.py --- 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):