tests/test-parentrevspec.t
author Matt Mackall <mpm@selenic.com>
Fri, 25 Feb 2011 15:31:32 -0600
branchstable
changeset 13481 4eb1e9d6a7c9
parent 12925 6eab8f0df2ca
permissions -rw-r--r--
context: be even more careful about result order in ancestors() (issue2642) The earlier patch could be confused by more complicated topologies.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5194
b111e9a907b1 Add parentrevspec extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     1
12475
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     2
  $ commit()
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     3
  > {
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     4
  >     msg=$1
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     5
  >     p1=$2
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     6
  >     p2=$3
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     7
  > 
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     8
  >     if [ "$p1" ]; then
12743
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12475
diff changeset
     9
  >         hg up -qC $p1
12475
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    10
  >     fi
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    11
  > 
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    12
  >     if [ "$p2" ]; then
12743
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12475
diff changeset
    13
  >         HGMERGE=true hg merge -q $p2
12475
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    14
  >     fi
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    15
  > 
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    16
  >     echo >> foo
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    17
  > 
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    18
  >     hg commit -qAm "$msg"
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    19
  > }
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    20
  $ hg init repo
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    21
  $ cd repo
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    22
  $ echo '[extensions]' > .hg/hgrc
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    23
  $ echo 'parentrevspec =' >> .hg/hgrc
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    24
  $ commit '0: add foo'
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    25
  $ commit '1: change foo 1'
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    26
  $ commit '2: change foo 2a'
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    27
  $ commit '3: change foo 3a'
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    28
  $ commit '4: change foo 2b' 1
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    29
  $ commit '5: merge' 3 4
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    30
  $ commit '6: change foo again'
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    31
  $ hg log --template '{rev}:{node|short} {parents}\n'
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    32
  6:755d1e0d79e9 
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    33
  5:9ce2ce29723a 3:a3e00c7dbf11 4:bb4475edb621 
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    34
  4:bb4475edb621 1:5d953a1917d1 
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    35
  3:a3e00c7dbf11 
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    36
  2:befc7d89d081 
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    37
  1:5d953a1917d1 
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    38
  0:837088b6e1d9 
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    39
  $ echo
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    40
  
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    41
  $ lookup()
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    42
  > {
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    43
  >     for rev in "$@"; do
12743
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12475
diff changeset
    44
  >         printf "$rev: "
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12475
diff changeset
    45
  >         hg id -nr $rev
12475
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    46
  >     done
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    47
  >     true
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    48
  > }
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    49
  $ tipnode=`hg id -ir tip`
5194
b111e9a907b1 Add parentrevspec extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    50
12475
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    51
should work with tag/branch/node/rev
5194
b111e9a907b1 Add parentrevspec extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    52
12475
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    53
  $ for r in tip default $tipnode 6; do
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    54
  >     lookup "$r^"
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    55
  > done
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    56
  tip^: 5
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    57
  default^: 5
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    58
  755d1e0d79e9^: 5
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    59
  6^: 5
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    60
  $ echo
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    61
  
5194
b111e9a907b1 Add parentrevspec extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    62
12475
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    63
some random lookups
5194
b111e9a907b1 Add parentrevspec extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    64
12475
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    65
  $ lookup "6^^" "6^^^" "6^^^^" "6^^^^^" "6^^^^^^" "6^1" "6^2" "6^^2" "6^1^2" "6^^3"
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    66
  6^^: 3
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    67
  6^^^: 2
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    68
  6^^^^: 1
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    69
  6^^^^^: 0
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    70
  6^^^^^^: -1
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    71
  6^1: 5
12925
6eab8f0df2ca commands: add revset support to most commands
Matt Mackall <mpm@selenic.com>
parents: 12743
diff changeset
    72
  6^2: hg: parse error at 1: syntax error
12475
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    73
  6^^2: 4
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    74
  6^1^2: 4
12925
6eab8f0df2ca commands: add revset support to most commands
Matt Mackall <mpm@selenic.com>
parents: 12743
diff changeset
    75
  6^^3: hg: parse error at 1: syntax error
12475
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    76
  $ lookup "6~" "6~1" "6~2" "6~3" "6~4" "6~5" "6~42" "6~1^2" "6~1^2~2"
12925
6eab8f0df2ca commands: add revset support to most commands
Matt Mackall <mpm@selenic.com>
parents: 12743
diff changeset
    77
  6~: hg: parse error at 1: syntax error
12475
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    78
  6~1: 5
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    79
  6~2: 3
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    80
  6~3: 2
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    81
  6~4: 1
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    82
  6~5: 0
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    83
  6~42: -1
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    84
  6~1^2: 4
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    85
  6~1^2~2: 0
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    86
  $ echo
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    87
  
5194
b111e9a907b1 Add parentrevspec extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    88
12475
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    89
with a tag "6^" pointing to rev 1
5194
b111e9a907b1 Add parentrevspec extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    90
12475
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    91
  $ hg tag -l -r 1 "6^"
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    92
  $ lookup "6^" "6^1" "6~1" "6^^"
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    93
  6^: 1
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    94
  6^1: 5
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    95
  6~1: 5
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    96
  6^^: 3
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    97
  $ echo
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    98
  
5194
b111e9a907b1 Add parentrevspec extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    99
12475
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   100
with a tag "foo^bar" pointing to rev 2
5194
b111e9a907b1 Add parentrevspec extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
   101
12475
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   102
  $ hg tag -l -r 2 "foo^bar"
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   103
  $ lookup "foo^bar" "foo^bar^"
c2b7bee11410 tests: unify test-parentrevspec
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
   104
  foo^bar: 2
12925
6eab8f0df2ca commands: add revset support to most commands
Matt Mackall <mpm@selenic.com>
parents: 12743
diff changeset
   105
  foo^bar^: hg: parse error at 3: syntax error