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

5

52

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: *.merge-right.r5004, *.merge-left.r4521 and *.working. I've searched throughout Subversions's documentation but their explanation hasn't been much use. I've gathered the following:

  • *.merge-right.r5004 = trunk version
  • *.merge-left.r4521 = ?
  • *.working = branch version

I can't seem to figure out what merge-left.r4521 is. And if the answer is that its simply an older version of the file from branch, then why 4521?

Tilla answered 6/10, 2011 at 18:59 Comment(3)
Just a thought - is it the revision of the trunk when the branch was created?Boethius
Number after r is revision number. File with extension .rXXX is that file in that given revision.Erroneous
There's a good answer here: https://mcmap.net/q/354004/-svnmerge-workflowFini
T
82

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.

Trothplight answered 31/5, 2016 at 8:40 Comment(1)
finally, an explanation that I can understand. thank you!Rosenkrantz
C
14

file.merge-left.r4521 is the latest change of this file in the left branch (i.e. the origin) before the right branch (the destination) were created.

In other words, merge-left.r4521 it's the first version of the file to be merged

with merge-right.r5004 (the latest version of the destination branch)

For example, say you want to merge branches Left and Right as below:

Left   1   2   f.3   4   f.5   6    7    f.9    11 

Right                                  8    f.10    f.12   13


Right is created in 8 ( is a copy of 7 )

file 'f' has been modified in 3, 5, 9, 10, 12

The merge of file 'f' will occur between 7 and 13 because

7 is the latest version of file f in Left before Right was created

13 is the latest version of Right
Cumming answered 1/10, 2012 at 13:0 Comment(0)
A
11
  • 'file.py.merge-left.rxxx` shows the merging result taking the left side of the conflict
  • 'file.py.merge-right.ryyy` shows the merging result taking the right side of the conflict
  • 'file.py.working` shows your unchanged working copy
  • 'file.py` shows SVNs attempts to merge both

This question is similar to https://mcmap.net/q/354004/-svnmerge-workflow but this one is more specific about the content of the conflict files.

Alloy answered 1/3, 2012 at 20:38 Comment(1)
Your answer suggests .merge-right and .working should agree for the most of the cases (when we start from an unchanged checkout of the "right") but that does not agree with my observation.Warfield
W
0

It seems that the "left" file is the last version where the file was the same in the trunk and the branch (for your question, but it would be between the source and dest in general).

If you've never merged changes from the trunk into your branch then this would be the version of the trunk when a branch (copy) was performed. Otherwise, it's the last version of the trunk that was merged and committed to this branch.

The left and right are what is used to create the diff that will be applied (as a patch) to the working file.

Workbook answered 17/3, 2014 at 20:17 Comment(0)
P
-2

You performed 3-side merge diring conflict-resolving (when merging 2 different files). It this operation 3 sources used

  • "your" file (from WC or source-location, depending on parameters)
  • "their" file (file with with changes must be merged)
  • "base" file (common ancestor of files 1-2)

r*** extension just added to the same filename in order to have 3 files on merge

After successful merging and marking conflict as resolved temp-files must disappear automagically, if my memory served me well

Probe answered 7/10, 2011 at 6:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.