svn merge left, right & 之间的区别冲突后的工作文件

发布于 2024-12-08 16:40:07 字数 387 浏览 1 评论 0原文

当从我的开发团队的主干执行“svn 合并”到分支时,我们偶尔会遇到合并冲突,产生带有后缀名的文件:*.merge-right.r5004*.merge- left.r4521*.working。我搜索了整个 Subversions 的文档,但他们的解释并没有多大用处。我收集了以下内容:

  • *.merge-right.r5004 = trunk 版本
  • *.merge-left.r4521 = ?
  • *.working = 分支版本

我似乎无法弄清楚 merge-left.r4521 是什么。如果答案是它只是分支中文件的旧版本,那么为什么是 4521?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

五里雾 2024-12-15 16:40:07

假设有两个分支,分支 A 中的最后一个 (HEAD) 修订版是 9,而它是 6 > 在分支 B 中。

cd B 时; svn merge -r 5:8 ^/braches/A 运行后,svn 将尝试在分支 A< 的 58 之间应用增量/code> 位于分支 B 顶部。

(换句话说,更改集 78 将应用于 B

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

如果增量应用干净,那就一切都很好。

假设某些行在更改集 3 中进行了修改,并且相同的源代码行在更改集 4 中进行了不同的修改。

如果 delta (58) 没有触及这些线,那么一切仍然很好。

如果 delta (58) 也修改了 34 所做的事情,则更改无法自动合并,并且svn 使文件处于冲突状态:

  • file --- 以 (working, left, right) 分隔的文件
  • file.working --- 分支中文件的状态B@6
  • file.merge-left --- 分支中文件的状态 A@5
  • file.merge-right --- 分支中的文件状态 A@8

如果您手动编辑这样的文件,您有几个选择 --- 继续工作(您的版本),保持正确(他们的版本;其他分支版本)或手动合并更改。

Left 本身没有用,没有必要在文件中保留 left (他们的旧版本)。

然而,它对于工具很有用。 leftright 是变更集。

例如,当您看到:

<<<<<<< .working

    life_universe_and_everything = 13

||||||| .merge-left.r5

    life_universe_and_everything = "13"

=======

    life_universe_and_everything = "42"

>>>>>>> .merge-right.r8

在分支 A 中,"13" (str) 更改为 "42"

分支 B13 (int)。

当您手动协调此冲突时,也许您需要 42 (int)。

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.

2024-12-15 16:40:07

file.merge-left.r4521 是创建右分支(目标)之前左分支(即源)中该文件的最新更改。

换句话说,merge-left.r4521是要

与merge-right.r5004(目标分支的最新版本)

合并的文件的第一个版本例如,假设您要合并分支左、右如下:

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

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
偏闹i 2024-12-15 16:40:07
  • 'file.py.merge-left.rxxx` 显示取冲突左侧的合并结果
  • 'file.py.merge-right.ryyy` 显示取冲突右侧的合并结果
  • 'file.py.working ` 显示未更改的工作副本
  • 'file.py` 显示 SVN 尝试合并两者

这个问题类似于 stackoverflow.com/questions/1673658/svnmerge-workflow 但这一个更具体地说明了冲突文件的内容。

  • '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 stackoverflow.com/questions/1673658/svnmerge-workflow but this one is more specific about the content of the conflict files.

水晶透心 2024-12-15 16:40:07

似乎“左”文件是最后一个版本,其中文件在主干和分支中相同(对于您的问题,但通常位于源和目标之间)。

如果您从未将主干中的更改合并到分支中,那么这将是执行分支(复制)时主干的版本。否则,它是合并并提交到此分支的主干的最后一个版本。

左侧和右侧用于创建将(作为补丁)应用到工作文件的差异。

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.

苍暮颜 2024-12-15 16:40:07

您执行了 3 边合并以解决冲突(当合并2 个不同的文件时)。此操作 3 个源使用了

  • “您的”文件(来自 WC 或源位置,具体取决于参数)
  • “他们的”文件(必须合并有更改的文件)
  • “基本”文件(文件 1-2 的共同祖先)

r* ** 扩展名刚刚添加到相同的文件名中,以便合并 3 个文件

成功合并并将冲突标记为已解决的临时文件后,如果我的记性不错的话,临时文件必须自动消失

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文