颠覆 svn:外部文件覆盖? [英] Subversion svn:externals file override?
问题描述
我的其中一个项目有一个存储库,该项目有一个嵌套存储库,使用 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
利润
不是将current"直接分支到您的项目中,您可以分支到my-modified-libs"目录并通过外部使用它.如果您有多个项目需要库的相同修改版本,则建议这样做.
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 :)
克里斯托夫
这篇关于颠覆 svn:外部文件覆盖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!