Question

This question may be because of a lack of understanding as I am relatively new to SVN and version control in general, so please call me out on any fundamental issues in understanding! :)

We recently purchased Delphi XE4 and we are trying to get some use cases figured out for the native SVN integration. So here is the scenario for the question.

Let's say we have a "Projects" directory and within that directory we have two test projects

TestSVNA.dproj TestSVNB.dproj

Also in the directory is a unit that is not part of either project, we will call it CommonU.pas. Both TestSVNA and TestSVNB use CommonU.pas, so it would be illogical to version the file under either of those projects, but it does change often so versioning is necessary. I am trying to learn how to version that file in SVN. Creating a whole new project just for that file seems silly

Was it helpful?

Solution

Create a separate project for the shared file, and add it as an external to each of the projects that use it. There's info in the SVN Book about doing so, in the Advanced Topics - Externals Definitions topic. (The page also has an example of setting up the externals for a project; it uses the command-line version, but it's pretty easy to work out using TortoiseSVN or the IDE integration.)

Subversion provides support for externals definitions. An externals definition is a mapping of a local directory to the URL—and ideally a particular revision—of a versioned directory. In Subversion, you declare externals definitions in groups using the svn:externals property. You can create or modify this property using svn propset or svn propedit (see the section called “Manipulating Properties”). It can be set on any versioned directory, and its value describes both the external repository location and the client-side directory to which that location should be checked out.

The convenience of the svn:externals property is that once it is set on a versioned directory, everyone who checks out a working copy with that directory also gets the benefit of the externals definition. In other words, once one person has made the effort to define the nested working copy structure, no one else has to bother—Subversion will, after checking out the original working copy, automatically also check out the external working copies.

If you haven't done so already, you should follow the tutorial type instructions in both the basics and advanced topics there (or you can download a PDF version so you'll have it locally). The book is pretty well written, and it's updated by the people that are actually working on SVN itself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top