开发者

SVN Shared Checkout Folders

We have a project here which is split into two. One for Internal and One for Exter开发者_C百科nal.

The difference between the two versions is a single xml file and several css files.

There is a bunch of shared code that runs the application. The shared code also contains css files that are present in the same folder as the ones mentioned above.

So I might have say two css files called common.css and site.css. Common.css is a shared css file and site.css differs between the two versions.

I do not want to create an SVN repo for each version as the difference between the two is only a couple of files.

So ideally I'd like to have a folder in SVN that holds the "common" code, then a folder that contains the specific files for each version.

Does anyone know how I can do this in SVN so that I can check out the common folder and then the version folders?


Create a common repository with the shared code, then create two SVN branches from it in which resides specific files.

Of course, never merge theses branches' specific files to the common repository.

On client side, use svn switch to work on concerned parts. You can also switch only the specific folders containing the specific files allowing you to work simultaneously on the common repo and on a specific branch (without the need of merging common code from the branch to the trunk).

mkdir myproject/common/
vim myproject/common/common_file.html
mkdir myproject/common/css
svn import myproject svn://here/myproject

mkdir myproject/external myproject/internal
svn add myproject/external myproject/internal
svn copy myproject/common/css myproject/external/
svn copy myproject/common/css myproject/internal/
svn ci -m "Created external & internal css sub-branches"

mv external.css specific.css files.css myproject/external/css/
mv internal.css specific.css files.css myproject/internal/css/
svn add myproject/external/css
svn add myproject/internal/css
svn ci myproject/external/css myproject/internal/css -m "Added external & internal specific files"

Somewhere else, in order to work on the internal project for instance:

svn checkout svn://here/myproject/common/ .
svn switch ./css svn://here/myproject/internal/css
vim ./common_file.html
svn ci -m"I'm an internal user and I worked on a common file"
vim ./css/files.css
svn ci -m"I worked on the specific file files.css of the internal branch"


The svn:externals property would be helpful here, if I understand what you're trying to do.

I use this regularly to manage several applications that share a common subset of code.

Put the common code in its own directory, then put each version (internal amnd external) of the xml and css files in seperate directories.

To each xml and css directory, add an svn:externals property that points to the common directory. Then, when you check out either directory, you get a copy of the common code directory in the tree. Changed code can be commited back to the repository as well.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜