Patchwork [1,of,6] revset: remove nullrev from set computed in p1() and p2()

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 18, 2014, 9:40 p.m.
Message ID <a49c721cc8d57a107cb8.1411076454@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5872/
State Accepted
Headers show

Comments

Pierre-Yves David - Sept. 18, 2014, 9:40 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1410954030 25200
#      Wed Sep 17 04:40:30 2014 -0700
# Node ID a49c721cc8d57a107cb883ee1dc3406183a70e1a
# Parent  fe9a4c6649ec5c035c41f563cddfae8e75b31843
revset: remove nullrev from set computed in p1() and p2()

The old code relied on the subset content to get rid of invalid value. We would
like to be able to rely more on the computation in p1() and p2() so we filter out
the invalid value

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1202,10 +1202,11 @@  def p1(repo, subset, x):
 
     ps = set()
     cl = repo.changelog
     for r in getset(repo, spanset(repo), x):
         ps.add(cl.parentrevs(r)[0])
+    ps -= set([node.nullrev])
     return subset & ps
 
 def p2(repo, subset, x):
     """``p2([set])``
     Second parent of changesets in set, or the working directory.
@@ -1220,10 +1221,11 @@  def p2(repo, subset, x):
 
     ps = set()
     cl = repo.changelog
     for r in getset(repo, spanset(repo), x):
         ps.add(cl.parentrevs(r)[1])
+    ps -= set([node.nullrev])
     return subset & ps
 
 def parents(repo, subset, x):
     """``parents([set])``
     The set of all parents for all changesets in set, or the working directory.