changeset 12935:98b79c892768

revset: fix p1, p2 and parents in dirstate case (a5f7f1e9340e) - Handle 'subset' argument - Stop returning the null rev from p1 and parents, as in the non-dirstate case - Order parents as in the non-dirstate case (ascending revs)
author Patrick Mezard <pmezard@gmail.com>
date Sun, 07 Nov 2010 18:14:42 +0100
parents 7a2bca0b1e70
children bdb766e64d35
files mercurial/revset.py tests/test-revset-dirstate-parents.t
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Fri Nov 05 15:38:23 2010 -0500
+++ b/mercurial/revset.py	Sun Nov 07 18:14:42 2010 +0100
@@ -206,7 +206,8 @@
     First parent of changesets in set, or the working directory.
     """
     if x is None:
-        return [repo[x].parents()[0].rev()]
+        p = repo[x].parents()[0].rev()
+        return [r for r in subset if r == p]
 
     ps = set()
     cl = repo.changelog
@@ -221,7 +222,8 @@
     if x is None:
         ps = repo[x].parents()
         try:
-            return [ps[1].rev()]
+            p = ps[1].rev()
+            return [r for r in subset if r == p]
         except IndexError:
             return []
 
@@ -237,7 +239,8 @@
     """
     repo.ui.debug(repr(x), '\n')
     if x is None:
-        return [r.rev() for r in repo[x].parents()]
+        ps = tuple(p.rev() for p in repo[x].parents())
+        return [r for r in subset if r in ps]
 
     ps = set()
     cl = repo.changelog
--- a/tests/test-revset-dirstate-parents.t	Fri Nov 05 15:38:23 2010 -0500
+++ b/tests/test-revset-dirstate-parents.t	Sun Nov 07 18:14:42 2010 +0100
@@ -14,9 +14,11 @@
 
   $ try 'p1()'
   ('func', ('symbol', 'p1'), None)
-  -1
   $ try 'p2()'
   ('func', ('symbol', 'p2'), None)
+  $ try 'parents()'
+  ('func', ('symbol', 'parents'), None)
+  None
 
 null revision
   $ log 'p1()'
@@ -28,9 +30,11 @@
   $ hg ci -Aqm0
   $ log 'p1()'
   0
+  $ log 'tag() and p1()'
   $ log 'p2()'
   $ log 'parents()'
   0
+  $ log 'tag() and parents()'
 
 merge in progress
   $ echo b > b
@@ -43,6 +47,7 @@
   2
   $ log 'p2()'
   1
+  $ log 'tag() and p2()'
   $ log 'parents()'
+  1
   2
-  1