Reputation: 10695
I have two versions of my code I want to alternate between. If I run
svn checkout -r 5 file:///path.to.svn.repo
and the current version in the target directory is higher than 5, I can't go back. To my understanding, this is intentional, and I should use merge instead. Merge update the latest version, and I don't want that. Is there an easy way to alternate?
I suppose I could split the code into two projects, but I'm not sure this is the right solution.
Upvotes: 3
Views: 14532
Reputation: 257
From my understanding I believe that you would want to create at least one branch (maybe two if you want a development and a release branch)
So svn cp -r5 file:///path.to.repo/trunk file:///path.to.repo/branches/development
would be a typical way of creating a branch from an old version of you code.
This basically copies how the trunk directory looked at revision 5 and puts that into a new location "branches/development"
Now I'm assuming that you setup your repository in the standard svn way (with trunk, branches and tags), regardless of this setup it is still possible to use this command.
You may also be interested in the svn switch
command which allows you to switch your working copy from one area of the repository to another. Alternatively you could just checkout 2 workings copies (depends on how much disk space you require I guess)
Take a look at svn redbook for more information on commands etc. in svn: http://svnbook.red-bean.com/
Upvotes: 1
Reputation: 37222
Why not check out the old code into a different folder?
e.g.
c:\MySource\
c:\MyOlderSource\
However, if you want only one folder then merge is the correct way to do it. I don't know what you mean that merge will "update the latest version". It will update your working copy (the BASE version) but not the repository copy (the HEAD version), but that is exactly the behaviour you want.
Upvotes: 3