tests/test-merge-commit
changeset 4058 e7282dede8cd
child 4365 46280c004f22
equal deleted inserted replaced
4057:3600b84656d3 4058:e7282dede8cd
       
     1 #!/bin/sh
       
     2 # check that renames are correctly saved by a commit after a merge
       
     3 
       
     4 HGMERGE=merge
       
     5 export HGMERGE
       
     6 
       
     7 # test with the merge on 3 having the rename on the local parent
       
     8 hg init a
       
     9 cd a
       
    10 
       
    11 echo line1 > foo
       
    12 hg add foo
       
    13 hg ci -m '0: add foo' -d '0 0'
       
    14 
       
    15 echo line2 >> foo
       
    16 hg ci -m '1: change foo' -d '0 0'
       
    17 
       
    18 hg up -C 0
       
    19 hg mv foo bar
       
    20 rm bar
       
    21 echo line0 > bar
       
    22 echo line1 >> bar
       
    23 hg ci -m '2: mv foo bar; change bar' -d '0 0'
       
    24 
       
    25 hg merge 1
       
    26 echo '% contents of bar should be line0 line1 line2'
       
    27 cat bar
       
    28 hg ci -m '3: merge with local rename' -d '0 0'
       
    29 hg debugindex .hg/store/data/bar.i
       
    30 hg debugrename bar
       
    31 hg debugindex .hg/store/data/foo.i
       
    32 
       
    33 # revert the content change from rev 2
       
    34 hg up -C 2
       
    35 rm bar
       
    36 echo line1 > bar
       
    37 hg ci -m '4: revert content change from rev 2' -d '0 0'
       
    38 
       
    39 hg log --template '#rev#:#node|short# #parents#\n'
       
    40 echo '% this should use bar@rev2 as the ancestor'
       
    41 hg --debug merge 3
       
    42 echo '% contents of bar should be line1 line2'
       
    43 cat bar
       
    44 hg ci -m '5: merge' -d '0 0'
       
    45 hg debugindex .hg/store/data/bar.i
       
    46 
       
    47 
       
    48 # same thing, but with the merge on 3 having the rename on the remote parent
       
    49 echo
       
    50 echo
       
    51 cd ..
       
    52 hg clone -U -r 1 -r 2 a b
       
    53 cd b
       
    54 
       
    55 hg up -C 1
       
    56 hg merge 2
       
    57 echo '% contents of bar should be line0 line1 line2'
       
    58 cat bar
       
    59 hg ci -m '3: merge with remote rename' -d '0 0'
       
    60 hg debugindex .hg/store/data/bar.i
       
    61 hg debugrename bar
       
    62 hg debugindex .hg/store/data/foo.i
       
    63 
       
    64 # revert the content change from rev 2
       
    65 hg up -C 2
       
    66 rm bar
       
    67 echo line1 > bar
       
    68 hg ci -m '4: revert content change from rev 2' -d '0 0'
       
    69 
       
    70 hg log --template '#rev#:#node|short# #parents#\n'
       
    71 echo '% this should use bar@rev2 as the ancestor'
       
    72 hg --debug merge 3
       
    73 echo '% contents of bar should be line1 line2'
       
    74 cat bar
       
    75 hg ci -m '5: merge' -d '0 0'
       
    76 hg debugindex .hg/store/data/bar.i
       
    77