简体   繁体   中英

Tortoise SVN Switch Branch Command Error - “Shares No Common Ancestry”

When I try to do "switch" to change a directory to a different branch I get a strange error message.

This is how repository is set up looking at it from the host's website. I used to have a branch called bugfix-lobby-quirks, but it was deleted after I merged it to trunk. This and the new feature-in-game-opponents-cards were both branched off of trunk.

在此输入图像描述

Now I want to take my checked out working copy "switched" from the deleted branch to this new branch. I have the bugfix-lobby-quirks branch already checked out on my computer since I was just working on it. What I want to do is switch everything in this folder to everything in the new branch I choose, which is nice since they aren't really all that different. This is what svn switch means, right?

在此输入图像描述

So then I click switch and a popup comes up. It automatically recognizes the branch and displays it in the list here so I choose it.

在此输入图像描述

Unfortunately, doing this leads to this error message every time.

在此输入图像描述

It's not a happy day. It's a sad day.

Ok. So what am I doing wrong?

单击svn开关对话框中的“忽略祖先”复选框。

You may get this because you were trying to switch one of your sub folders instead of doing the top level folder. That is, you were trying to switch just folder trunk/application instead of trunk.

You might be able to switch a deleted branch to an active branch. To Subversion, that branch no longer exists. (And since it doesn't exist, it doesn't share any ancestry).

Go to your working copy of your deleted branch, and see if you can do an update to the revision before the branch itself was deleted. Then, try the switch.

If that doesn't work, you will have to undelete your branch. This isn't difficult from the command line. Let's say your branch was deleted in revision 12345:

$ svn co --set-depth=immediates $URL/branches   # Checks out just branch names
$ cd branches
$ svn merge -c -12345 .                         # Removes branch delete

The --set-depth=immediates will checkout all of your branches, but won't checkout the projects beneath them. This will be a fairly fast checkout and gives you a working directory of your /branches directory. Now, you can do a reverse merge of your delete, and restore the branch.

If you don't want to do a checkout and merge, you can do a svn cp where you copy the branch from the revision before it was deleted to the current revision:

$ svn cp -r12344 $URL/branches/features_in_opponents_cards@12344 $URL/branches

This will allow you to restore the branch without first having to do a checkout.

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