23

I'm using tortoise svn in Windows.

How can I branch in SVN and have it branch my svn:external folders as well?

Brian R. Bondy
  • 339,232
  • 124
  • 596
  • 636
  • 1
    Here is a blog post which talks about this very problem and the potential work-arounds... http://thinkinging.com/2008/10/21/set-the-revision-of-your-svnexternals-or-else/ – Jesse Webb May 23 '12 at 18:54
  • Here is an windows command line utility which freezes externals for branching/tagging: http://svnxf.codeplex.com/ – Jesse Webb May 23 '12 at 19:02

4 Answers4

25

You should use svn:externals as external references from different repositories. So svn:externals should refer to components, modules, 3rd party tools, etc.

You should not use svn:externals to emulate a "symbolic link"-behaviour by using externals to point into the same repository. You can solve such issues most of the time by modifying your build-structure, or use checkout-scripts and sparse checkout feature.

svn:externals have a lot of problems most of them are difficult to see, track and repair: see an example here

  • commits cannot span over externals(no atomic commits)
  • branches will not branch their externals(as you pointed out)
  • tags will not "freeze" their externals so latter builds may result in different/broken builds
  • merging and reeintegrate merge will not work on externals

If you use externals to point to other repositories, you will most of the time do not have these problems.

Community
  • 1
  • 1
Peter Parker
  • 29,093
  • 5
  • 52
  • 80
  • 1
    The issue is that there are scenarios when you actually need externals to the same repo, especially when the system needs components dynamically and a build tool would be an overkill. I've ran more than a couple times in these kind of scenarios for bigger sized projects. – haknick Jun 11 '12 at 11:16
  • 1
    One solution probably worth looking into is a GIT-SVN setup. And then maybe using git for the cloning part and still keep SVN Externals. – haknick Jun 11 '12 at 15:28
12

You'll have to manually create a branch in your external repository and then change your svn:external property to point to the correct branch.

nickf
  • 537,072
  • 198
  • 649
  • 721
  • this is not feasible for me because I have a lot of svn:externals in my project – Brian R. Bondy Oct 29 '08 at 00:30
  • 4
    Feasible or not, this is the only solution. It has been requested that is be made an automatic feature of SVN itself but the issue is still open, and quite old... http://subversion.tigris.org/issues/show_bug.cgi?id=1258 – Jesse Webb May 23 '12 at 18:52
4

When you create a branch within Subversion you are simply creating a cheap copy of the trunk, branch, or tag that you are branching from. This cheap copy will contain all of the same files and properties as the trunk, branch, or tag that you branched from until you begin to modify the properties or files of the new branch.

However, you may be able to modify one of the 'commit' hooks to modify settings automatically once you commit your branch. http://svnbook.red-bean.com/en/1.1/ch05s02.html

Otherwise if you want your externals to be modified on the branch you will need to do so manually.

Noah Goodrich
  • 24,875
  • 14
  • 66
  • 96
  • 4
    Modifying an svn-commit transaction via hook scripts is not advisable and not supported by the svn community. It will result in serious workingcopy desynchronisations! – Peter Parker Oct 29 '08 at 20:40
3

there are relative externals now. though you should know :) im using them right now - in the middle of solving a few troubles i got, but im progressing. i just tagged a project after creating relative externals inside it. for now its wierd - when i check out the branch, it notifies me the externals are from revision "top revision of the trunk", but the externals themselves are the original ones - which is what I want :)

Anonymious
  • 31
  • 1
  • 1
    FYI, I am having trouble with my relative externals. http://subversion.tigris.org/issues/show_bug.cgi?id=4150 http://stackoverflow.com/questions/439666/svnswitch-doesnt-work-with-relative-svnexternal/12062304#12062304 – AnneTheAgile Aug 21 '12 at 21:10