开发者

svn checkout different version in a single checkout?

Basically this is what I want to do: I want to checkout a specific version of code, but if that version is not available, checkout the latest. Somehow I am unable too figure how to do this. Few approaches I tried:

  1. svn co <url> -r HEAD:75

    Does not work; it seems cannot use revision range for checkout

  2. svn co <url>

    svn co <url> -r 75

    This wipes out the original files which do not have a version of 75

Basically I want it to checkout a specific version and either get the latest for files for which that version does not exist or at least dont del开发者_开发知识库ete the existing ones.

Any other approach?

Appreciate all the help!!!


One of the strengths of SVN is that it is considered atomic so either it all happens or none of it happens. There are no intermediary steps where things "sort of" worked.

More importantly, since SVN's version numbers are based on the entire repository as opposed to at a file-level, if you need the latest of every file, you can just grab head. By definition, it will be the latest of everything.

If you have concerns that some files/features are half-complete and could break your deployment, branching will make your life easier. Just create a new branch and do the experimental development there until you're ready to merge back. It's not as easy as Git but really not too bad 99% of the time.


If it would be acceptable to just get a copy of the files, but not be in a SVN working directory, then you can use the svn export command to extract out the two different versions over the top of each other into the same directory:

svn export -r HEAD
svn export -r 75

The r75 copies should overwrite whatever is from the HEAD revision for files that already existed. DISCLAIMER: I did not test this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜