tests/test-mq-caches
changeset 3492 fbf8320f25c8
child 3501 89820e9b94f2
equal deleted inserted replaced
3491:23cffef5d424 3492:fbf8320f25c8
       
     1 #!/bin/sh
       
     2 
       
     3 echo '[extensions]' >> $HGRCPATH
       
     4 echo 'hgext.mq=' >> $HGRCPATH
       
     5 
       
     6 show_branch_cache()
       
     7 {
       
     8     branches=.hg/branches.cache
       
     9     hg log -r tip --template 'tip: #rev#\n'
       
    10     if [ -f $branches ]; then
       
    11 	sort $branches
       
    12     else
       
    13 	echo No $branches
       
    14     fi
       
    15     if [ "$1" = 1 ]; then
       
    16 	for b in foo bar; do
       
    17 	    hg log -r $b --template "branch $b: "'#rev#\n'
       
    18 	done
       
    19     fi
       
    20 }
       
    21 
       
    22 hg init a
       
    23 cd a
       
    24 hg qinit -c
       
    25 
       
    26 echo '# mq patch on an empty repo'
       
    27 hg qnew p1
       
    28 show_branch_cache
       
    29 
       
    30 echo > pfile
       
    31 hg add pfile
       
    32 hg qrefresh -m 'patch 1'
       
    33 show_branch_cache
       
    34 
       
    35 echo
       
    36 echo '# some regular revisions'
       
    37 hg qpop
       
    38 echo foo > foo
       
    39 hg add foo
       
    40 echo foo > .hg/branch
       
    41 hg ci -m 'branch foo' -d '1000000 0'
       
    42 
       
    43 echo bar > bar
       
    44 hg add bar
       
    45 echo bar > .hg/branch
       
    46 hg ci -m 'branch bar' -d '1000000 0'
       
    47 show_branch_cache
       
    48 
       
    49 echo
       
    50 echo '# add some mq patches'
       
    51 hg qpush
       
    52 show_branch_cache
       
    53 
       
    54 hg qnew p2
       
    55 echo foo > .hg/branch
       
    56 echo foo2 >> foo
       
    57 hg qrefresh -m 'patch 2'
       
    58 show_branch_cache 1
       
    59 
       
    60 echo
       
    61 echo '# removing the cache'
       
    62 rm -f .hg/branches.cache
       
    63 show_branch_cache 1
       
    64 
       
    65 echo
       
    66 echo '# importing rev 1 (the cache now ends in one of the patches)'
       
    67 hg qimport -r 1 -n p0
       
    68 show_branch_cache 1
       
    69 hg log -r qbase --template 'qbase: #rev#\n'
       
    70 
       
    71 echo
       
    72 echo '# detect an invalid cache'
       
    73 hg qpop -a
       
    74 hg qpush -a
       
    75 show_branch_cache
       
    76