- 使用“2-URL 合并”作为“最后手段”,此处不需要
svn help merge
仔细阅读命令选项
如果你想合并到tag2,你有:
- 将 tag_2 检出到新的工作副本中,或者如果它存在,则将其设为 Clean WC:无本地修改,无混合修订
- 在这个 WC
svn merge http://host/svn/tags/tag_1 --accept 'mine-conflict'
中做这个把戏(没有冲突的部分将被合并,对于有冲突的块“我的” - 即 tag_2 版本 - 将被自动选择)
- 提交合并结果
编辑:测试运行以回复评论
初始状态(使用主干和分支)
svn log -q -v file:///Z:/Repo/
------------------------------------------------------------------------
r3 | Badger | 2013-01-17 10:07:55 +0600 (Чт, 17 янв 2013)
Changed paths:
A /branches/MyFixes (from /trunk:2)
------------------------------------------------------------------------
r2 | Badger | 2013-01-17 10:03:32 +0600 (Чт, 17 янв 2013)
Changed paths:
A /trunk/Data
A /trunk/Data/b.txt
A /trunk/Data/c.txt
A /trunk/a.txt
------------------------------------------------------------------------
r1 | Badger | 2013-01-17 09:57:52 +0600 (Чт, 17 янв 2013)
Changed paths:
A /branches
A /tags
A /trunk
------------------------------------------------------------------------
svn ls -R file:///Z:/Repo/trunk
Data/
Data/b.txt
Data/c.txt
a.txt
svn ls -R file:///Z:/Repo/branches/MyFixes
Data/
Data/b.txt
Data/c.txt
a.txt
更改分支(编辑文件,添加新对象)
svn log -q -v file:///Z:/Repo/ -l 1
------------------------------------------------------------------------
r4 | Badger | 2013-01-17 10:26:40 +0600 (Чт, 17 янв 2013)
Changed paths:
M /branches/MyFixes/Data/b.txt
M /branches/MyFixes/Data/c.txt
A /branches/MyFixes/Data/d.txt
A /branches/MyFixes/NewData
A /branches/MyFixes/NewData/e.txt
A /branches/MyFixes/NewData/f.txt
M /branches/MyFixes/a.txt
------------------------------------------------------------------------
控制“M”文件的差异
svn diff file:///Z:/Repo/trunk/a.txt file:///Z:/Repo/branches/MyFixes/a.txt
Index: a.txt
===================================================================
--- a.txt (.../trunk/a.txt) (revision 4)
+++ a.txt (.../branches/MyFixes/a.txt) (revision 4)
@@ -1,2 +1,2 @@
-String 1
-String 2
+A String 1
+A String 2
svn diff file:///Z:/Repo/trunk/Data/b.txt file:///Z:/Repo/branches/MyFixes/Data/b.txt
Index: b.txt
===================================================================
--- b.txt (.../trunk/Data/b.txt) (revision 4)
+++ b.txt (.../branches/MyFixes/Data/b.txt) (revision 4)
@@ -1,2 +1,3 @@
-Data String 1
-Data String 2
+The Data String One
+The Data String Two
+The Data String Three
svn diff file:///Z:/Repo/trunk/Data/c.txt file:///Z:/Repo/branches/MyFixes/Data/c.txt
Index: c.txt
===================================================================
--- c.txt (.../trunk/Data/c.txt) (revision 4)
+++ c.txt (.../branches/MyFixes/Data/c.txt) (revision 4)
@@ -1,2 +1,3 @@
-String 1 data
-String 2 data
+1 Los datos de cadena
+Cadena 2 Datos
+Cadena 3 Datos
尝试合并
z:\Trunk>svn merge file:///Z:/Repo/branches/MyFixes --accept "mine-conflict" --dry-run
--- Merging r3 through r4 into '.':
A NewData
A NewData\e.txt
A NewData\f.txt
U Data\b.txt
U Data\c.txt
A Data\d.txt
U a.txt
印象 - 没有冲突(如预期),无树冲突(如我所料),合并的分歧文件,来自分支的新文件 - 添加
真正的合并
z:\Trunk>svn merge file:///Z:/Repo/branches/MyFixes --accept "mine-conflict"
--- Merging r3 through r4 into '.':
U Data\b.txt
U Data\c.txt
A Data\d.txt
U a.txt
A NewData
A NewData\e.txt
A NewData\f.txt
--- Recording mergeinfo for merge of r3 through r4 into '.':
U .
提交合并
svn log -q -v file:///Z:/Repo/ -l 1
------------------------------------------------------------------------
r5 | Badger | 2013-01-17 10:50:35 +0600 (Чт, 17 янв 2013)
Changed paths:
M /trunk
M /trunk/Data/b.txt
M /trunk/Data/c.txt
A /trunk/Data/d.txt (from /branches/MyFixes/Data/d.txt:4)
A /trunk/NewData (from /branches/MyFixes/NewData:4)
M /trunk/a.txt
------------------------------------------------------------------------
注意 - 问题!
也许我在分支 (a/b/c) 中错误地编辑了文件,但由于某些奇怪的原因--accept "mine-conflict"
被忽略了,合并后的文件等于其分支的父级。
补充:好的,我忘记在合并之前在主干中编辑 a/b/c。Mea culpa,在添加这一点后必须完全按预期工作