tests/test-import-bypass.t
changeset 22277 e116abad3afa
parent 21417 308aaeb956e2
child 22278 ffaaa80fa724
equal deleted inserted replaced
22276:b13b99d39a46 22277:e116abad3afa
    20   $ hg export . > ../test.diff
    20   $ hg export . > ../test.diff
    21   $ hg up null
    21   $ hg up null
    22   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
    22   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
    23 
    23 
    24 Test importing an existing revision
    24 Test importing an existing revision
       
    25 (this also tests that "hg import" disallows combination of '--exact'
       
    26 and '--edit')
       
    27 
       
    28   $ hg import --bypass --exact --edit ../test.diff
       
    29   abort: cannot use --exact with --edit
       
    30   [255]
       
    31   $ hg import --bypass --exact ../test.diff
       
    32   applying ../test.diff
       
    33   $ shortlog
       
    34   o  1:4e322f7ce8e3 test 0 0 - foo - changea
       
    35   |
       
    36   o  0:07f494440405 test 0 0 - default - adda
       
    37   
       
    38 
       
    39 Test failure without --exact
       
    40 
       
    41   $ hg import --bypass ../test.diff
       
    42   applying ../test.diff
       
    43   unable to find 'a' for patching
       
    44   abort: patch failed to apply
       
    45   [255]
       
    46   $ hg st
       
    47   $ shortlog
       
    48   o  1:4e322f7ce8e3 test 0 0 - foo - changea
       
    49   |
       
    50   o  0:07f494440405 test 0 0 - default - adda
       
    51   
       
    52 
       
    53 Test --user, --date and --message
       
    54 
       
    55   $ hg up 0
       
    56   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    57   $ hg import --bypass --u test2 -d '1 0' -m patch2 ../test.diff
       
    58   applying ../test.diff
       
    59   $ cat .hg/last-message.txt
       
    60   patch2 (no-eol)
       
    61   $ shortlog
       
    62   o  2:2e127d1da504 test2 1 0 - default - patch2
       
    63   |
       
    64   | o  1:4e322f7ce8e3 test 0 0 - foo - changea
       
    65   |/
       
    66   @  0:07f494440405 test 0 0 - default - adda
       
    67   
       
    68   $ hg rollback
       
    69   repository tip rolled back to revision 1 (undo import)
       
    70 
       
    71 Test --import-branch
    25 (this also tests that editor is not invoked for '--bypass', if the
    72 (this also tests that editor is not invoked for '--bypass', if the
    26 patch contains the commit message, regardless of '--edit')
    73 patch contains the commit message, regardless of '--edit')
    27 
    74 
    28   $ HGEDITOR=cat hg import --bypass --exact --edit ../test.diff
    75   $ HGEDITOR=cat hg import --bypass --import-branch --edit ../test.diff
    29   applying ../test.diff
       
    30   $ shortlog
       
    31   o  1:4e322f7ce8e3 test 0 0 - foo - changea
       
    32   |
       
    33   o  0:07f494440405 test 0 0 - default - adda
       
    34   
       
    35 
       
    36 Test failure without --exact
       
    37 
       
    38   $ hg import --bypass ../test.diff
       
    39   applying ../test.diff
       
    40   unable to find 'a' for patching
       
    41   abort: patch failed to apply
       
    42   [255]
       
    43   $ hg st
       
    44   $ shortlog
       
    45   o  1:4e322f7ce8e3 test 0 0 - foo - changea
       
    46   |
       
    47   o  0:07f494440405 test 0 0 - default - adda
       
    48   
       
    49 
       
    50 Test --user, --date and --message
       
    51 
       
    52   $ hg up 0
       
    53   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    54   $ hg import --bypass --u test2 -d '1 0' -m patch2 ../test.diff
       
    55   applying ../test.diff
       
    56   $ cat .hg/last-message.txt
       
    57   patch2 (no-eol)
       
    58   $ shortlog
       
    59   o  2:2e127d1da504 test2 1 0 - default - patch2
       
    60   |
       
    61   | o  1:4e322f7ce8e3 test 0 0 - foo - changea
       
    62   |/
       
    63   @  0:07f494440405 test 0 0 - default - adda
       
    64   
       
    65   $ hg rollback
       
    66   repository tip rolled back to revision 1 (undo import)
       
    67 
       
    68 Test --import-branch
       
    69 
       
    70   $ hg import --bypass --import-branch ../test.diff
       
    71   applying ../test.diff
    76   applying ../test.diff
    72   $ shortlog
    77   $ shortlog
    73   o  1:4e322f7ce8e3 test 0 0 - foo - changea
    78   o  1:4e322f7ce8e3 test 0 0 - foo - changea
    74   |
    79   |
    75   @  0:07f494440405 test 0 0 - default - adda
    80   @  0:07f494440405 test 0 0 - default - adda