Current or required in the vendor branch?
What do I have
I have a C ++ code base and svn is used for VCS.
There are several third party products used in my code. We use different versions of each product and use them on different OS (Linux and Windows).
Third party products (with the required version) are present on the compilation machines and are used at compile time, so the relationship between the code and the third party version being used is loosely coupled.
What I want
I want to make a difference. The idea is to use svn vendor branch . Contrary to what is described in the svn vendor branch , we will be storing the binary version of the third party product, not the code itself. This is because we never fix third-party code.
svn: external will be used to use the corresponding version of the third party product. Here's the skeleton of the svn repository:
svn_repo/vendor/product1/OS1/ver1 <- mymodule using it
vendor/product1/OS2/ver1 <- mymodule using it
vendor/product1/OS1/ver2
vendor/product1/OS1/ver2
vendor/product2/OS1/ver1
vendor/product2/OS2/ver1
vendor/product2/OS1/ver2 <- mymodule using it
vendor/product2/OS1/ver2 <- mymodule using it
mymodule/ <- this is my actual code referring to a particular
products from vendor/ using svn:external
mymodule/vendor/product1/OS1 <- reference to vendor/product1/OS1/ver1
mymodule/vendor/product1/OS2 <- reference to vendor/product1/OS2/ver1
mymodule/vendor/product2/OS1 <- reference to vendor/product1/OS1/ver2
mymodule/vendor/product3/OS2 <- reference to vendor/product1/OS2/ver2
Question
In the svn red book, in the vendor branch section, it is suggested to keep the current / containing the latest version of a third-party product, so from the example we end up with:
repos/vendor/libcomplex/current - contains 1.1 repos/vendor/libcomplex/1.0 repos/vendor/libcomplex/1.1
Since we are not fixing third-party code, I see no point in maintaining the current /. This needs to be supported too, so you can see that svn comes with a perl helper script svn_load_dirs.pl to help.
My guess is current / required for:
- To make different versions of svn releted, then svn are comparable.
- As a side, the version is stored in a more efficient way in the svn repository.
I don't see that we really need them.
So the question is, can we safely bypass the handling of the current / in the vendor branch?
source to share
We take a similar approach to what you suggest, for example, bring the vendor binaries into our repository and then use relative paths to those binaries using svn: externals. It works fine and I love that we don't have external repository dependencies.
You might even consider keeping only one copy of each binary for each operating system, i.e. forget about setting the version in the directory name, just use the Subversion revision as the controller. This is done using an explicit revision number in your svn: externals property, which you probably should be doing anyway.
So svn: externals on mymodule / vendor / product1 / OS1 will be installed as -rXXX ^ / vendor / product1 / OS1, where XXX is the version containing the appropriate version of mymodule.
For example, our tools directory has nunit binaries. If nunit releases a new version, we update \ nunit tools and log the release details. All our projects referencing nunit can (optionally) start using the new version by simply changing the version number of the svn: externals property for the project in question. If any project doesn't want an update, they don't do anything :)
source to share
I would say that everything is fine. This is a common situation with third party libraries, where you often don't have or want to keep the source code. In this case, it is perfectly acceptable to store the version of the binary that you want and not from the point of view of your product, i.e. the source.
source to share
The use of the "current" directory and svn_load_dirs is designed in such a way that you can save your local changes just as you say. It keeps a continuous history for files from one version to another. This allows the merge process to determine what has changed in the database and allows you to save your changes, just like redistributing a branch from the mainline. Otherwise, the file is considered new every time, and this "rebasing" tries to completely replace the file rather than merge new bits.
Since you are dealing with binaries and not fixing them at all, you can ignore it.
source to share
I found this article helpful when planning my own vendor branch. However, I decided to create a / current / folder for multiple versions anyway to see how significant the savings were. I figured I could remove it later if it's not worth the overhead.
I decided to post only major releases to / current / and then create a branch for each major release and apply the patches to the branch. Finally, a tag for each resulting level of code. This works well with the vendor pattern for releases, where fixes (the third segment of the version remain unchanged) only change the files, but the releases (the third segment changes) are placed in each file.
15.1.0.1901
-> update trunk
-> copy trunk to new branches/15.1.0
-> copy branches/15.1.0 to tags/15.1.0.1901
15.1.0.2233
-> update branches/15.1.0
-> copy branches/15.1.0 to tags/15.1.0.2233
15.1.1.3064
-> update trunk
-> copy trunk to new branches/15.1.1
-> copy branches/15.1.1 to tags/15.1.1.3064
15.1.0.3299 (bug fix for 15.1.0)
-> update branches/15.1.0
-> copy branches/15.1.0 to tags/15.1.0.3299
Vendor code is around 180MB, mostly .NET 3.5 DLL with some PDB and XML files. I found the space savings to be significant, even when committing against the torso, where I went from 15.1.0 to 15.1.1 where each DLL had changes.
Version -> size of repos/db/revs file
15.1.0.2782 -> 19,076 KB
15.1.0.2845 -> 78 KB
15.1.0.2892 -> 130 KB
15.1.0.2907 -> 981 KB
15.1.0.2948 -> 1,021 KB
15.1.1.2998 -> 3,334 KB (new branch)
15.1.1.3064 -> 477 KB
Assuming each self-registered update was 19MB, I would now get about 133MB instead of 26MB, saving 80%. Now I'm not hungry for disk space either, and Subversion definitely does a great job of preserving it despite this, but I find it a pretty nice economy and well worth it for structure and additional copy operations.
Your mileage may vary, naturally. In my case, it is very useful to use all historical versions: my team supports many clients, each of which may use a different version of the vendor software. The forensic value of knowing the files that the vendor changed also helps predict whether the patch will affect our improvements.
source to share