tests/test-parentrevspec
changeset 5191 b111e9a907b1
child 5199 94e77a174f55
equal deleted inserted replaced
5190:da1658d63647 5191:b111e9a907b1
       
     1 #!/bin/sh
       
     2 
       
     3 commit()
       
     4 {
       
     5     msg=$1
       
     6     p1=$2
       
     7     p2=$3
       
     8 
       
     9     if [ "$p1" ]; then
       
    10 	hg up -qC $p1
       
    11     fi
       
    12 
       
    13     if [ "$p2" ]; then
       
    14 	HGMERGE=true hg merge -q $p2
       
    15     fi
       
    16 
       
    17     echo >> foo
       
    18 
       
    19     hg commit -d '0 0' -qAm "$msg" foo
       
    20 }
       
    21 
       
    22 hg init repo
       
    23 cd repo
       
    24 
       
    25 echo '[extensions]' > .hg/hgrc
       
    26 echo 'hgext.parentrevspec =' >> .hg/hgrc
       
    27 
       
    28 commit '0: add foo'
       
    29 commit '1: change foo 1'
       
    30 commit '2: change foo 2a'
       
    31 commit '3: change foo 3a'
       
    32 commit '4: change foo 2b' 1
       
    33 commit '5: merge' 3 4
       
    34 commit '6: change foo again'
       
    35 
       
    36 hg log --template '#rev#:#node|short# #parents#\n'
       
    37 echo
       
    38 
       
    39 lookup()
       
    40 {
       
    41     for rev in "$@"; do
       
    42 	printf "$rev: "
       
    43 	hg id -nr $rev
       
    44     done
       
    45     true
       
    46 }
       
    47 
       
    48 tipnode=`hg id -ir tip`
       
    49 
       
    50 echo 'should work with tag/branch/node/rev'
       
    51 for r in tip default $tipnode 6; do
       
    52     lookup $r^
       
    53 done
       
    54 echo
       
    55 
       
    56 echo 'some random lookups'
       
    57 lookup 6^^ 6^^^ 6^^^^ 6^^^^^ 6^^^^^^ 6^1 6^2 6^^2 6^1^2 6^^3
       
    58 lookup 6~ 6~1 6~2 6~3 6~4 6~5 6~42 6~1^2 6~1^2~2
       
    59 echo
       
    60 
       
    61 echo 'with a tag "6^" pointing to rev 1'
       
    62 hg tag -l -r 1 6^
       
    63 lookup 6^ 6^1 6~1 6^^
       
    64 echo
       
    65 
       
    66 echo 'with a tag "foo^bar" pointing to rev 2'
       
    67 hg tag -l -r 2 foo^bar
       
    68 lookup foo^bar foo^bar^
       
    69