Reputation: 2500
I've been tasked with work on an SVN repository organized as follows:
REPO_ROOT
|-AAA
|-BBB
|-DDD
|-D1
|-D2
|-software
|-branches
|-tags
|-trunk
|-YYY
|-ZZZ
I'm working mostly on ^/DDD/software/trunk
. Now I'd like to create a branch to do some error fixing at ^/DDD/software/branches/error-fixing
.
First I created and committed the ^/DDD/software/branches/error-fixing
directory which did not exist. Then I created a branch of trunk using the command: $ svn copy svn+ssh://[email protected]/REPO_ROOT/DDD/software/trunk svn+ssh://[email protected]/REPO_ROOT/DDD/software/branches/error-fixing -m "Branching from trunk to error-fixing"
.
Now I need to switch to the correct branch. I'm inside trunk
and using the command $ svn switch "^/DDD/software/branches/error-fixing" .
but this fails with svn: E195012: Path '.' does not share common version control ancestry with the requested switch location.
How can I switch to the branch? (First time I'm doing this so I may have done something wrong.)
Upvotes: 3
Views: 3088
Reputation: 2500
The problem comes from the way the branch was created. I first created the error directory and then did the svn copy. This causes the trunk directory to be copied into error-fixing instead of just its contents resulting in ^/DDD/software/branches/error-fixing/trunk/<files>
instead of ^/DDD/software/branches/error-fixing/<files>
. Found out about the subtle difference here. That's why trunk and error-fixing did not share a common ancestry, the contents were different.
Once I svn-removed error-fixing and did the svn copy without previously creating error-fixing, the svn switch worked fine.
Upvotes: 5
Reputation: 1490
When you created the branch on the server you have just copied the trunk's content to the branch.
In reality, when you switch, a merge is made in the background, it is not just some sort of pointer. As the branch is new, it has no line of history because no commits were made on it.
If I am not mistaken, you need to checkout the branch locally, made the modifications, commit then and then switch to the branch (after the commits have created the history).
For a quick test, checkout, made a small modification, commit then switch. Tough, I do not recommend switching often, especially to branches ! You should merge the branch in the trunk, test the trunk, then create a tag and switch the server on the tag, never on the branch.
Upvotes: 1