SVN 通用代码与外部 [英] SVN common code with externals

查看:20
本文介绍了SVN 通用代码与外部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在尝试使用相同的代码为多个产品设置存储库.最好的解决方案是制作共享代码的真正库并以这种方式使用它们.然而,目前这需要很多时间.这个想法是拥有一个带有以下树的单个存储库

At the moment I'm trying to set up a repository for multiple products using the same code. The best solution would be to make real libs of the shared code and use them that way. However this takes way to much time at the moment. The idea is to have a single repository with the following tree

-trunk-Project1
      -Project2
      -Shared

项目 1 和 2 都有一个外部来包含共享代码.外部指向一个特定的修订版本,以便在处理 project1 和共享代码时不会破坏 project2 构建.由此产生了一个问题.

Project 1 and 2 both have a external to include the shared code. The external points to a specific revision to not break project2 build while working on project1 and the shared code. From this a problem arises.

当对共享代码进行更改并且我执行提交(使用乌龟 SVN)时,项目 1 和共享代码的更改都会被选取,并且作为单个修订版很好地提交给 SVN.但是,当我或同事进行更新时,项目将无法构建,因为 svn external 指向旧"修订版.

When a change is made to the shared code and I do a commit (with tortoise SVN) the changes are picked up for both the project1 and the shared code and are nicely commited to SVN as a single revision. However when I or a colleague does an update the project will not build because the svn external is pointing to the "old" revision.

这可以通过更新外部并提交来解决(保持构建中断).我们可以暂时从外部删除特定的修订版,但我们必须在开发结束时再次添加它.有没有办法自动执行此操作?

This can be fixed by updating the external and committing it (leave the build broken in between). We could temporary remove the specific revision from the external, but we have to add it again when development ends. Is there a way to do this automatically?

推荐答案

我认为您有几个选择.首先是按照 Martin 的建议使用带有分支的单个模块.您将为每个活动项目或开发线程创建一个分支.当您合并回主干时,将获取对共享代码的更改.

I think you have a few choices. First is to use a single module with branches as Martin proposes. You would have a branch for each active project, or for a thread of development. Changes to shared code would be picked up when you merge back to trunk.

例如

Module
    |
    + trunk
    |   + Project1
    |   + Project2
    |   + Shared
    |
    + branches
        |
        + Project1Development
        |    + Project1 [active development here]
        |    + Project2 
        |    + Shared [active development here]
        |
        + Project2Development
             + Project1 
             + Project2 [active development here]
             + Shared [active development here] 

其次,您可以分支 Shared,这样您就不需要将外部固定到它上面.这就是您的存储库中的内容

Secondly you could branch Shared so that you do not need to pin an external to it. This is what you'd have in your repository

Project1
    |
    + trunk [svn:external to a branch of Shared]

Project2
    |
    + trunk [svn:external to a branch of Shared]

Shared
    |
    + trunk
    |
    + branches
        |
        + Project1Development
        |
        + Project2Development

每个项目都会使用自己的主干视图.这里的危险是分支变得太长 - 您需要对合并和删除它们进行纪律处分,也许在每次发布之后.只有在需要对 shared 进行项目特定更改时才应创建 Shared 的分支.

Each project would use its own view of trunk. The danger here is that the branches get too long - you would need to be disciplined about merging them and deleting them, perhaps after every release. Shared's branches should only be created when project-specific changes to shared are needed.

第三,您继续像现在一样使用外部组件,并忍受固定修订的痛苦.如果你这样做,我会重新安排你的仓库,就像上面的第二个图一样 - 你在项目中使用外部设备的东西有点味道.

Thirdly you continue to use externals as you are now and take the pain of pinning revisions. I would rearrange your repo to be like the second figure above if you are doing this - what you have with externals within a project smells a little.

这篇关于SVN 通用代码与外部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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