tests/test-mq-qpush-fail.t
changeset 12467 05e1171cf4ca
parent 10397 8cb81d75730c
child 12942 05fffd665170
equal deleted inserted replaced
12466:3160698100c6 12467:05e1171cf4ca
       
     1 Test that qpush cleans things up if it doesn't complete
       
     2 
       
     3   $ echo "[extensions]" >> $HGRCPATH
       
     4   $ echo "mq=" >> $HGRCPATH
       
     5   $ hg init repo
       
     6   $ cd repo
       
     7   $ echo foo > foo
       
     8   $ hg ci -Am 'add foo'
       
     9   adding foo
       
    10   $ touch untracked-file
       
    11   $ echo 'syntax: glob' > .hgignore
       
    12   $ echo '.hgignore' >> .hgignore
       
    13   $ hg qinit
       
    14 
       
    15 test qpush on empty series
       
    16 
       
    17   $ hg qpush
       
    18   no patches in series
       
    19   $ hg qnew patch1
       
    20   $ echo >> foo
       
    21   $ hg qrefresh -m 'patch 1'
       
    22   $ hg qnew patch2
       
    23   $ echo bar > bar
       
    24   $ hg add bar
       
    25   $ hg qrefresh -m 'patch 2'
       
    26   $ hg qnew --config 'mq.plain=true' bad-patch
       
    27   $ echo >> foo
       
    28   $ hg qrefresh
       
    29   $ hg qpop -a
       
    30   popping bad-patch
       
    31   popping patch2
       
    32   popping patch1
       
    33   patch queue now empty
       
    34   $ python -c 'print "\xe9"' > message
       
    35   $ cat .hg/patches/bad-patch >> message
       
    36   $ mv message .hg/patches/bad-patch
       
    37   $ hg qpush -a && echo 'qpush succeded?!'
       
    38   applying patch1
       
    39   applying patch2
       
    40   applying bad-patch
       
    41   transaction abort!
       
    42   rollback completed
       
    43   cleaning up working directory...done
       
    44   abort: decoding near 'é': 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)!
       
    45   [255]
       
    46   $ hg parents
       
    47   changeset:   0:bbd179dfa0a7
       
    48   tag:         tip
       
    49   user:        test
       
    50   date:        Thu Jan 01 00:00:00 1970 +0000
       
    51   summary:     add foo
       
    52   
       
    53 
       
    54 bar should be gone; other unknown/ignored files should still be around
       
    55 
       
    56   $ hg status -A
       
    57   ? untracked-file
       
    58   I .hgignore
       
    59   C foo
       
    60 
       
    61 preparing qpush of a missing patch
       
    62 
       
    63   $ hg qpop -a
       
    64   no patches applied
       
    65   $ hg qpush
       
    66   applying patch1
       
    67   now at: patch1
       
    68   $ rm .hg/patches/patch2
       
    69 
       
    70 now we expect the push to fail, but it should NOT complain about patch1
       
    71 
       
    72   $ hg qpush
       
    73   applying patch2
       
    74   unable to read patch2
       
    75   now at: patch1
       
    76   [1]
       
    77 
       
    78 preparing qpush of missing patch with no patch applied
       
    79 
       
    80   $ hg qpop -a
       
    81   popping patch1
       
    82   patch queue now empty
       
    83   $ rm .hg/patches/patch1
       
    84 
       
    85 qpush should fail the same way as below
       
    86 
       
    87   $ hg qpush
       
    88   applying patch1
       
    89   unable to read patch1
       
    90   [1]