TortoiseSVN Foreign Repository Copy

572 Views Asked by At

I have been reading up on Vendor Branches with subversion. I'm not very comfortable with the subversion command line and I have been using TortoiseSVN and Subclipse as SVN clients on my Windows 7 box.

In the Vendor Branches documentation for subversion, they discuss doing a "foreign repository copy", but I have not been able to find how to do this with TortoiseSVN. When I have searched the internet for how to do this with TortoiseSVN, I found articles suggesting using svn:externals instead. The documentation for Vendor Branches does not say to use svn:externals and instead says to use a foreign repository copy.

Does anyone know how I can do such a copy with TortoiseSVN? If it is not possible, would svn:externals give me the same result?

EDIT:

Here is my workflow:

  1. I created a new root-level folder in my repository called vendor. This is a sibling of trunk.
  2. I checked out myrepo/vendor to a new working copy.
  3. I attempted to merge two different trees using TortoiseSVN from myvendorrepo/trunk to myrepo/vendor. This returned an error telling me that myvendorrepo/trunk must be in the same repository as myrepo/vendor.

The Vendor Branch documentation specifically talks about a foreign repository copy, but it does not seem to be possible with TortoiseSVN.

1

There are 1 best solutions below

0
On
  1. "foreign repository copy" can't be done with TortoiseSVN (or any other SVN-client, it's task /part of/) repository management). And it's usable only if upstream code can't be reached by SVN-client (not versioned at all, stored in SCM, which SVN-client doesn't understand)
  2. You misunderstood and misused "2-URL merge" (read svn help merge) - this type of merge not used in Vendor Branching, used by different way and for different goals: svn merge URL1 URL2 will merge into WC of URL3 independent parallel changes from URL1+URL2

"Foreign Copy" and Externals Vendor Branching in Sample

Let's imagine:

  • External code placed in VENDOR/PATH/TO/LIBRARY
  • Our copy of upstream code - in MY/VENDORS/VENDOR/LIBRARY (additional intermediate /VENDORS node is workpiece for the future, when more than 1 vendor may appear)
  • Local work happen in MY/trunk

"Foreign Copy"-style

  • ask SVN-admin, who have access to repository filesystem, create dump of full VENDOR repository with svnadmin dump and transmit dump to you, after it filter only /PATH/TO/LIBRARY node with svndumpfilter
    • another way is using svnrdump URL, which have some benefits: you can dump any remote repository, for which you have read-access, you can dump only part of repository (and eliminate svndumpfilter headache) - svnrdump dump VENDOR/PATH/TO/LIBRARY > dumpfile
  • prepared (by any way) dump haveto be loaded into MY repository: svnadmin load /PATH/TO/MY < dumpfile with some additions:
    • because it's dump from another repo, --ignore-uuid option (in case of not-empty MY) not needed, but may be used for safety
    • because we want to change mount-point of directory from /PATH/TO/LIBRARY to /VENDORS/VENDOR/LIBRARY additional option --parent-dir /VENDORS/VENDOR/ is a must (TBT!!! I write parent spec from memory)

After these operations you'll have node in your local repository, which is exact copy of remote node, but not related toremote by any way: you have to monitor remote changes and sync with your copy by hand (svn up VENDOR/PATH/TO/LIBRARY in separate WC, copy changes to your WC, commit changes)

Externals-style

  • Create physical node /VENDORS/VENDOR/ in MY repository (svn mkdir --parents /VENDORS/VENDOR)
  • define LIBRARY subdirectory of /VENDORS/VENDOR/ as externals (with or without PEG-revision in URL, as you prefer - without will be easier to maintain updates /zero operation/, but harder /impossible/ to resore older, historical state of your repository, with PEG you have to maintain actuality of link by hand /edit PEG-revision, when needed/, but history is stored always correctly automatically), mapped to VENDOR/PATH/TO/LIBRARY

For both styles integration of upstream to your code will be just periodical merge /VENDORS/VENDOR/LIBRARY to trunk

PS: for externals-syle first creating initial snapshot in trunk (in case of empty trunk) and first merge to trunk may be troublesome and not obvious. AFAICR, you will not be able to merge /VENDORS/VENDOR/LIBRARY to empty trunk (and svn copy also ): you'll get (can't recall text) error and no merge|copy at all. Can't reference to The Right Way, but I just copy filesin Working Copy from vendor branch to trunk and commit trunk in order to have BASE and in this case in first merge (and only first) of LIBRARY to trunk in order to merge unrelated (for Subversion) nodes add --ignore-ancestry option: later trunk and LIBRARY are already related