##// END OF EJS Templates
revsets: let p1() and p2() return parents of working dir...
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.

File last commit:

r12928:a5f7f1e9 default
r12928:a5f7f1e9 default
Show More
test-revset-dirstate-parents.t
42 lines | 586 B | text/troff | Tads3Lexer
/ tests / test-revset-dirstate-parents.t
$ HGENCODING=utf-8
$ export HGENCODING
$ try() {
> hg debugrevspec --debug $@
> }
$ log() {
> hg log --template '{rev}\n' -r "$1"
> }
$ hg init repo
$ cd repo
$ try 'p1()'
('func', ('symbol', 'p1'), None)
-1
$ try 'p2()'
('func', ('symbol', 'p2'), None)
null revision
$ log 'p1()'
$ log 'p2()'
working dir with a single parent
$ echo a > a
$ hg ci -Aqm0
$ log 'p1()'
0
$ log 'p2()'
merge in progress
$ echo b > b
$ hg ci -Aqm1
$ hg up -q 0
$ echo c > c
$ hg ci -Aqm2
$ hg merge -q
$ log 'p1()'
2
$ log 'p2()'
1