tests/test-bheads
author Dirkjan Ochtman <dirkjan@ochtman.nl>
Sat, 06 Feb 2010 19:38:39 +0100
changeset 10350 fd511e9eeea6
parent 8523 5b7da468531b
child 11318 7d780c04f074
permissions -rwxr-xr-x
commands: do all branch heads by default, demote topological to -t/--topo
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     1
#!/bin/sh
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     2
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
     3
heads()
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
     4
{
10350
fd511e9eeea6 commands: do all branch heads by default, demote topological to -t/--topo
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8523
diff changeset
     5
    hg heads --template '{rev}: {desc|firstline|strip} ({branches})\n' "$@"
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
     6
}
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
     7
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     8
hg init a
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     9
cd a
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    10
echo 'root' >root
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    11
hg add root
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    12
hg commit -m "Adding root node"
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    13
heads
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    14
echo '-------'
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    15
heads .
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    16
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    17
echo '======='
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    18
echo 'a' >a
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    19
hg add a
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    20
hg branch a
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    21
hg commit -m "Adding a branch"
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    22
heads
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    23
echo '-------'
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    24
heads .
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    25
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    26
echo '======='
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    27
hg update -C 0
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    28
echo 'b' >b
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    29
hg add b
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    30
hg branch b
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    31
hg commit -m "Adding b branch"
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    32
heads
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    33
echo '-------'
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    34
heads .
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    35
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    36
echo '======='
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    37
echo 'bh1' >bh1
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    38
hg add bh1
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    39
hg commit -m "Adding b branch head 1"
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    40
heads
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    41
echo '-------'
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    42
heads .
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    43
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    44
echo '======='
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    45
hg update -C 2
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    46
echo 'bh2' >bh2
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    47
hg add bh2
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    48
hg commit -m "Adding b branch head 2"
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    49
heads
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    50
echo '-------'
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    51
heads .
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    52
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    53
echo '======='
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    54
hg update -C 2
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    55
echo 'bh3' >bh3
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    56
hg add bh3
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    57
hg commit -m "Adding b branch head 3"
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    58
heads
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    59
echo '-------'
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    60
heads .
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    61
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    62
echo '======='
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    63
hg merge 4
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    64
hg commit -m "Merging b branch head 2 and b branch head 3"
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    65
heads
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    66
echo '-------'
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    67
heads .
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    68
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    69
echo '======='
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    70
echo 'c' >c
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    71
hg add c
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    72
hg branch c
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    73
hg commit -m "Adding c branch"
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    74
heads
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    75
echo '-------'
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    76
heads .
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    77
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    78
echo '======='
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    79
heads -r 3 .
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    80
echo $?
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    81
echo '-------'
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    82
heads -r 2 .
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    83
echo $?
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    84
echo '-------'
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    85
hg update -C 4
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    86
echo $?
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    87
echo '-------'
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    88
heads -r 3 .
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    89
echo $?
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    90
echo '-------'
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    91
heads -r 2 .
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    92
echo $?
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    93
echo '-------'
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
    94
heads -r 7 .
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    95
echo $?
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    96
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    97
echo '======='
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    98
for i in 0 1 2 3 4 5 6 7; do
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    99
    hg update -C "$i"
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
   100
    heads
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
   101
    echo '-------'
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
   102
    heads .
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
   103
    echo '-------'
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
   104
done
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
   105
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
   106
echo '======='
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
   107
for i in a b c z; do
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
   108
    heads "$i"
4648
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
   109
    echo '-------'
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
   110
done
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
   111
8e503fa54d2d Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
   112
echo '======='
6127
25c372e8f261 Simplify the output of test-bheads
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4648
diff changeset
   113
heads 0 1 2 3 4 5 6 7
10350
fd511e9eeea6 commands: do all branch heads by default, demote topological to -t/--topo
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8523
diff changeset
   114
fd511e9eeea6 commands: do all branch heads by default, demote topological to -t/--topo
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8523
diff changeset
   115
echo '% topological heads'
fd511e9eeea6 commands: do all branch heads by default, demote topological to -t/--topo
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 8523
diff changeset
   116
heads -t