一个目录中有多个存储库 [英] Multiple repositories in one directory

查看:110
本文介绍了一个目录中有多个存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题似乎是半经常出现的,但遗憾的是,我还没有找到可以完全适用于我的情况的答案,所以我想我会问自己的问题。这是我的第一个问题,所以很好。 :



问题:我们公司开发多个PHP应用程序,但其中一个应用程序是主各种各样的。我们所有的其他应用程序都安装在这个主应用程序中,并要求主应用程序正常工作。



当然,我们使用版本控制来管理这些应用程序。

虽然我们的插件应用程序中的许多文件都在子目录中,但并非全部都是。这意味着我们不能使用子目录导入(svn externals,git submodules等)。例如,在根文件夹中有几个文件夹(admin,public,kernel等),并且addon应用程序在这些文件夹中的一个或多个文件夹中具有文件 - 它们不是独立地自包含在主应用程序的目录结构中。

我们目前使用SVN,并且最近发现我们自己考虑git,因为我们认为可能对我们有用的一些功能。然而,我不清楚使用git的一件事情是,如果在开发人员正在编写代码时真正有一种方法可以将这些存储库合并(而不是版本控制意义上的)到本地的单个目录中。我还没有找到一种方法来与SVN做到这一点。



在一个理想的世界中,我们将为我们的主应用程序提供一个存储库,其结构如下所示:


  • /

  • - file1

  • - file2

  • - / admin

  • ---- file1

  • ---- file2
  • li>
  • - / public

  • ---- file1



< (请记住,我们有多个插件应用程序):


  • /

  • - filex

  • - / admin

  • ---- / myapp

  • ------ file1

  • ------ file2

  • - / public

  • ---- filex



  • 我们尝试了以下方法,每个方法都有自己的注意事项:


    1. 单个存储库中的所有应用程序。这不太理想,因为它成为一个噩梦,有效地管理每个应用程序的版本(特别是在SVN中)。分支和标记可以从不相关的独立应用程序获取文件。

    2. 所有应用程序位于单独的存储库中。这也不是理想的(从管理/组织的角度来看),因为您不能将两个单独的存储库导出到单个文件夹,因此您总是使用一个存储库的签出和其他导出的工作。如果您正在使用应用程序X并且主应用程序发生更改,则需要手动执行该主应用程序的新导出,并将这些文件复制到您正在使用的应用程序X存储库中,以获得最新的框架代码。 / li>

    git或SVN(或任何其他版本控制系统)有什么方法可以允许单个存储库中的多个存储库目录没有使用子目录? SVN外部接近完美,但要求外部存储库中的所有文件都位于单独的子文件夹中,如上所述,这对我们不起作用。我收集git具有相同的功能,但再次不能在一个文件夹中允许多个存储库,并留下相同的问题。



    相关问题: strong>
    一个目录中的多个存储库(同样的水平) - 是否有可能? - 这与我所想的非常接近,但我没有看到任何我认为可以应用于我们情况的解决方案。

    解决方案

    Subversion 1.6和1.7允许单个文件的外部内容。 http://svnbook.red-bean.com/en/1.7/svn.advanced.externals .html


    Subversion 1.6还引入了对
    文件外部定义的支持,文件外部配置类似于外部为
    导演并在工作副本中显示为版本文件。



    例如,假设您有
    中的/trunk/bikeshed/blue.html文件存储库,并且你想要这个文件,因为它出现在版本
    40,出现在你的工作副本/ trunk / www / as green.html中。



    This is a question that seems to come up semi-frequently, but sadly I've not found an answer that I can fully apply to my situation yet, so I figured I'd ask my own question. This is my first question on SO, so be nice. :P

    The "problem": Our company develops multiple PHP applications, however one of those applications is a "master" of sorts. All of our other applications is installed inside this "master application", and requires the master application to work.

    We use version-control to manage these applications, of course.

    While many of the files in our addon applications are in subdirectories, not all of them are. This means that we cannot use subdirectory importing (svn externals, git submodules, etc.). For instance, within the root folder there are several folders (admin, public, kernel and so on) and the addon applications have files within one or more of these folders - they are not independently self-contained within the directory structure of the master application.

    We currently use SVN and recently found ourselves considering git due to some of the features available we feel could be useful to us. One thing I'm not clear on with git, however, is if there is truly a way to "merge" (not in the version control sense) these repositories into a single directory locally when developers are working on the code. I have not found a way to do this with SVN either.

    In an ideal world, we would have one repository for our "master" application with a structure like so:

    • /
    • --file1
    • --file2
    • --/admin
    • ----file1
    • ----file2
    • --/public
    • ----file1

    Our addon application would have a structure like so (remember, we have multiple addon applications):

    • /
    • --filex
    • --/admin
    • ----/myapp
    • ------file1
    • ------file2
    • --/public
    • ----filex

    We have experimented with the following approaches, each with its own caveats:

    1. All applications in a single repository. This is less than ideal as it becomes a nightmare managing versions for each application effectively (especially in SVN). Branching and tagging take along files from unrelated and separate applications.
    2. All applications in a separate repository. This is also not ideal (well, it is from a management/organization perspective) because you cannot export two separate repositories to a single folder, so you always work with a checkout of one repository and an export of others. If you are working on application X and there are changes in our master application, you need to manually do a new export of that master application and copy the files over to the application X repository you are working on to have the latest framework code.

    Is there any way with git or SVN (or any other version control system for that matter) to allow more than one repository within a single directory without using subdirectories? SVN externals is nearly perfect, but has the requirement that all files in the external repository be in a separate subfolder, which as described above does not work for us. I gather git has equivalent capabilities, but again cannot allow more than one repository in a single folder, leaving us with the same issue.

    Related questions: Multiple repositories in one directory (same level) - is it possible? - this is very close to what I am asking I think, but I did not see any solution that I felt could be applied to our situation.

    解决方案

    Subversion 1.6 and 1.7 allow externals of a single file.

    See http://svnbook.red-bean.com/en/1.7/svn.advanced.externals.html

    "Subversion 1.6 also introduced support for external definitions for files. File externals are configured just like externals for directories and appear as a versioned file in the working copy.

    For example, let's say you had the file /trunk/bikeshed/blue.html in your repository, and you wanted this file, as it appeared in revision 40, to appear in your working copy of /trunk/www/ as green.html."

    这篇关于一个目录中有多个存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆