tests/test-import.t
changeset 21417 308aaeb956e2
parent 19513 9e8298a324ac
child 21553 bee0e1cffdd3
equal deleted inserted replaced
21416:3e717c9376fc 21417:308aaeb956e2
    21   $ hg --cwd a export tip > exported-tip.patch
    21   $ hg --cwd a export tip > exported-tip.patch
    22   $ hg --cwd a diff -r0:1 > diffed-tip.patch
    22   $ hg --cwd a diff -r0:1 > diffed-tip.patch
    23 
    23 
    24 
    24 
    25 import exported patch
    25 import exported patch
    26 
    26 (this also tests that editor is not invoked, if the patch contains the
    27   $ hg clone -r0 a b
    27 commit message and '--edit' is not specified)
    28   adding changesets
    28 
    29   adding manifests
    29   $ hg clone -r0 a b
    30   adding file changes
    30   adding changesets
    31   added 1 changesets with 2 changes to 2 files
    31   adding manifests
    32   updating to branch default
    32   adding file changes
    33   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
    33   added 1 changesets with 2 changes to 2 files
    34   $ hg --cwd b import ../exported-tip.patch
    34   updating to branch default
       
    35   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    36   $ HGEDITOR=cat hg --cwd b import ../exported-tip.patch
    35   applying ../exported-tip.patch
    37   applying ../exported-tip.patch
    36 
    38 
    37 message and committer and date should be same
    39 message and committer and date should be same
    38 
    40 
    39   $ hg --cwd b tip
    41   $ hg --cwd b tip
    45   
    47   
    46   $ rm -r b
    48   $ rm -r b
    47 
    49 
    48 
    50 
    49 import exported patch with external patcher
    51 import exported patch with external patcher
       
    52 (this also tests that editor is invoked, if the '--edit' is specified,
       
    53 regardless of the commit message in the patch)
    50 
    54 
    51   $ cat > dummypatch.py <<EOF
    55   $ cat > dummypatch.py <<EOF
    52   > print 'patching file a'
    56   > print 'patching file a'
    53   > file('a', 'wb').write('line2\n')
    57   > file('a', 'wb').write('line2\n')
    54   > EOF
    58   > EOF
    57   adding manifests
    61   adding manifests
    58   adding file changes
    62   adding file changes
    59   added 1 changesets with 2 changes to 2 files
    63   added 1 changesets with 2 changes to 2 files
    60   updating to branch default
    64   updating to branch default
    61   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
    65   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
    62   $ hg --config ui.patch='python ../dummypatch.py' --cwd b import ../exported-tip.patch
    66   $ HGEDITOR=cat hg --config ui.patch='python ../dummypatch.py' --cwd b import --edit ../exported-tip.patch
    63   applying ../exported-tip.patch
    67   applying ../exported-tip.patch
       
    68   second change
       
    69   
       
    70   
       
    71   HG: Enter commit message.  Lines beginning with 'HG:' are removed.
       
    72   HG: Leave message empty to abort commit.
       
    73   HG: --
       
    74   HG: user: someone
       
    75   HG: branch 'default'
       
    76   HG: changed a
    64   $ cat b/a
    77   $ cat b/a
    65   line2
    78   line2
    66   $ rm -r b
    79   $ rm -r b
    67 
    80 
    68 
    81 
    69 import of plain diff should fail without message
    82 import of plain diff should fail without message
    70 
    83 (this also tests that editor is invoked, if the patch doesn't contain
    71   $ hg clone -r0 a b
    84 the commit message, regardless of '--edit')
    72   adding changesets
    85 
    73   adding manifests
    86   $ hg clone -r0 a b
    74   adding file changes
    87   adding changesets
    75   added 1 changesets with 2 changes to 2 files
    88   adding manifests
    76   updating to branch default
    89   adding file changes
    77   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
    90   added 1 changesets with 2 changes to 2 files
    78   $ hg --cwd b import ../diffed-tip.patch
    91   updating to branch default
       
    92   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    93   $ HGEDITOR=cat hg --cwd b import ../diffed-tip.patch
    79   applying ../diffed-tip.patch
    94   applying ../diffed-tip.patch
       
    95   
       
    96   
       
    97   HG: Enter commit message.  Lines beginning with 'HG:' are removed.
       
    98   HG: Leave message empty to abort commit.
       
    99   HG: --
       
   100   HG: user: test
       
   101   HG: branch 'default'
       
   102   HG: changed a
    80   abort: empty commit message
   103   abort: empty commit message
    81   [255]
   104   [255]
    82   $ rm -r b
   105   $ rm -r b
    83 
   106 
    84 
   107 
    95   applying ../diffed-tip.patch
   118   applying ../diffed-tip.patch
    96   $ rm -r b
   119   $ rm -r b
    97 
   120 
    98 
   121 
    99 import of plain diff with specific date and user
   122 import of plain diff with specific date and user
       
   123 (this also tests that editor is not invoked, if
       
   124 '--message'/'--logfile' is specified and '--edit' is not)
   100 
   125 
   101   $ hg clone -r0 a b
   126   $ hg clone -r0 a b
   102   adding changesets
   127   adding changesets
   103   adding manifests
   128   adding manifests
   104   adding file changes
   129   adding file changes
   126   
   151   
   127   $ rm -r b
   152   $ rm -r b
   128 
   153 
   129 
   154 
   130 import of plain diff should be ok with --no-commit
   155 import of plain diff should be ok with --no-commit
   131 
   156 (this also tests that editor is not invoked, if '--no-commit' is
   132   $ hg clone -r0 a b
   157 specified, regardless of '--edit')
   133   adding changesets
   158 
   134   adding manifests
   159   $ hg clone -r0 a b
   135   adding file changes
   160   adding changesets
   136   added 1 changesets with 2 changes to 2 files
   161   adding manifests
   137   updating to branch default
   162   adding file changes
   138   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   163   added 1 changesets with 2 changes to 2 files
   139   $ hg --cwd b import --no-commit ../diffed-tip.patch
   164   updating to branch default
       
   165   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   166   $ HGEDITOR=cat hg --cwd b import --no-commit --edit ../diffed-tip.patch
   140   applying ../diffed-tip.patch
   167   applying ../diffed-tip.patch
   141   $ hg --cwd b diff --nodates
   168   $ hg --cwd b diff --nodates
   142   diff -r 80971e65b431 a
   169   diff -r 80971e65b431 a
   143   --- a/a
   170   --- a/a
   144   +++ b/a
   171   +++ b/a