2006-10-24 06:32:56 +04:00
|
|
|
#!/bin/sh
|
|
|
|
|
2008-02-21 22:22:31 +03:00
|
|
|
branches=.hg/branch.cache
|
2006-10-24 06:32:56 +04:00
|
|
|
echo '[extensions]' >> $HGRCPATH
|
|
|
|
echo 'hgext.mq=' >> $HGRCPATH
|
|
|
|
|
|
|
|
show_branch_cache()
|
|
|
|
{
|
2006-10-25 00:49:48 +04:00
|
|
|
# force cache (re)generation
|
|
|
|
hg log -r does-not-exist 2> /dev/null
|
2006-10-24 06:32:56 +04:00
|
|
|
hg log -r tip --template 'tip: #rev#\n'
|
|
|
|
if [ -f $branches ]; then
|
|
|
|
sort $branches
|
|
|
|
else
|
2008-02-21 22:22:31 +03:00
|
|
|
echo No branch cache
|
2006-10-24 06:32:56 +04:00
|
|
|
fi
|
|
|
|
if [ "$1" = 1 ]; then
|
|
|
|
for b in foo bar; do
|
|
|
|
hg log -r $b --template "branch $b: "'#rev#\n'
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
hg init a
|
|
|
|
cd a
|
|
|
|
hg qinit -c
|
|
|
|
|
|
|
|
echo '# mq patch on an empty repo'
|
|
|
|
hg qnew p1
|
|
|
|
show_branch_cache
|
|
|
|
|
|
|
|
echo > pfile
|
|
|
|
hg add pfile
|
|
|
|
hg qrefresh -m 'patch 1'
|
|
|
|
show_branch_cache
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo '# some regular revisions'
|
|
|
|
hg qpop
|
|
|
|
echo foo > foo
|
|
|
|
hg add foo
|
|
|
|
echo foo > .hg/branch
|
|
|
|
hg ci -m 'branch foo' -d '1000000 0'
|
|
|
|
|
|
|
|
echo bar > bar
|
|
|
|
hg add bar
|
|
|
|
echo bar > .hg/branch
|
|
|
|
hg ci -m 'branch bar' -d '1000000 0'
|
|
|
|
show_branch_cache
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo '# add some mq patches'
|
|
|
|
hg qpush
|
|
|
|
show_branch_cache
|
|
|
|
|
|
|
|
hg qnew p2
|
|
|
|
echo foo > .hg/branch
|
|
|
|
echo foo2 >> foo
|
|
|
|
hg qrefresh -m 'patch 2'
|
|
|
|
show_branch_cache 1
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo '# removing the cache'
|
2008-02-21 22:22:31 +03:00
|
|
|
rm $branches
|
2006-10-24 06:32:56 +04:00
|
|
|
show_branch_cache 1
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo '# importing rev 1 (the cache now ends in one of the patches)'
|
|
|
|
hg qimport -r 1 -n p0
|
|
|
|
show_branch_cache 1
|
|
|
|
hg log -r qbase --template 'qbase: #rev#\n'
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo '# detect an invalid cache'
|
|
|
|
hg qpop -a
|
|
|
|
hg qpush -a
|
|
|
|
show_branch_cache
|
|
|
|
|