Organizing SVN Branches with TortoiseSVN

1

How do I organize branches in the SVN system? I'm using TortoiseSVN since I use Windows.

Currently I have this kind of file/directory structure. I'm somewhat getting used to managing numbered versions although I don't see the whole picture of how this management system works.

program_main\trunk\corefile.php
program_main\tags\1.0\corefile.php
program_main\tags\1.1\corefile.php
program_main\tags\1.2\corefile.php

Now I'd like to make another program based on it. It's going to be a separate program but it uses the main program as its base. If the main program is updated, the extended modified program also updates with the corresponding version number.

program_mod\trunk\corefile.php
program_mod\trunk\additionlalfile.php
program_mod\tags\1.0\corefile.php
program_mod\tags\1.0\additionalfile.php
program_mod\tags\1.1\corefile.php
program_mod\tags\1.1\additionalfile.php
program_mod\tags\1.2\corefile.php
program_mod\tags\1.2\additionalfile.php

When I right click on the trunk folder of the main program and choose TortoiseSVN -> Branch/Tag and specify the path to /program_main/branches/program_mod/1.0, it tries to upload the files to the branch folder under the main project directory on the public server. The main project directory is public and visible to everyone, I'd like not to upload the modified(branch) version on that server.

In this case, how am I supposed to do? I guess this must be a very simple operation by using the merge command or something.

Thanks for your advice and information.

Teno

Posted 2012-10-10T03:55:19.177

Reputation: 629

Answers

2

Some notes

  • Repository tree organisation, functions of different nodes inside Subversion repository is just a matter of conventions, "best practices" and habits and strictly related to working style, not used client-side tools for accessing repository. I.e "using TortoiseSVN" is irrelevant information in the light of your task (same /found and satisfied/ technique will be|may be used with any svn-client on any OS)

  • Your business-task have to be defined (better and more correct, from my POV) not as "how to use branches", but as "how store and link related projects in case of Subversion SCM-backend", where using branches (or any other hierarchy inside repo) is only one and not best (IMNSHO) choice

Solutions

Subversion externals

Any part of SVN-repository, which have to be cloned into any another place (and relation between clone and original saved in future) may be utilized over svn:external trick. This way we'll add to repository "virtual tree", which exist somewhere-somehow, but can appear in checkout'ed WC as part of our repository

Repo-browser with externals

(in this picture trunk dir is external from independent repo)

Your current flat structure of program_mod

dir /B

corefile.php

additionalfile.php

imposes a restriction on the version of Subversion (on both - client and server - side), because file-externals was added only in Subversion 1.6, for directory-externals

dir /B /S

z:\mod\additionalfile.php

z:\mod\Core

z:\mod\Core\corefile.php

earlier versions can be used also. The latter option also has a one more slight advantage in terms of controllability in the case of expanding of core-project into multi-file project: in case of file-based externals you'll have to add every new file by hand, directory externals will include all files inside external object

Branches and merges

From the other side you can use branch-merge method for maintaining program_mod

Branch source of core (/trunk) into some, any separate node inside repository (branches/program_mod, f.e). Add additionalfile.php into this branch. After each trunk-commit /better/ or before program_mod release /worse/ merge trunk into program_mod branch (or svn copy corefile in post-commit hook - TBT!)

Lazy Badger

Posted 2012-10-10T03:55:19.177

Reputation: 3 557

Thanks for the detailed answer. svn:externals seems to be the way to go. You helped me to find relevant topics. http://stackoverflow.com/questions/663155/how-to-get-started-with-svnexternals

So this seems to be a kind of issue that even a skilled developer has to be faced with and it's something that one cannot easily get the head around.

– Teno – 2012-10-11T02:12:45.467

I'm reading this page. So is an externals a definition file somewhere placed in the project directory?

– Teno – 2012-10-11T03:44:52.093

@Teno - No, svn:externals is additional property (i.e attribute) of directory, inside which externals must be placed – Lazy Badger – 2012-10-11T04:52:17.797

Thank you. It became clearer for me what the document is talking about. – Teno – 2012-10-11T05:22:36.073