SVN如何解决在两个分支上添加文件时的新树冲突

发布于 2024-07-18 02:11:10 字数 367 浏览 4 评论 0原文

当合并几个分支(使用 SVN 1.6.1)时,两个分支上都添加了一个文件(然后在这些单独的分支中处理),我遇到了新的树冲突之一:

      C foo.txt
  >   local obstruction, incoming add upon merge

我需要两个分支的更改,但树冲突并没有给我通常的 .working、.merge-left 和 .merge-left 。 .merge-right 文件——由于冲突的性质,这是可以理解的。 其中存在相当多的冲突,并且每个分支上都发生了相同文件的删除,但它们很容易解决。

我该如何解决这个问题? SVN redbean 的书(1.6 版)没有涵盖这种情况。

When merging a couple of branches (using SVN 1.6.1) where a file has been added on both branches (and then worked on in those separate branches) I'm getting one of the new tree conflicts:

      C foo.txt
  >   local obstruction, incoming add upon merge

I need the changes from both branches, but the tree conflict doesn't give me the usual .working, .merge-left & .merge-right files -- which is understandable due to the nature of the conflict. There are quite a few of these conflict, and ones where a delete of the same file has occurred on each branch, but they're simple to resolve.

How can I resolve this issue? The SVN redbean book (for 1.6) doesn't cover this situation.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

余生共白头 2024-07-25 02:11:10

我发现帖子建议了一个解决方案。 即将运行:

svn resolve --accept working <YourPath>

这将声明本地版本文件正常。
您可以针对单个文件或整个项目目录运行它。

I found a post suggesting a solution for that. It's about to run:

svn resolve --accept working <YourPath>

which will claim the local version files as OK.
You can run it for single file or entire project catalogues.

当爱已成负担 2024-07-25 02:11:10

正如 “树冲突”设计文档:

合并添加版本控制文件导致 XFAIL 冲突

此测试进行合并,将没有历史记录的文件添加到
现有版本化文件

这应该是“本地阻塞,合并时传入添加”类型的文件上的树冲突。 修复了 r35341 中的预期。

(顺便说一句,这在 ClearCase 中也称为“邪恶双胞胎”):
一个文件在两个不同的分支中创建两次(此处“添加”两次),为两个不同的元素创建两个不同的历史记录,但名称相同。

理论上的解决方案是手动合并这些文件(使用外部 diff 工具)到目标分支“B2”中。

如果您仍在源分支上工作,理想的情况是从源分支 B1 中删除该文件,然后从 B2 合并回 B1 以使该文件在 B1 上可见(然后您将处理同一元素)。
如果由于合并仅从 B1B2 发生而无法合并回,则每个 B1->B2 都需要手动合并> 合并。

As was mentioned in an older version (2009) of the "Tree Conflict" design document:

XFAIL conflict from merge of add over versioned file

This test does a merge which brings a file addition without history onto an
existing versioned file
.
This should be a tree conflict on the file of the 'local obstruction, incoming add upon merge' variety. Fixed expectations in r35341.

(This is also called "evil twins" in ClearCase by the way):
a file is created twice (here "added" twice) in two different branches, creating two different histories for two different elements, but with the same name.

The theoretical solution is to manually merge those files (with an external diff tool) in the destination branch 'B2'.

If you still are working on the source branch, the ideal scenario would be to remove that file from the source branch B1, merge back from B2 to B1 in order to make that file visible on B1 (you will then work on the same element).
If a merge back is not possible because merges only occurs from B1 to B2, then a manual merge will be necessary for each B1->B2 merges.

謸气贵蔟 2024-07-25 02:11:10

如果传入的更改是您想要的怎么办? 我无法运行 svn resolve --accept Theirs-full

svnresolve --acceptbase

What if the incoming changes are the ones you want? I'm unable to run svn resolve --accept theirs-full

svn resolve --accept base

滥情哥ㄟ 2024-07-25 02:11:10

我只是设法完全融入自己,尝试遵循上面 user619330 的建议。 情况是:(1):我在我的初始分支branch1上工作时添加了一些文件; (2) 我创建了一个新分支,branch2 以便进一步开发,将其从主干分支出来,然后合并我对branch1 的更改 (3) 一位同事将我的 mods 从branch1复制到他自己的分支,添加了更多mods,然后合并回主干; (4) 我现在想将 trunk 中的最新更改合并到我当前的工作分支branch2 中。 这是 svn 1.6.17 的情况。

合并与新文件存在树冲突,我想要来自主干的新版本,因为它们不同,所以从branch2的干净副本中,我对冲突文件进行了svn删除,提交了这些branch2更改(从而创建了一个临时文件)没有相关文件的branch2版本),然后从主干进行合并。 我这样做是因为我希望历史记录与主干版本匹配,这样以后在尝试合并回主干时就不会遇到更多问题。 合并进展顺利,我得到了文件的主干版本,svn st 显示一切正常,然后我在尝试提交更改时遇到了更多树冲突,在我之前完成的删除和合并中的添加之间。 svn 是否解决了有利于我的工作副本(现在具有文件的主干版本)的冲突,并提交了它。 一切都应该很好,对吧?

嗯,不。 对branch2 的另一个副本的更新导致文件的旧版本(主干合并前)。 所以现在我有两个不同的branch2工作副本,据说更新到了相同的版本,有两个不同版本的文件,并且都坚持认为它们是完全最新的! 签出branch2 的干净副本会导致文件的旧(主干之前)版本。 我手动将这些更新到主干版本并提交更改,返回到我的第一个工作副本(我最初从其中提交了主干更改),尝试更新它,现在在相关文件上出现校验和错误。 删除有问题的目录,通过更新获取新版本,最后我有了主干更改的分支2 的良好版本。 我希望。 警告开发商。

I just managed to wedge myself pretty thoroughly trying to follow user619330's advice above. The situation was: (1): I had added some files while working on my initial branch, branch1; (2) I created a new branch, branch2 for further development, branching it off from the trunk and then merging in my changes from branch1 (3) A co-worker had copied my mods from branch1 to his own branch, added further mods, and then merged back to the trunk; (4) I now wanted to merge the latest changes from trunk into my current working branch, branch2. This is with svn 1.6.17.

The merge had tree conflicts with the new files, and I wanted the new version from the trunk where they differed, so from a clean copy of branch2, I did an svn delete of the conflicting files, committed these branch2 changes (thus creating a temporary version of branch2 without the files in question), and then did my merge from the trunk. I did this because I wanted the history to match the trunk version so that I wouldn't have more problems later when trying to merge back to trunk. Merge went fine, I got the trunk version of the files, svn st shows all ok, and then I hit more tree conflicts while trying to commit the changes, between the delete I had done earlier and the add from the merge. Did an svn resolve of the conflicts in favor of my working copy (which now had the trunk version of the files), and got it to commit. All should be good, right?

Well, no. An update of another copy of branch2 resulted in the old version of the files (pre-trunk merge). So now I have two different working copies of branch2, supposedly updated to the same version, with two different versions of the files, and both insisting that they are fully up to date! Checking out a clean copy of branch2 resulted in the old (pre-trunk) version of the files. I manually update these to the trunk version and commit the changes, go back to my first working copy (from which I had submitted the trunk changes originally), try to update it, and now get a checksum error on the files in question. Blow the directory in question away, get a new version via update, and finally I have what should be a good version of branch2 with the trunk changes. I hope. Caveat developer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文