Subversion svn:externals文件覆盖? [英] Subversion svn:externals file override?

查看:90
本文介绍了Subversion svn:externals文件覆盖?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的一个项目提供了一个存储库,该项目具有一个嵌套的存储库,该存储库使用svn:externals属性来更新外部库中的文件.问题是我需要从该库中的头文件之一中注释掉一个函数声明,并随根存储库一起携带修改后的头文件.

I have a repository for one of my projects that has a nested repository using the svn:externals property to update files from an external library. The problem is that I need to comment out one of the function declarations from one of the headers in this library, and carry around the modified header with the root repository.

有没有办法做到这一点,以便在更新库时,它会用我的版本覆盖该特定文件?

Is there a way that this could be done, so that when the library is updated, it overrides that specific file with my version of it?

推荐答案

对我来说,您想要的听起来像是供应商分支"方案.

What you want sounds like a "vendor branch" scenario to me.

当前存储库

root
|-- myproject
    |
    -- mycode
    |
    -- library -> svn:externals to a remote svn or your own libraryproject


建议的存储库

root
|-- myproject
    |
    -- mycode
    |
    -- library -> copied/branched from ^/vendor/library/current (modified at this location as much as you like)

|
-- vendor
   |
   --library
     |
     --current
     |
     --imported-version-1.0
     |
     --imported-version-1.1


如何创建布局

创建^/vendor/library/current并将原始未修改的库代码下载到其中.

Create ^/vendor/library/current and DOWNLOAD the original unmodified library code into it.

svn commit ^/vendor/library/current
svn cp ^/vendor/library/current ^/vendor/library/imported-version-1.0 (tag the import)
svn cp ^/vendor/library/current ^/myproject/library (branch the code into your project)

修改^/myproject/library并提交

modify ^/myproject/library and commit

如何在不丢失修改的情况下更新库

将库的最新原始版本下载到^/vendor/library/current OVERWRITING文件中.

Download the latest original release of the library into ^/vendor/library/current OVERWRITING files.

svn commit ^/vendor/library/current (checks in the difference between the two library releases)
svn cp ^/vendor/library/current ^/vendor/library/imported-version-1.1 (tag the change)
cd /your-local-workspace/myproject/library (will be merge target)
svn merge ^/vendor/library/current (get all CHANGES from the upstream branch and apply them to your modified library)
svn commit

利润

您可以将其分支到"my-modified-libs"目录,并通过外部使用该目录,而不是直接将"current"分支到您的项目中.如果您有多个项目需要相同的库修改版本,则建议这样做.

Instead of branching "current" directly into your project you could branch to a "my-modified-libs" directory and make use of it via externals. This would be advised if you have multiple projects that need the same modified version of a library.

请记住,供应商分支机构在处理重命名和删除操作时会遇到问题,因为重命名和删除操作无法通过覆盖来跟踪.跨存储库合并是SVN的一个不同而相当年轻的话题.

Keep in mind that vendor branches will have problems dealing with renames and deletes as those can not be tracked by overwriting. Cross-repository merging is a different and rather young topic for SVN.

如果您尝试一下,请向我们提供反馈:)

If you try it out, give us feedback how it went :)

Christoph

Christoph

这篇关于Subversion svn:externals文件覆盖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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