Subversion svn:externals file override?

前端 未结 2 763
孤街浪徒
孤街浪徒 2020-12-10 09:21

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 i

相关标签:
2条回答
  • 2020-12-10 09:23

    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

    0 讨论(0)
  • 2020-12-10 09:38

    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.

    0 讨论(0)
提交回复
热议问题