tests/test-mq-merge
changeset 12324 b701610f6c56
parent 12318 d643ae555a4d
child 12325 5f6231861e09
equal deleted inserted replaced
12318:d643ae555a4d 12324:b701610f6c56
     1 #!/bin/sh
       
     2 
       
     3 # Test issue 529 - mq aborts when merging patch deleting files
       
     4 
       
     5 checkundo()
       
     6 {
       
     7     if [ -f .hg/store/undo ]; then
       
     8 	echo ".hg/store/undo still exists after $1"
       
     9     fi
       
    10 }
       
    11 
       
    12 echo "[extensions]" >> $HGRCPATH
       
    13 echo "mq =" >> $HGRCPATH
       
    14 echo "[mq]" >> $HGRCPATH
       
    15 echo "git = keep" >> $HGRCPATH
       
    16 
       
    17 # Commit two dummy files in "init" changeset
       
    18 hg init t
       
    19 cd t
       
    20 echo a > a
       
    21 echo b > b
       
    22 hg ci -Am init
       
    23 hg tag -l init
       
    24 
       
    25 # Create a patch removing a
       
    26 hg qnew rm_a
       
    27 hg rm a
       
    28 hg qrefresh -m "rm a"
       
    29 
       
    30 # Save the patch queue so we can merge it later
       
    31 hg qsave -c -e 2>&1 | grep -v '^copy'
       
    32 checkundo qsave
       
    33 
       
    34 # Update b and commit in an "update" changeset
       
    35 hg up -C init
       
    36 echo b >> b
       
    37 hg st
       
    38 hg ci -m update
       
    39 
       
    40 # Here, qpush used to abort with :
       
    41 # The system cannot find the file specified => a
       
    42 hg manifest
       
    43 hg qpush -a -m 2>&1 | grep -v '^merging'
       
    44 checkundo 'qpush -m'
       
    45 hg manifest
       
    46 
       
    47 # ensure status is correct after merge
       
    48 hg qpop -a
       
    49 cd ..
       
    50 
       
    51 # Classic MQ merge sequence *with an explicit named queue*
       
    52 echo
       
    53 echo % init t2
       
    54 hg init t2
       
    55 cd t2
       
    56 echo '[diff]' > .hg/hgrc
       
    57 echo 'nodates = 1' >> .hg/hgrc
       
    58 echo a > a
       
    59 hg ci -Am init
       
    60 echo b > a
       
    61 hg ci -m changea
       
    62 hg up -C 0
       
    63 hg cp a aa
       
    64 echo c >> a
       
    65 hg qnew --git -f -e patcha
       
    66 echo d >> a
       
    67 hg qnew -d '0 0' -f -e patcha2
       
    68 echo % create the reference queue
       
    69 hg qsave -c -e -n refqueue 2> /dev/null
       
    70 hg up -C 1
       
    71 echo % merge
       
    72 HGMERGE=internal:other hg qpush -a -m -n refqueue 2>&1 | \
       
    73     sed 's/merging with queue at.*refqueue/merging with queue at refqueue/'
       
    74 echo % check patcha is still a git patch
       
    75 cat .hg/patches/patcha
       
    76 echo % check patcha2 is still a regular patch
       
    77 grep git .hg/patches/patcha2 && echo 'git patch found!'
       
    78 cd ..
       
    79