1

We have several projects which we store in a single repository (let's call it repository A).

Some of the projects in repository A, use files which are source controlled in another repository (let's call it repository B).

The relationship is never the other way around (Rep B does not use files from Rep A)

Right now, the way we handle these files is that we keep them in both repositories, and occasionally, we have someone merge the changes from the files in B, to A.

For example: In repository A: /tools/trunk/tool_A/main.cpp /tools/trunk/tool_A/secondary_screen.cpp ... /tools/trunk/tool_A/extra/Libraries/bob/bobs_magic_handler.h /tools/trunk/tool_A/extra/Libraries/frank/frank_tools.h

In repository B: /libraries/trunk/bob/bobs_magic_handler.h /libraries/trunk/bob/bobs_magic_handler_another_one.h ... /libraries/trunk/frank/frank_tools.h

The number of files in B is quite large (tens of thousands), and the number of files A uses from B is small (tens)

Ideally, I think there would be someway to store information in repo A, that

repoA::/tools/trunk/tool_A/extra/Libraries/bob/bobs_magic_handler.h

should always be pulled from

repoB::/libraries/trunk/bob/bobs_magic_handler_another_one.h

That way a developer that wants to work on repoA, just gets the entire project from A, and get notification if you can't access repoB. Even better would be if you can't update those files when getting them from repoA.

Seems like this would be an age old problem. i.e. how to work on projects pulling files from multiple repos.

Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
bpeikes
  • 3,495
  • 9
  • 42
  • 80
  • Just guessing here, but maybe you should take a look at "vendor branches": http://svnbook.red-bean.com/en/1.7/svn.advanced.vendorbr.html – Doe Johnson Aug 15 '19 at 09:21

1 Answers1

0

I can't find my earlier answer on the same case, try to repeat it here

  1. Read (carefully) about SVN Externals, remember and understand two types of externals (directory-based and file-based) and their peculiar properties: dir-externals can be linked cross-repository, file-exterals can have source and target location only in the same repository
  2. According to p.1, in order to get needed result, you must to use 2-chains linking
    • link directories with all needed in external repo files in repoA in some custom permanent independent from usual repo-tree location (i.e, if you have default trunk+branches+tags in root you can add something like "/Shared" in root and place all folders from repoB as subfolders in it)
    • replace all real shared files in working tree of repoA with externals to these files inside "/Shared/SharedDir/file"
    • Modify|add rules in authz-file in order to prevent commiting changed in repoA shared files to repository (in common case it's enabled and edited in Working Copy file have to be committed as part of commit into it's original location /into RepoB as final result/)

Explanation for your sample file

repoA::/tools/trunk/tool_A/extra/Libraries/bob/bobs_magic_handler.h

and it's origin

repoB::/libraries/trunk/bob/bobs_magic_handler_another_one.h

Because bobs_magic_handler.h if file from another repository, you must to link to it's parent dir in RepoB from repoA. I.e. get, f.e. "repoA::/Shared/bobtrunk/", which will have all from "repoB::/libraries/trunk/bob/" and "repoA::/Shared/bobtrunk/bobs_magic_handler_another_one.h" as part of this all

At the second step you have to replace file "repoA::/tools/trunk/tool_A/extra/Libraries/bob/bobs_magic_handler.h" by link to "repoA::/Shared/bobtrunk/bobs_magic_handler_another_one.h" keeping the original name of file "bobs_magic_handler.h" (not "bobs_magic_handler_another_one.h") in target repository (maybe in two commits separately - delete real file, add externals - I can't recall details of process now)

Lazy Badger
  • 94,711
  • 9
  • 78
  • 110