Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Help in understanding SVN Externals

I'm looking into svn externals for my company, and it seems like it would be a good feature for us to use. We have several products that often reference shared components, but have a bad habit of falling behind into older versions and even differently branched codebases sometimes.

I've read a decent bit about how they work now, and I think I understand the concept OK. What I'm not 100% sure on is how different revisions of multiple repositories link together.

Let's say I have a Product and a Library. The Product is built against the Library, so its repo has a svn:externals property that links to the Library source. In the absence of a specific version in the svn:externals definition, when I check out HEAD of Product I also get HEAD of Library.

I build several versions of Product over the years, each time referencing the latest version of Library. One day though I have to go back and check out Product version 1, by manually selecting the correct revision. When I do so, which version of Library do I get, HEAD or the revision that I used when I built it the first time?

Hopefully I've been a good developer and remembered to tag every version of Product that I release. When I apply my tag 'Product-1-0-0' to the repository, does the correct revision of the Library repository get tagged too? If I later check out Product based on the tag 'Product-1-0-0', does the correct revision of Library get checked out with it?

like image 535
Coxy Avatar asked Oct 08 '09 03:10

Coxy


People also ask

How do svn externals work?

When you commit a change to the svn:externals property, Subversion will synchronize the checked-out items against the changed externals definition when you next run svn update . The same thing will happen when others update their working copies and receive your changes to the externals definition.

How do I view svn files?

SVN Checkout First then, In a directory create a new folder where you'll check the repository contents out to. It's important that we don't drill down into this folder. We want to check the contents of our repository out into this folder. So we right-click on this folder and select 'SVN Checkout…'

How do I checkout code from svn to local repository?

Check out files from Subversion repositoryIn the Get from Version Control dialog, click Add Repository Location and specify the repository URL. Click Check Out. In the dialog that opens, specify the destination directory where the local copy of the repository files will be created, and click OK.


1 Answers

What you have to watch out for with svn:externals is that you need to explicitly specify the revision if you want something other than trunk. Google "pinning svn:externals" for the details. If you are using a fairly modern version, 1.5 or newer IIRC, then relative externals are at least supported. Older versions, like the one that I am currently using, requires us to explicitly pin the revision using the -rNNNNN option on the svn:externals property for every damned folder.

We ended up using a modification of a perl script named svncopy.pl from tigris.org to do all of our branching and tagging. It's not that bad but I wish that we had known how much work it was before we decided to use them so heavily.

like image 187
D.Shawley Avatar answered Oct 08 '22 13:10

D.Shawley