【问题标题】:SVN Merging and tree conflicts "local add, incoming add upon merge"SVN 合并和树冲突“本地添加,合并时的传入添加”
【发布时间】:2015-01-13 17:48:03
【问题描述】:

我正在尝试遵循http://svnbook.red-bean.com/en/1.7/svn.branchmerge.commonpatterns.html 中描述的发布分支模型,但是在尝试进行合并时,我遇到了合并冲突。

# Normal SVN Structure
svn-testing2> ls -l
total 12K
drwxrwxr-x 3 xxx yyy 4.0K Jan 13 17:28 branches/
drwxrwxr-x 3 xxx yyy 4.0K Jan 13 17:28 tags/
drwxrwxr-x 3 xxx yyy 4.0K Jan 13 17:28 trunk/

# Create & commit some  data
svn-testing2> echo "line1" > trunk/file1; svn add trunk/file1; svn commit -m "created file1 " trunk/file1
Adding         trunk/file1
Transmitting file data .
Committed revision 2.

# Create the release branch
svn-testing2> svn copy trunk branches/release
A         branches/release
svn-testing2> svn commit -m "created release branch" branches/release
Adding         branches/release
Adding         branches/release/file1

Committed revision 3.

# Make & commit a change to trunk
svn-testing2> echo "line1-file2" > trunk/file2; svn add trunk/file2; svn commit -m "created file2" trunk/file2
A         trunk/file2
Adding         trunk/file2
Transmitting file data .
Committed revision 4.

# Attempt to merge the change to trunk:
svn-testing2> cd branches/release/
svn-testing2/branches/release> svn merge ^/trunk
--- Merging r2 through r4 into '.':
   C file1
A    file2
Summary of conflicts:
  Tree conflicts: 1
bumjvr@mbs-p:~/svn-testing/svn-testing2/branches/release> svn st
 M      .
      C file1
      >   local add, incoming add upon merge
A  +    file2

我可以解决这个问题

svn-testing2> svn resolve --accept=working *

但我必须这样做似乎是错误的。

如果我随后将“修补程序”(例如创建“release/file3”)应用到我的发布分支,我如何将其移植回主干?如果我将“发布”合并到“主干”中,它会合并正常,但是当将“主干”合并回“发布”时,我会遇到另一个 local add, incoming add upon merge 冲突,例如“文件3”

我并不是要“重新集成”功能分支,因为它们都是长期运行的分支。

令人沮丧的是,SVN 红皮书(通常非常好)描述了这种常见的分支模式,没有实际运行哪些命令的示例!

在没有所有这些不正确的合并冲突的情况下,我究竟需要运行什么才能遵循这种分支模式?或者在任何地方都有这种分支模式的工作示例 - 我找不到!

【问题讨论】:

  • 我认为您的一个 cmets 已关闭。 Attempt to merge the change to trunk 应该改为 ... to release,对吧?

标签: svn svn-merge


【解决方案1】:

这是由于您的 copy 操作完全在客户端完成。此操作不包含任何合并跟踪信息,因此当您尝试合并时,它会尝试在自身之上添加file1copy 命令帮助中的免责声明中描述了此行为:

> svn 帮助复制 复制(cp):复制工作副本或存储库中的文件和目录。 用法:复制 SRC[@REV]... DST SRC 和 DST 都可以是工作副本 (WC) 路径或 URL: WC -> WC:复制和添加计划(带有历史记录) WC -> URL:立即将 WC 的副本提交到 URL URL -> WC:将 URL 检出到 WC,添加计划 URL -> URL:完整的服务器端复制;用于分支和标记 所有 SRC 必须属于同一类型。复制多个来源时, 它们将被添加为 DST 的子级,它必须是一个目录。 警告:为了与以前版本的 Subversion 兼容, 使用两个工作副本路径(WC -> WC)执行的副本不会 联系存储库。因此,默认情况下,他们可能无法 从副本的源传播合并跟踪信息 到目的地。

如果你把copy改成服务器端的副本,合并就会成功:

# This is the difference, the copy happens on the server
> svn copy ^/trunk ^/branches/release2 -m "Creating release2"
Committed revision 5.

# Update our working copy to get the new release
> svn update branches
Updating 'branches':
A    branches\release2
A    branches\release2\file1
A    branches\release2\file2
Updated to revision 5.

> echo blah>trunk\file3; svn add trunk\file3; svn commit -m "created file3"
A         trunk\file3
Adding         trunk\file3
Transmitting file data .
Committed revision 6.

> cd branches\release2
> svn merge ^/trunk
--- Merging r5 through r6 into '.':
A    file3
--- Recording mergeinfo for merge of r5 through r6 into '.':
 U   .

【讨论】:

  • 啊,谢谢!我正在阅读 svn 红皮书,我还没有阅读“复制”的帮助。
猜你喜欢
  • 2012-03-02
  • 2011-04-16
  • 2013-01-02
  • 1970-01-01
  • 2013-10-27
  • 2014-02-18
  • 2014-07-28
  • 2022-12-16
  • 1970-01-01
相关资源
最近更新 更多