tests/test-mq-qnew
branchstable
changeset 12795 3cb0559e44d0
parent 12793 469850088fc1
parent 12794 6bf8d48bec8e
child 12796 bc69ba99e34b
equal deleted inserted replaced
12793:469850088fc1 12795:3cb0559e44d0
     1 #!/bin/sh
       
     2 
       
     3 catpatch() {
       
     4     cat $1 | sed -e "s/^\(# Parent \).*/\1/"
       
     5 }
       
     6 
       
     7 echo "[extensions]" >> $HGRCPATH
       
     8 echo "mq=" >> $HGRCPATH
       
     9 
       
    10 runtest() {
       
    11     hg init mq
       
    12     cd mq
       
    13 
       
    14     echo a > a
       
    15     hg ci -Ama
       
    16 
       
    17     echo '% qnew should refuse bad patch names'
       
    18     hg qnew series
       
    19     hg qnew status
       
    20     hg qnew guards
       
    21     hg qnew .hgignore
       
    22     hg qnew .mqfoo
       
    23     hg qnew 'foo#bar'
       
    24     hg qnew 'foo:bar'
       
    25 
       
    26     hg qinit -c
       
    27 
       
    28     echo '% qnew with name containing slash'
       
    29     hg qnew foo/bar.patch
       
    30     hg qseries
       
    31     hg qpop
       
    32     hg qdelete foo/bar.patch
       
    33 
       
    34     echo '% qnew with uncommitted changes'
       
    35     echo a > somefile
       
    36     hg add somefile
       
    37     hg qnew uncommitted.patch
       
    38     hg st
       
    39     hg qseries
       
    40 
       
    41     echo '% qnew implies add'
       
    42     hg -R .hg/patches st
       
    43 
       
    44     echo '% qnew missing'
       
    45     hg qnew missing.patch missing
       
    46 
       
    47     echo '% qnew -m'
       
    48     hg qnew -m 'foo bar' mtest.patch
       
    49     catpatch .hg/patches/mtest.patch
       
    50 
       
    51     echo '% qnew twice'
       
    52     hg qnew first.patch
       
    53     hg qnew first.patch
       
    54 
       
    55     touch ../first.patch
       
    56     hg qimport ../first.patch
       
    57 
       
    58     echo '% qnew -f from a subdirectory'
       
    59     hg qpop -a
       
    60     mkdir d
       
    61     cd d
       
    62     echo b > b
       
    63     hg ci -Am t
       
    64     echo b >> b
       
    65     hg st
       
    66     hg qnew -g -f p
       
    67     catpatch ../.hg/patches/p
       
    68 
       
    69     echo '% qnew -u with no username configured'
       
    70     HGUSER= hg qnew -u blue red
       
    71     catpatch ../.hg/patches/red
       
    72 
       
    73     echo '% fail when trying to import a merge'
       
    74     hg init merge
       
    75     cd merge
       
    76     touch a
       
    77     hg ci -Am null
       
    78     echo a >> a
       
    79     hg ci -m a
       
    80     hg up -r 0
       
    81     echo b >> a
       
    82     hg ci -m b
       
    83     hg merge -f 1
       
    84     hg resolve --mark a
       
    85     hg qnew -f merge
       
    86 
       
    87     cd ../../..
       
    88     rm -r mq
       
    89 }
       
    90 
       
    91 
       
    92 echo '%%% plain headers'
       
    93 
       
    94 echo "[mq]" >> $HGRCPATH
       
    95 echo "plain=true" >> $HGRCPATH
       
    96 
       
    97 mkdir sandbox
       
    98 (cd sandbox ; runtest)
       
    99 rm -r sandbox
       
   100 
       
   101 
       
   102 echo '%%% hg headers'
       
   103 
       
   104 echo "plain=false" >> $HGRCPATH
       
   105 
       
   106 mkdir sandbox
       
   107 (cd sandbox ; runtest)
       
   108 rm -r sandbox
       
   109 
       
   110 
       
   111 exit 0