我有一个项目的存储库,它有一个嵌套的存储库,使用 svn:externals
属性从外部库更新文件。问题是我需要从该库的一个 header 中注释掉其中一个函数声明,并将修改后的 header 与根存储库一起携带。
有没有一种方法可以做到这一点,以便在更新库时用我的版本覆盖该特定文件?
最佳答案
你想要的对我来说听起来像是“供应商分支”场景。
当前存储库
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 并将原始未修改的库代码下载到其中。
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并提交
如何在不丢失修改的情况下更新库
将库的最新原始版本下载到 ^/vendor/library/current OVERWRITING 文件中。
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”分支到您的项目中。如果您有多个项目需要同一个库的修改版本,建议这样做。
请记住,供应商分支机构在处理重命名和删除时会遇到问题,因为这些无法通过覆盖进行跟踪。跨存储库合并对于 SVN 来说是一个不同且相当年轻的话题。
如果您尝试过,请向我们反馈结果:)
克里斯托夫
关于file - 颠覆 svn :externals file override?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3754459/