简体   繁体   English

颠覆性:svn:E195016:无法合并到带有切换子树的工作副本

[英]Subversive: svn: E195016: Cannot merge into a working copy with a switched subtree

I have an issue with Eclipse and Subversive. 我有Eclipse和Subversive的问题。

I'm trying to reintegrate a branch of a project into the trunk. 我正在尝试将项目的一个分支重新集成到主干中。

These are the operations that I'm following: 这些是我正在遵循的操作:

  1. Switch to the trunk version of the project 切换到项目的主干版本
  2. I have ensured that there were no any pending operations, doing a Revert and an Update, in order to start from a "clean" working copy, perfectly synchronized with the remote copy of the trunk 我确保没有任何待处理的操作,执行还原和更新,以便从“干净”的工作副本开始,与主干的远程副本完美同步
  3. I go to "Team -> Merge ..." 我去“团队 - >合并......”
  4. I go to the "Reintegrate" tab, and I choose the branch that I want to merge within the trunk, pointing at "Head revision" of the branch. 我转到“重新整合”选项卡,然后选择要在主干内合并的分支,指向分支的“头部修订”。
  5. I press the OK button, but this is the error that I obtain: 我按下确定按钮,但这是我获得的错误:

 Merge operation failed.
Can't overwrite cause with org.tmatesoft.svn.core.SVNException: svn: E195016:
Cannot merge into a working copy with a switched subtree

I don't understand what's wrong. 我不明白什么是错的。

I'm using this Eclipse and SVN configuration: 我正在使用这个Eclipse和SVN配置:

Eclipse Java EE IDE for Web Developers.
Version: Neon.1 Release (4.6.1)
Build id: 20160913-0900

Subversive SVN Team Provider    4.0.3.I20161129-1700    

SVNKit 1.8.14 Implementation (Optional) 6.0.3.I20161124-1700

SVN 1.9

Thanks in advance. 提前致谢。

I don't know exactly why there is this issue, but I noticed that it occurs if we perform some "switch" operations between branches before the Merge operation. 我不确切知道为什么会出现这个问题,但我注意到如果我们在Merge操作之前在分支之间执行一些“切换”操作,就会发生这种情况。

For some reasons, in this situation it's avoided to perform a merge operation. 出于某些原因,在这种情况下,可以避免执行合并操作。

The "workaround" that I have found is to perform the merge operation on a clean copy of the trunk, after the SVN checkout of the trunk, without make any switch operation. 我找到的“解决方法”是在SVN签出中继后,在干线的干净副本上执行合并操作,而不进行任何切换操作。

In this way, the error doesn't occurs any more. 这样,错误就不再发生了。

It's not a practical solution, but it works. 这不是一个实用的解决方案,但它确实有效。

Reintegration merges in SVN 1.8 and newer are done automatically , by default. 默认情况下,SVN 1.8和更新版本中的重新集成合并会自动完成 Automatic reintegration merge cannot be performed in case your working copy is of mixed revision or has switched paths. 如果您的工作副本是混合版本或已切换路径,则无法执行自动重新集成合并。

SVNKit might be working differently from actual Apache Subversion, though. 但是,SVNKit可能与实际的Apache Subversion不同。

Read about automatic merges in SVNBook : 阅读SVNBook中的自动合并:

Your trunk working copy cannot have any local edits, switched paths, or contain a mixture of revisions (see the section called “Mixed-revision working copies”). 您的主干工作副本不能具有任何本地编辑,切换路径或包含修订的混合(请参阅“混合修订工作副本”一节)。 While these are typically best practices for merging anyway, they are required for automatic reintegrate merges. 虽然这些通常是合并的最佳实践,但它们是自动重新集成合并所必需的。

I think I have found two ways to get into the E195016: Cannot merge into a working copy with a switched subtree state. 我想我已经找到了两种进入E195016的方法:无法合并到具有切换子树状态的工作副本

1) Switch from the trunk to a branch (with edits and commits), then switch to a different branch (with edits and commits), then switch to the trunk and try to reintegrate one of the branches. 1)从主干切换到分支(带编辑和提交),然后切换到不同的分支(带编辑和提交),然后切换到主干并尝试重新集成其中一个分支。

Hint: Never switch between branches, always switch back to the trunk between branches. 提示:切勿在分支之间切换,始终切换回分支之间的主干。

2) Accidentally edit in the trunk and then realize your mistake. 2)意外地在后备箱中编辑然后实现你的错误。 Revert the trunk, create a branch (with switch, edits, and commits), switch back to the trunk and then try to reintegrate the branch. 恢复中继,创建分支(使用开关,编辑和提交),切换回主干,然后尝试重新集成分支。

Hint: Never revert the trunk. 提示:永远不要恢复行李箱。 Use the Replace with, Latest from the repository from the (right click) context menu instead. 使用(右键单击)上下文菜单中的替换为最新存储库

I have only found one way to reliably recover from this state. 我只找到了一种从这种状态可靠恢复的方法。

  1. Backup your workspace. 备份您的工作区。
  2. Delete your project from the original workspace selecting Delete project contents on disk (cannot be undone) . 从原始工作区中删除项目,选择“ 删除磁盘上的项目内容”(无法撤消)
  3. Create a new project to replace it. 创建一个新项目来替换它。

The backup is not used if you recover successfully, it's just a safety net if you make a catastrophic mistake. 如果您成功恢复,则不会使用备份,如果您犯了一个灾难性的错误,它只是一个安全网。

In my case, replacing the project means creating a new Project from SVN and using the option to complete the project using a new project wizard (PyDev Project in my case). 在我的例子中,替换项目意味着从SVN创建一个新项目并使用该选项使用新项目向导(在我的案例中为PyDev Project)完成项目。 In your case, you need to develop your own recovery method. 在您的情况下,您需要开发自己的恢复方法。 Don't forget to write it down. 别忘了写下来。

Of course, you can choose to start a completely new workspace instead. 当然,您可以选择启动全新的工作区。 If you chose this approach, don't forget to export your preferences and your launchers (as a minimum) so you can import them into the new workspace. 如果您选择此方法,请不要忘记导出首选项和启动器(至少),以便将它们导入新工作区。 That way you still have your familiar configuration. 这样你仍然有你熟悉的配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM