管理主干和功能分支

管理主干和功能分支

本文介绍了管理主干和功能分支:本地删除,合并后的传入删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有功能分支方案的svn.每当我尝试将中继线合并到分支时,都会遇到本地删除,合并时传入删除"的问题.这对我来说没有意义.我为重现错误所做的工作:1)使用"svn复制^/blabla/trunk ^/blabla/branches/test-merge"创建一个分支2)将新文件添加到中继"touch t.c; svn add t.c; svn commit"3)合并到主干到分支"svn merge ^/blabla/trunk ^/blabla/branches/test-merge"输出为:

I am using svn with a feature branch scheme. Whenever I try to merge trunk to a branch, I got the problem "local delete, incoming delete upon merge". It does not make sense to me.What I did to reproduce the error:1) create a branch with "svn copy ^/blabla/trunk ^/blabla/branches/test-merge"2) add a new file to trunk "touch t.c ; svn add t.c ; svn commit"3) merge to trunk to branch "svn merge ^/blabla/trunk ^/blabla/branches/test-merge"The output is:

--- Merging differences between repository URLs into '.':
 C t.c
Summary of conflicts:
 Tree conflicts: 1

我正在使用版本"1.6.17(r1128011)"

I am using version "1.6.17 (r1128011)"

手动解决冲突(使用svn accept)无济于事.新文件未出现在分支中,并且新合并会导致相同的冲突.

Resolving the conflict manually (with svn accept) does not help. The new file does not appear in the branch and a new merge results in the same conflict.

我做错了什么?

推荐答案

svn help merge

  svn merge SOURCE1[@N] SOURCE2[@M] [TARGET_WCPATH]

指定了两个源URL,以及两个修订版N和M. 在指定的修订版中比较了这两个来源,并且 差异应用于TARGET_WCPATH,这是工作的路径 另一个分支的副本.

Two source URLs are specified, together with two revisions N and M. The two sources are compared at the specified revisions, and the difference is applied to TARGET_WCPATH, which is a path to a working copy of another branch.

在合并之前,我将跳过一些预备步骤,并将在某些地方使用Win样式的路径(这里没有bash,对不起),并且略微更改了工作流程(分支将为非空)

I'll skip some preliminary steps before merge and will use Win-style paths in some places (no bash here, sorry) and slightly change workflow (branch will be non-empty)

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/

(已准备好回购和WC,但仍为空)

(repo and WC prepared, but still empty)

文件已创建并提交到主干

Files created and commited to trunk

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


分支开始


Branch initiated

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

,并在Z:\ localws \ mtree

and get updated WC after svn up in Z:\localws\mtree

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


将新文件添加到中继,在分支中编辑文件


Added new file to trunk, edited file in branch

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

恢复

我对您的风格所做的更改(以及胜出失败"的结果)

Resume

My changes in comparison to your style (and "win ws fail" result)

  • 没有^速记的完整路径(即使在svn copy阶段也出现错误,建议使用AFAIK ^,并且在以WC的根源分支"样式的情况下可用,而不是结合使用普通的WC/,但我可能是错误的/)

  • Full path without ^ shorthand (I got error even on svn copy stage, AFAIK ^ recommended and usable in case of "branch in the root of WC" style, not combined common WC /but I could be wrong/)

使用经典合并形式(单个URL)

Using classic form of merge (Single URL)

HTH

这篇关于管理主干和功能分支:本地删除,合并后的传入删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 17:11