Differences between svn merge left, right & working files after conflicts

前端 未结 5 1513
忘了有多久
忘了有多久 2020-12-23 11:25

When performing a \'svn merge\' from my development team\'s trunk into a branch, we occasionally experience merge conflicts that produce files with suffix names: *.mer

5条回答
  •  情深已故
    2020-12-23 12:02

    Let's say there are two branches, and last (HEAD) revision in branch A is 9, while it is 6 in branch B.

    When cd B; svn merge -r 5:8 ^/braches/A is ran, svn will try to apply delta between 5 and 8 from branch A on top of branch B.

    (In other words, change sets 7 and 8 will be applied to B)

    common
    ancestor      left     right
    (1)━━┱───(3)──(5)──(7)──(8)──(9)  # branch A
         ┃         └┄┄┄┄┬┄┄┄┄┘
         ┃              ↓
         ┗━(2)━━(4)━━(6)              # branch B
                   working
    

    If the delta applies cleanly, it's all good.

    Let's say some lines were modified in change set 3, and same source lines were modified differently in change set 4.

    If delta (58) doesn't touch those lines, all is still good.

    If delta (58) also modified what 3 and 4 did, changes cannot be merged automatically, and svn leaves a file in conflict state:

    • file --- file with (working, left, right) delimited
    • file.working --- state of file in branch B@6
    • file.merge-left --- state of file in branch A@5
    • file.merge-right --- state of file in branch A@8

    If you edit such a file manually, you have a few choices --- keep working (your version), keep right (their version; the other branch version) or merge the changes manually.

    Left is not useful in itself, there's no point to keep left (their old version) in the file.

    It is, however, useful for tools. leftright is the change set.

    When you see, for example:

    <<<<<<< .working
    
        life_universe_and_everything = 13
    
    ||||||| .merge-left.r5
    
        life_universe_and_everything = "13"
    
    =======
    
        life_universe_and_everything = "42"
    
    >>>>>>> .merge-right.r8
    

    In branch A, "13" (str) was changed to "42".

    Branch B had 13 (int).

    Perhaps you want 42 (int) when you reconcile this conflict manually.

提交回复
热议问题