svn merge left, right &之间的区别冲突后的工作文件 [英] Differences between svn merge left, right & working files after conflicts
问题描述
当从我的开发团队的主干到分支执行svn合并"时,我们偶尔会遇到合并冲突,产生后缀名的文件:*.merge-right.r5004
, *.merge-left.r4521
和 *.working
.我搜索了整个 Subversions 的文档,但他们的解释并没有多大用处.我收集了以下内容:
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 = 主干版本
- *.merge-left.r4521 = ?
- *.working = 分支版本
我似乎无法弄清楚 merge-left.r4521
是什么.如果答案是它只是来自分支的文件的旧版本,那么为什么是 4521?
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?
推荐答案
假设有两个分支,分支 A
的最后一个 (HEAD
) 修订版是 9
,而6
在分支B
.
Let's say there are two branches, and last (HEAD
) revision in branch A
is 9
, while it is 6
in branch B
.
当cd B;svn merge -r 5:8 ^/braches/A
运行,svn 将尝试在 5
和 8
之间应用 delta A
在分支 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
.
(换句话说,变更集7
和8
将应用于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
如果 delta 应用干净,那就没问题了.
If the delta applies cleanly, it's all good.
假设某些行在变更集 3
中被修改,而相同的源代码行在变更集 4
中的修改不同.
Let's say some lines were modified in change set 3
, and same source lines were modified differently in change set 4
.
如果 delta (5
→8
) 没有触及这些行,一切都还好.
If delta (5
→8
) doesn't touch those lines, all is still good.
如果 delta (5
→8
) 也修改了 3
和 4
所做的,更改不能合并自动,并且 svn 使文件处于冲突状态:
If delta (5
→8
) also modified what 3
and 4
did, changes cannot be merged automatically, and svn leaves a file in conflict state:
file
--- 用 (working
,left
,right
) 分隔的文件file.working
---B@6
分支中文件的状态file.merge-left
---A@5
分支中文件的状态file.merge-right
---A@8
分支中文件的状态
file
--- file with (working
,left
,right
) delimitedfile.working
--- state of file in branchB@6
file.merge-left
--- state of file in branchA@5
file.merge-right
--- state of file in branchA@8
如果你手动编辑这样的文件,你有几个选择---保持 working
(你的版本),保持 right
(他们的版本;另一个分支版本) 或手动合并更改.
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
本身没有用,在文件中保留 left
(他们的旧版本)是没有意义的.
Left
is not useful in itself, there's no point to keep left
(their old version) in the file.
然而,它对工具很有用.left
→right
是变更集.
It is, however, useful for tools. left
→right
is the change set.
当你看到,例如:
<<<<<<< .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"
.
In branch A
, "13"
(str) was changed to "42"
.
分支 B
有 13
(int).
Branch B
had 13
(int).
也许您需要 42
(int) 当您手动协调此冲突时.
Perhaps you want 42
(int) when you reconcile this conflict manually.
这篇关于svn merge left, right &之间的区别冲突后的工作文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!