tests/test-revset-dirstate-parents.t
author Kevin Bullock <kbullock@ringworld.org>
Thu, 04 Nov 2010 17:09:00 -0500
changeset 12929 515c2786e1cf
parent 12928 a5f7f1e9340e
child 12935 98b79c892768
permissions -rw-r--r--
revsets: let parents() return parents of working dir This patch makes the 'set' argument to revset function parents() optional. Like p1() and p2(), if no argument is given, returns the parent(s) of the working directory. Morally equivalent to 'p1()+p2()', as expected.

  $ 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()'
  $ log 'parents()'

working dir with a single parent
  $ echo a > a
  $ hg ci -Aqm0
  $ log 'p1()'
  0
  $ log 'p2()'
  $ log 'parents()'
  0

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
  $ log 'parents()'
  2
  1