tests/test-merge1.t
changeset 11975 21884b433c51
parent 8834 6d36fc70754e
child 12156 4c94b6d0fb1c
equal deleted inserted replaced
11974:ccd581c66284 11975:21884b433c51
       
     1   $ cat <<EOF > merge
       
     2   > import sys, os
       
     3   > 
       
     4   > try:
       
     5   >     import msvcrt
       
     6   >     msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
       
     7   >     msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
       
     8   > except ImportError:
       
     9   >     pass
       
    10   > 
       
    11   > print "merging for", os.path.basename(sys.argv[1])
       
    12   > EOF
       
    13   $ HGMERGE="python ../merge"; export HGMERGE
       
    14 
       
    15   $ mkdir t
       
    16   $ cd t
       
    17   $ hg init
       
    18   $ echo This is file a1 > a
       
    19   $ hg add a
       
    20   $ hg commit -m "commit #0" -d "1000000 0"
       
    21   $ echo This is file b1 > b
       
    22   $ hg add b
       
    23   $ hg commit -m "commit #1" -d "1000000 0"
       
    24 
       
    25   $ hg update 0
       
    26   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
    27   $ echo This is file c1 > c
       
    28   $ hg add c
       
    29   $ hg commit -m "commit #2" -d "1000000 0"
       
    30   created new head
       
    31   $ echo This is file b1 > b
       
    32 no merges expected
       
    33   $ hg merge -P 1
       
    34   changeset:   1:4ee19afe4659
       
    35   user:        test
       
    36   date:        Mon Jan 12 13:46:40 1970 +0000
       
    37   summary:     commit #1
       
    38   
       
    39   $ hg merge 1
       
    40   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    41   (branch merge, don't forget to commit)
       
    42   $ hg diff --nodates
       
    43   diff -r d9e5953b9dec b
       
    44   --- /dev/null
       
    45   +++ b/b
       
    46   @@ -0,0 +1,1 @@
       
    47   +This is file b1
       
    48   $ hg status
       
    49   M b
       
    50   $ cd ..; rm -r t
       
    51 
       
    52   $ mkdir t
       
    53   $ cd t
       
    54   $ hg init
       
    55   $ echo This is file a1 > a
       
    56   $ hg add a
       
    57   $ hg commit -m "commit #0" -d "1000000 0"
       
    58   $ echo This is file b1 > b
       
    59   $ hg add b
       
    60   $ hg commit -m "commit #1" -d "1000000 0"
       
    61 
       
    62   $ hg update 0
       
    63   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
    64   $ echo This is file c1 > c
       
    65   $ hg add c
       
    66   $ hg commit -m "commit #2" -d "1000000 0"
       
    67   created new head
       
    68   $ echo This is file b2 > b
       
    69 merge should fail
       
    70   $ hg merge 1
       
    71   abort: untracked file in working directory differs from file in requested revision: 'b'
       
    72 merge of b expected
       
    73   $ hg merge -f 1
       
    74   merging for b
       
    75   merging b
       
    76   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
       
    77   (branch merge, don't forget to commit)
       
    78   $ hg diff --nodates
       
    79   diff -r d9e5953b9dec b
       
    80   --- /dev/null
       
    81   +++ b/b
       
    82   @@ -0,0 +1,1 @@
       
    83   +This is file b2
       
    84   $ hg status
       
    85   M b
       
    86   $ cd ..; rm -r t
       
    87 
       
    88   $ mkdir t
       
    89   $ cd t
       
    90   $ hg init
       
    91   $ echo This is file a1 > a
       
    92   $ hg add a
       
    93   $ hg commit -m "commit #0" -d "1000000 0"
       
    94   $ echo This is file b1 > b
       
    95   $ hg add b
       
    96   $ hg commit -m "commit #1" -d "1000000 0"
       
    97   $ echo This is file b22 > b
       
    98   $ hg commit -m "commit #2" -d "1000000 0"
       
    99   $ hg update 1
       
   100   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   101   $ echo This is file c1 > c
       
   102   $ hg add c
       
   103   $ hg commit -m "commit #3" -d "1000000 0"
       
   104   created new head
       
   105 
       
   106 Contents of b should be "this is file b1"
       
   107   $ cat b
       
   108   This is file b1
       
   109 
       
   110   $ echo This is file b22 > b
       
   111 merge fails
       
   112   $ hg merge 2
       
   113   abort: outstanding uncommitted changes (use 'hg status' to list changes)
       
   114   $ echo %% merge expected!
       
   115   %% merge expected!
       
   116   $ hg merge -f 2
       
   117   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   118   (branch merge, don't forget to commit)
       
   119   $ hg diff --nodates
       
   120   diff -r c1dd73cbf59f b
       
   121   --- a/b
       
   122   +++ b/b
       
   123   @@ -1,1 +1,1 @@
       
   124   -This is file b1
       
   125   +This is file b22
       
   126   $ hg status
       
   127   M b
       
   128   $ cd ..; rm -r t
       
   129 
       
   130   $ mkdir t
       
   131   $ cd t
       
   132   $ hg init
       
   133   $ echo This is file a1 > a
       
   134   $ hg add a
       
   135   $ hg commit -m "commit #0" -d "1000000 0"
       
   136   $ echo This is file b1 > b
       
   137   $ hg add b
       
   138   $ hg commit -m "commit #1" -d "1000000 0"
       
   139   $ echo This is file b22 > b
       
   140   $ hg commit -m "commit #2" -d "1000000 0"
       
   141   $ hg update 1
       
   142   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   143   $ echo This is file c1 > c
       
   144   $ hg add c
       
   145   $ hg commit -m "commit #3" -d "1000000 0"
       
   146   created new head
       
   147   $ echo This is file b33 > b
       
   148 merge of b should fail
       
   149   $ hg merge 2
       
   150   abort: outstanding uncommitted changes (use 'hg status' to list changes)
       
   151 merge of b expected
       
   152   $ hg merge -f 2
       
   153   merging for b
       
   154   merging b
       
   155   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
       
   156   (branch merge, don't forget to commit)
       
   157   $ hg diff --nodates
       
   158   diff -r c1dd73cbf59f b
       
   159   --- a/b
       
   160   +++ b/b
       
   161   @@ -1,1 +1,1 @@
       
   162   -This is file b1
       
   163   +This is file b33
       
   164   $ hg status
       
   165   M b