提取自svn help merge
4 这种形式称为“2-URL 合并”:
svn merge SOURCE1[@N] SOURCE2[@M] [TARGET_WCPATH]
指定了两个源 URL,以及两个修订版 N 和 M。在指定修订版处比较两个源,并将差异应用于 TARGET_WCPATH,它是另一个分支的工作副本的路径。
我将在合并之前跳过一些初步步骤,并将在某些地方使用 Win 风格的路径(这里没有 bash,抱歉)并稍微改变工作流程(分支将是非空的)
z:\>dir /B
svn
localws
z:\>dir localws /B /S
z:\localws\mtree
...
z:\localws\mtree\branches
z:\localws\mtree\trunk
z:\>svn ls -v -R file:///Z:/svn/mtree
3 Badger окт 13 21:30 ./
3 Badger окт 13 21:30 branches/
2 Badger окт 13 21:29 trunk/
(repo 和 WC 准备好了,但还是空的)
创建并提交到主干的文件
z:\>dir /B z:\localws\mtree\trunk
1.txt
2.txt
z:\>svn ls -v -R file:///Z:/svn/mtree
4 Badger окт 13 21:48 ./
3 Badger окт 13 21:30 branches/
4 Badger окт 13 21:48 trunk/
4 Badger 9 окт 13 21:48 trunk/1.txt
4 Badger 9 окт 13 21:48 trunk/2.txt
分行发起
Z:\localws\mtree\trunk>svn copy file:///Z:/svn/mtree/trunk file:///Z:/svn/mtree/branches/test-reintegrate -m "Create test-reintegrate branch"
Committed revision 5.
测试一下
Z:\localws\mtree\trunk>svn ls -v -R file:///Z:/svn/mtree
5 Badger окт 13 22:17 ./
5 Badger окт 13 22:17 branches/
5 Badger окт 13 22:17 branches/test-reintegrate/
4 Badger 9 окт 13 21:48 branches/test-reintegrate/1.txt
4 Badger 9 окт 13 21:48 branches/test-reintegrate/2.txt
4 Badger окт 13 21:48 trunk/
4 Badger 9 окт 13 21:48 trunk/1.txt
4 Badger 9 окт 13 21:48 trunk/2.txt
svn up
并在 Z:\localws\mtree之后获取更新的 WC
Z:\localws\mtree>dir /B /S
Z:\localws\mtree\branches
Z:\localws\mtree\trunk
...
Z:\localws\mtree\branches\test-reintegrate\2.txt
Z:\localws\mtree\branches\test-reintegrate\1.txt
Z:\localws\mtree\trunk\1.txt
Z:\localws\mtree\trunk\2.txt
向主干添加了新文件,在分支中编辑了文件
Z:\localws\mtree>svn log -v -r6:7
------------------------------------------------------------------------
r6 | Badger | 2012-10-13 22:28:04 +0600 (Сб, 13 окт 2012) | 1 line
Changed paths:
A /mtree/trunk/3.txt
Added new file to trunk
------------------------------------------------------------------------
r7 | Badger | 2012-10-13 22:29:20 +0600 (Сб, 13 окт 2012) | 1 line
Changed paths:
M /mtree/branches/test-reintegrate/2.txt
Some changes
------------------------------------------------------------------------
服务器端视图
Z:\localws\mtree>svn ls -v -R file:///Z:/svn/mtree
7 Badger окт 13 22:29 ./
7 Badger окт 13 22:29 branches/
7 Badger окт 13 22:29 branches/test-reintegrate/
4 Badger 9 окт 13 21:48 branches/test-reintegrate/1.txt
7 Badger 17 окт 13 22:29 branches/test-reintegrate/2.txt
6 Badger окт 13 22:28 trunk/
4 Badger 9 окт 13 21:48 trunk/1.txt
4 Badger 9 окт 13 21:48 trunk/2.txt
6 Badger 9 окт 13 22:28 trunk/3.txt
将分支与主干同步 - 将主干中的更改合并到测试重新集成
Z:\localws\mtree>cd branches
Z:\localws\mtree\branches>cd test-reintegrate
Z:\localws\mtree\branches\test-reintegrate>svn merge file:///Z:/svn/mtree/trunk
--- Merging r5 through r7 into '.':
A 3.txt
--- Recording mergeinfo for merge of r5 through r7 into '.':
U .
检查 WC 状态
Z:\localws\mtree\branches\test-reintegrate>dir /B
2.txt
1.txt
3.txt
并提交结果
Z:\localws\mtree\branches\test-reintegrate>svn commit -m "Sync of test-reintegrate"
Sending .
Adding 3.txt
Committed revision 8.
服务器端
Z:\>svn ls -v file:///Z:/svn/mtree/branches/test-reintegrate
8 Badger окт 13 22:47 ./
4 Badger 9 окт 13 21:48 1.txt
7 Badger 17 окт 13 22:29 2.txt
8 Badger 9 окт 13 22:47 3.txt
恢复
与您的风格相比,我的变化(以及“胜利失败”的结果)
高温高压