Subversion: using only some files from the provider branch

In " Versioning with Subversion , " the Provider Branches section sets up the provider branch for "libcomplex" and then uses the following command to copy libcomplex to the main development branch:

$ svn copy http://svn.example.com/repos/vendor/libcomplex/1.0 \ http://svn.example.com/repos/calc/libcomplex \ -m "bringing libcomplex-1.0 into the main branch" 

However, what if we require only a subset of the libcomplex functionality (and therefore a subset of files)?

Is it possible to copy only part of libcomplex to the main branch? Or can it cause problems (especially when it comes to updating libcomplex)?

+4
source share
3 answers

Perhaps the easiest way to get close to this is to just transfer the files you need to your repository. This makes Subversion problem trivial. If you can write a script that extracts a subset of the library that you need from what you get from your provider, then the whole process can be automated. This is still feasible if the extraction has to be done manually, but it is a bit more annoying. In any case, this is likely to turn into a maintenance headache. Third-party libraries are generally not designed to be split, so you run the risk of making manual changes whenever the library makes any structural changes.

A completely different approach is to compile the library (or its subset) into a binary file, and then only transfer this binary file to the source tree. This is what I'm doing on the project I'm working on. We have a separate repository for libraries from suppliers. A custom make file will create svn://vendor_repo/trunk and generate svn://vendor_repo/trunk/libs (which are transferred along with each new drop), and it is this libs subfolder that we pull into our main repository using svn:externals . With this method, our code does not know (or does not care) about whether libs are a subset or the entire library. All they see is a binary for reference. The amount of code that we must manually support is the custom make file that we use to create the vendor library.

+1
source

I will not recommend sharing libraries imported from other sources.

You land in a merge with a dependent + refreshing nightmare if libcomplex is nothing but trivial.

+3
source

You are using sparse directories .

It is much more focused on extracting a directory rather than individual files, but assuming this is normal, use the -depth option to limit the number of things you check.

0
source

Source: https://habr.com/ru/post/1396002/


All Articles