tests/test-bheads
changeset 6127 25c372e8f261
parent 4648 8e503fa54d2d
child 8523 5b7da468531b
equal deleted inserted replaced
6126:11a09d5779f4 6127:25c372e8f261
     1 #!/bin/sh
     1 #!/bin/sh
       
     2 
       
     3 heads()
       
     4 {
       
     5     hg heads --template '#rev#: #desc|firstline|strip#\n' "$@"
       
     6 }
     2 
     7 
     3 hg init a
     8 hg init a
     4 cd a
     9 cd a
     5 echo 'root' >root
    10 echo 'root' >root
     6 hg add root
    11 hg add root
     7 hg commit -d '0 0' -u test -m "Adding root node"
    12 hg commit -m "Adding root node"
     8 hg heads
    13 heads
     9 echo '-------'
    14 echo '-------'
    10 hg heads .
    15 heads .
    11 
    16 
    12 echo '======='
    17 echo '======='
    13 echo 'a' >a
    18 echo 'a' >a
    14 hg add a
    19 hg add a
    15 hg branch a
    20 hg branch a
    16 hg commit -d '1 0' -u test -m "Adding a branch"
    21 hg commit -m "Adding a branch"
    17 hg heads
    22 heads
    18 echo '-------'
    23 echo '-------'
    19 hg heads .
    24 heads .
    20 
    25 
    21 echo '======='
    26 echo '======='
    22 hg update -C 0
    27 hg update -C 0
    23 echo 'b' >b
    28 echo 'b' >b
    24 hg add b
    29 hg add b
    25 hg branch b
    30 hg branch b
    26 hg commit -d '2 0' -u test -m "Adding b branch"
    31 hg commit -m "Adding b branch"
    27 hg heads
    32 heads
    28 echo '-------'
    33 echo '-------'
    29 hg heads .
    34 heads .
    30 
    35 
    31 echo '======='
    36 echo '======='
    32 echo 'bh1' >bh1
    37 echo 'bh1' >bh1
    33 hg add bh1
    38 hg add bh1
    34 hg commit -d '3 0' -u test -m "Adding b branch head 1"
    39 hg commit -m "Adding b branch head 1"
    35 hg heads
    40 heads
    36 echo '-------'
    41 echo '-------'
    37 hg heads .
    42 heads .
    38 
    43 
    39 echo '======='
    44 echo '======='
    40 hg update -C 2
    45 hg update -C 2
    41 echo 'bh2' >bh2
    46 echo 'bh2' >bh2
    42 hg add bh2
    47 hg add bh2
    43 hg commit -d '4 0' -u test -m "Adding b branch head 2"
    48 hg commit -m "Adding b branch head 2"
    44 hg heads
    49 heads
    45 echo '-------'
    50 echo '-------'
    46 hg heads .
    51 heads .
    47 
    52 
    48 echo '======='
    53 echo '======='
    49 hg update -C 2
    54 hg update -C 2
    50 echo 'bh3' >bh3
    55 echo 'bh3' >bh3
    51 hg add bh3
    56 hg add bh3
    52 hg commit -d '5 0' -u test -m "Adding b branch head 3"
    57 hg commit -m "Adding b branch head 3"
    53 hg heads
    58 heads
    54 echo '-------'
    59 echo '-------'
    55 hg heads .
    60 heads .
    56 
    61 
    57 echo '======='
    62 echo '======='
    58 hg merge 4
    63 hg merge 4
    59 hg commit -d '6 0' -u test -m "Merging b branch head 2 and b branch head 3"
    64 hg commit -m "Merging b branch head 2 and b branch head 3"
    60 hg heads
    65 heads
    61 echo '-------'
    66 echo '-------'
    62 hg heads .
    67 heads .
    63 
    68 
    64 echo '======='
    69 echo '======='
    65 echo 'c' >c
    70 echo 'c' >c
    66 hg add c
    71 hg add c
    67 hg branch c
    72 hg branch c
    68 hg commit -d '7 0' -u test -m "Adding c branch"
    73 hg commit -m "Adding c branch"
    69 hg heads
    74 heads
    70 echo '-------'
    75 echo '-------'
    71 hg heads .
    76 heads .
    72 
    77 
    73 echo '======='
    78 echo '======='
    74 hg heads -r 3 .
    79 heads -r 3 .
    75 echo $?
    80 echo $?
    76 echo '-------'
    81 echo '-------'
    77 hg heads -r 2 .
    82 heads -r 2 .
    78 echo $?
    83 echo $?
    79 echo '-------'
    84 echo '-------'
    80 hg update -C 4
    85 hg update -C 4
    81 echo $?
    86 echo $?
    82 echo '-------'
    87 echo '-------'
    83 hg heads -r 3 .
    88 heads -r 3 .
    84 echo $?
    89 echo $?
    85 echo '-------'
    90 echo '-------'
    86 hg heads -r 2 .
    91 heads -r 2 .
    87 echo $?
    92 echo $?
    88 echo '-------'
    93 echo '-------'
    89 hg heads -r 7 .
    94 heads -r 7 .
    90 echo $?
    95 echo $?
    91 
    96 
    92 echo '======='
    97 echo '======='
    93 for i in 0 1 2 3 4 5 6 7; do
    98 for i in 0 1 2 3 4 5 6 7; do
    94     hg update -C "$i"
    99     hg update -C "$i"
    95     hg heads
   100     heads
    96     echo '-------'
   101     echo '-------'
    97     hg heads .
   102     heads .
    98     echo '-------'
   103     echo '-------'
    99 done
   104 done
   100 
   105 
   101 echo '======='
   106 echo '======='
   102 for i in a b c z; do
   107 for i in a b c z; do
   103     hg heads "$i"
   108     heads "$i"
   104     echo '-------'
   109     echo '-------'
   105 done
   110 done
   106 
   111 
   107 echo '======='
   112 echo '======='
   108 hg heads 0 1 2 3 4 5 6 7
   113 heads 0 1 2 3 4 5 6 7