简体   繁体   中英

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

I have an issue with Eclipse and 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 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.

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.

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. 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.

Read about automatic merges in 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.

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.

Hint: Never switch between branches, always switch back to the trunk between branches.

2) Accidentally edit in the trunk and then realize your mistake. 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). 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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