tests/test-revset-dirstate-parents.t
author Kevin Bullock <kbullock@ringworld.org>
Thu, 04 Nov 2010 16:59:03 -0500
changeset 12928 a5f7f1e9340e
child 12929 515c2786e1cf
permissions -rw-r--r--
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.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12928
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
     1
  $ HGENCODING=utf-8
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
     2
  $ export HGENCODING
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
     3
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
     4
  $ try() {
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
     5
  >   hg debugrevspec --debug $@
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
     6
  > }
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
     7
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
     8
  $ log() {
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
     9
  >   hg log --template '{rev}\n' -r "$1"
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    10
  > }
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    11
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    12
  $ hg init repo
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    13
  $ cd repo
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    14
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    15
  $ try 'p1()'
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    16
  ('func', ('symbol', 'p1'), None)
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    17
  -1
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    18
  $ try 'p2()'
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    19
  ('func', ('symbol', 'p2'), None)
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    20
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    21
null revision
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    22
  $ log 'p1()'
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    23
  $ log 'p2()'
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    24
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    25
working dir with a single parent
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    26
  $ echo a > a
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    27
  $ hg ci -Aqm0
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    28
  $ log 'p1()'
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    29
  0
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    30
  $ log 'p2()'
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    31
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    32
merge in progress
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    33
  $ echo b > b
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    34
  $ hg ci -Aqm1
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    35
  $ hg up -q 0
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    36
  $ echo c > c
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    37
  $ hg ci -Aqm2
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    38
  $ hg merge -q
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    39
  $ log 'p1()'
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    40
  2
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    41
  $ log 'p2()'
a5f7f1e9340e revsets: let p1() and p2() return parents of working dir
Kevin Bullock <kbullock@ringworld.org>
parents:
diff changeset
    42
  1