简体   繁体   English

处理引用多个SVN存储库的项目

[英]Handling projects which refer to multiple SVN repositories

We have several projects which we store in a single repository (let's call it repository A). 我们有几个项目存储在单个存储库中(我们称其为存储库A)。

Some of the projects in repository A, use files which are source controlled in another repository (let's call it repository B). 存储库A中的某些项目使用的文件在另一个存储库中受源代码控制(我们称其为存储库B)。

The relationship is never the other way around (Rep B does not use files from Rep A) 这种关系永远不会相反(Rep B不使用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. 现在,我们处理这些文件的方式是将它们保存在两个存储库中,有时,有人将更改从B中的文件合并到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 例如:在存储库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 在存储库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) B中的文件数量很大(上万个),A从B中使用的文件数量很小(上万个)

Ideally, I think there would be someway to store information in repo A, that 理想情况下,我认为应该以某种方式将信息存储在存储库A中,

repoA::/tools/trunk/tool_A/extra/Libraries/bob/bobs_magic_handler.h 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 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. 这样,想要处理repoA的开发人员就可以从A获得整个项目,并在无法访问repoB时得到通知。 Even better would be if you can't update those files when getting them from repoA. 如果从repoA获取文件时无法更新这些文件,那就更好了。

Seems like this would be an age old problem. 似乎这将是一个古老的问题。 ie how to work on projects pulling files from multiple repos. 即如何处理从多个存储库中提取文件的项目。

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 阅读(仔细阅读)有关SVN外部的信息 ,记住并了解两种外部类型(基于目录的和基于文件的)及其独特的属性:dir-externals可以跨存储库链接,file-exterals仅可以在同一仓库
  2. According to p.1, in order to get needed result, you must to use 2-chains linking 根据第1页,为了获得所需的结果, 必须使用2链链接
    • link directories with all needed in external repo files in repoA in some custom permanent independent from usual repo-tree location (ie, 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) 目录与repoA 中外部repo文件中所有需要的 目录链接在一起,并且独立于通常的repo-tree位置(例如,如果您在根目录中具有默认的trunk + branches + tags,则可以在root中添加“ / Shared”之类的东西,并将所有repoB中的文件夹作为其中的子文件夹)
    • replace all real shared files in working tree of repoA with externals to these files inside "/Shared/SharedDir/file" 用“ / Shared / SharedDir / file”中这些文件的外部替换repoA工作树中的所有实际共享文件
    • 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/) 修改|在authz文件中添加规则,以防止将repoA共享文件中的更改提交到存储库(通常情况下,在工作副本文件中启用并编辑了该更改,必须将其作为提交到其原始位置的一部分进行提交/最终进入RepoB /)

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. 因为bobs_magic_handler.h如果是另一个存储库中的文件,则必须从repoA链接到RepoB中它的父目录。 Ie get, fe "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 例如,获取“ repoA :: // Shared / bobtrunk /”,其中的全部内容都来自“ repoB :: // libraries / trunk / bob /”和“ repoA :: / Shared / bobtrunk / bobs_magic_handler_another_one.h”所有

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) 在第二步中,您必须通过链接到“ repoA :: / Shared / bobtrunk / bobs_magic_handler_another_one.h”的链接来替换文件“ repoA :: / tools / trunk / tool_A / extra / Libraries / bob / bobs_magic_handler.h”目标存储库中的文件“ bobs_magic_handler.h”(而不是“ bobs_magic_handler_another_one.h”)(可能是在两次提交中分别删除-删除真实文件,添加外部文件-我现在不记得过程的详细信息)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM