Is SVN's relocate a safe option to synchronize code with two subversion repositories?
Variants of this question have been asked many times, but none of the answers clarified what I am interested in:
I would like (obviously... :) to synchronize my local working copy with two repositories on two different servers. If I use svn switch
with the --relocate
option, 开发者_运维问答is it possible (and reasonably safe) to keep in synch with both repositories (manually merging changes if necessary) and what are the caveats?
Background: One server hosts my private svn, the other is the "official" svn to which several people have access and submit changes.
The main motivation for keeping an additional copy of the code in my private svn is that
- I can do "dirty" (untested) commits, and
- I have other code relying on code from the common svn in my private svn, so that if the official svn will be gone someday, all code history from my svn would be rendered useless.
Short answer: no.
svn switch
is for switching to a new url of the same repository. Subversion cannot switch between two repositories with different content.
Specifically, svn checks the repository UUID to prevent you from accidentally switching to a different repository. If you were to bypass that check (by creating two repos with the same UUID, say), and then switch to the "official" repo after doing a "dirty" commit, svn would still not know how to do the right thing. Probably it would just think its working copy had become corrupted and refuse to do any more commit
or update
operations.
The functionality you're asking for is exactly what distributed version control systems are designed for. Some of those can cooperate with svn so that you could, for example, use git for your private repository and synchronize that with the official svn repository.
精彩评论