Subversion svn:externals file override?

允我心安 提交于 2019-11-28 10:33:39

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

current repository

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

suggested repository

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

How to create the layout

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)

modify ^/myproject/library and commit


How to update the library without losing your modifications

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

profit


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.

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

There isn't a built in feature to help you with this.

The general practice way of dealing with this would be: Make a branch of the library you're using then make the changes you need there and use the newly created branch as the external for the root project. In my experience I've found this to be a simple and effective solution to the problem you describe.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!