Tortoise SVN Switch Branch Command Error - "Shares No Common Ancestry"
Asked Answered
F

3

29

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.

enter image description here

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?

enter image description here

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.

enter image description here

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

enter image description here

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

Ok. So what am I doing wrong?

Full answered 15/12, 2014 at 3:17 Comment(0)
S
40

Click on the "ignore ancestry" checkbox in the svn switch dialog.

Sanctimony answered 24/9, 2015 at 13:41 Comment(0)
C
8

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.

Courtnay answered 2/7, 2015 at 15:34 Comment(2)
Similar issue for me but the other way around, i was switching the root folder instead of just the trunk/branch subfolderFatuitous
Almost had a heart attack. Thank youSemmes
T
3

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.

Told answered 15/12, 2014 at 17:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.