tests/test-mq-missingfiles
changeset 5581 8a8c341bd292
child 5652 e90e72c6b4c7
equal deleted inserted replaced
5549:f2f42262adbd 5581:8a8c341bd292
       
     1 #!/bin/sh
       
     2 
       
     3 # Test issue835:
       
     4 # qpush fails immediately when patching a missing file, but
       
     5 # remaining added files are still created empty which will
       
     6 # trick a future qrefresh.
       
     7 
       
     8 cat > writelines.py <<EOF
       
     9 import sys
       
    10 path = sys.argv[1]
       
    11 args = sys.argv[2:]
       
    12 assert (len(args) % 2) == 0
       
    13 
       
    14 f = file(path, 'wb')
       
    15 for i in xrange(len(args)/2):
       
    16    count, s = args[2*i:2*i+2]
       
    17    count = int(count)
       
    18    s = s.decode('string_escape')
       
    19    f.write(s*count)
       
    20 f.close()
       
    21 
       
    22 EOF
       
    23 
       
    24 echo "[extensions]" >> $HGRCPATH
       
    25 echo "mq=" >> $HGRCPATH
       
    26 
       
    27 hg init normal
       
    28 cd normal
       
    29 python ../writelines.py b 10 'a\n'
       
    30 hg ci -Am addb
       
    31 echo a > a
       
    32 python ../writelines.py b 2 'b\n' 10 'a\n' 2 'c\n'
       
    33 echo c > c
       
    34 hg add a c
       
    35 hg qnew -f changeb
       
    36 hg qpop
       
    37 hg rm b
       
    38 hg ci -Am rmb
       
    39 echo % push patch with missing target
       
    40 hg qpush
       
    41 echo % display added files
       
    42 cat a
       
    43 cat c
       
    44 cd ..
       
    45 
       
    46 
       
    47 echo "[diff]" >> $HGRCPATH
       
    48 echo "git=1" >> $HGRCPATH
       
    49 
       
    50 hg init git
       
    51 cd git
       
    52 python ../writelines.py b 1 '\x00'
       
    53 hg ci -Am addb
       
    54 echo a > a
       
    55 python ../writelines.py b 1 '\x01' 1 '\x00'
       
    56 echo c > c
       
    57 hg add a c
       
    58 hg qnew -f changeb
       
    59 hg qpop
       
    60 hg rm b
       
    61 hg ci -Am rmb
       
    62 echo % push git patch with missing target
       
    63 hg qpush 2>&1 | sed -e 's/b:.*/b: No such file or directory/'
       
    64 hg st
       
    65 echo % display added files
       
    66 cat a
       
    67 cat c
       
    68 cd ..
       
    69