comparison tests/test-revset-dirstate-parents.t @ 12928:a5f7f1e9340e

revsets: let p1() and p2() return parents of working dir This patch makes the 'set' argument to revset functions p1() and p2() optional. If no argument is given, p1() and p2() return the first or second parent of the working directory. If the working directory is not an in-progress merge (no 2nd parent), p2() returns the empty set. For a checkout of the null changeset, both p1() and p2() return the empty set.
author Kevin Bullock <kbullock@ringworld.org>
date Thu, 04 Nov 2010 16:59:03 -0500
parents
children 515c2786e1cf
comparison
equal deleted inserted replaced
12927:b6245c2470a9 12928:a5f7f1e9340e
1 $ HGENCODING=utf-8
2 $ export HGENCODING
3
4 $ try() {
5 > hg debugrevspec --debug $@
6 > }
7
8 $ log() {
9 > hg log --template '{rev}\n' -r "$1"
10 > }
11
12 $ hg init repo
13 $ cd repo
14
15 $ try 'p1()'
16 ('func', ('symbol', 'p1'), None)
17 -1
18 $ try 'p2()'
19 ('func', ('symbol', 'p2'), None)
20
21 null revision
22 $ log 'p1()'
23 $ log 'p2()'
24
25 working dir with a single parent
26 $ echo a > a
27 $ hg ci -Aqm0
28 $ log 'p1()'
29 0
30 $ log 'p2()'
31
32 merge in progress
33 $ echo b > b
34 $ hg ci -Aqm1
35 $ hg up -q 0
36 $ echo c > c
37 $ hg ci -Aqm2
38 $ hg merge -q
39 $ log 'p1()'
40 2
41 $ log 'p2()'
42 1