tests/test-bheads
author Edouard Gomez <ed.gomez@free.fr>
Sun, 04 Jan 2009 02:36:48 +0100
changeset 7583 77fec2d270ae
parent 6127 25c372e8f261
child 8523 5b7da468531b
permissions -rwxr-xr-x
convert/gnuarch: parse continuation-of revisions in gnuarch source In GNU Arch, continuation-of was often used for: - tagging revisions - continue working on a project in a new archive, because arch was scaling poorly in revision numbers (cat-logs were slow to be parsed and scanned through) - very similar to the previous point, fork his own branch of a project. Parsing this header information will allow to 'follow' new history because it often hints at older/forked/personal revision trees. This patch however just implements the parsing of the continuation-of header. A followup patch will implement the proper use of this new information.

#!/bin/sh

heads()
{
    hg heads --template '#rev#: #desc|firstline|strip#\n' "$@"
}

hg init a
cd a
echo 'root' >root
hg add root
hg commit -m "Adding root node"
heads
echo '-------'
heads .

echo '======='
echo 'a' >a
hg add a
hg branch a
hg commit -m "Adding a branch"
heads
echo '-------'
heads .

echo '======='
hg update -C 0
echo 'b' >b
hg add b
hg branch b
hg commit -m "Adding b branch"
heads
echo '-------'
heads .

echo '======='
echo 'bh1' >bh1
hg add bh1
hg commit -m "Adding b branch head 1"
heads
echo '-------'
heads .

echo '======='
hg update -C 2
echo 'bh2' >bh2
hg add bh2
hg commit -m "Adding b branch head 2"
heads
echo '-------'
heads .

echo '======='
hg update -C 2
echo 'bh3' >bh3
hg add bh3
hg commit -m "Adding b branch head 3"
heads
echo '-------'
heads .

echo '======='
hg merge 4
hg commit -m "Merging b branch head 2 and b branch head 3"
heads
echo '-------'
heads .

echo '======='
echo 'c' >c
hg add c
hg branch c
hg commit -m "Adding c branch"
heads
echo '-------'
heads .

echo '======='
heads -r 3 .
echo $?
echo '-------'
heads -r 2 .
echo $?
echo '-------'
hg update -C 4
echo $?
echo '-------'
heads -r 3 .
echo $?
echo '-------'
heads -r 2 .
echo $?
echo '-------'
heads -r 7 .
echo $?

echo '======='
for i in 0 1 2 3 4 5 6 7; do
    hg update -C "$i"
    heads
    echo '-------'
    heads .
    echo '-------'
done

echo '======='
for i in a b c z; do
    heads "$i"
    echo '-------'
done

echo '======='
heads 0 1 2 3 4 5 6 7