Remove unnecessary svn:mergeinfo properties

后端 未结 8 1704
甜味超标
甜味超标 2020-11-29 15:56

When I merge stuff in my repository Subversion wants to add/change a lot of svn:mergeinfo properties to files that are totally unrelated to the things that I wa

相关标签:
8条回答
  • 2020-11-29 16:01

    If you're sure you want to mass-remove mergeinfo properties, you can use the following BASH script.

    FILES=`svn status |grep "^ M      " |sed s/" M      "// |tr '\n', ' '`
    svn revert $FILES
    

    It gets a list of changed files, filters it to just mergeinfo only changes, strips everything but the actual file path, converts the one-per-line paths into a space delimited list, and the calls revert on that list.

    0 讨论(0)
  • 2020-11-29 16:01

    To do changes in a directory structure, this would be (non-DOS 'find' only):

    find . -path "*/.svn" -prune -or -exec svn propdel svn:mergeinfo '{}' \;
    

    Running an 1.6.12 client connected to an 1.5 server, I have a similar problem; there is a subdirectory in the project which needs its own svn:mergeinfo, but having 121 such entries (including 5 directories below ./var with "svn:ignore *") seems somewhat inappropriate. Thus, it would be nice to have a (e.g. Python) script which is able to remove the obviously superfluous merge info and tell about other differences ...

    0 讨论(0)
  • 2020-11-29 16:04

    As mentioned in this thread:

    • Most empty mergeinfo ("blank") can be caused by working copy to working copy copies/moves where the source item has no explicit mergeinfo. Using propdel can be the solution unless you are using a 1.6 SVN: since 1.5.5 these WC-to-WC copies no longer create empty mergeinfo on the destination
    • an earlier svn move (rename) restructuring operation can also propagate mergeinfo, instead of leaving them at the root directory
    • there is a potential memory issue, tracked by case 3393 which will be fixed in an upcoming 1.6.2 version and back-ported in 1.5
    0 讨论(0)
  • 2020-11-29 16:10

    Here is a way to delete all subtree svn:mergeinfo properties. Run it inside the root of your repository:

    svn propget svn:mergeinfo --depth=infinity 
        | grep -v "^/"
        | grep -v "^\."   
        | cut -d- -f1 
        | xargs svn propdel svn:mergeinfo
    

    All in one line for easy copy/pasting:

    svn propget svn:mergeinfo --depth=infinity | grep -v "^/" | grep -v "^\." | cut -d- -f1 | xargs svn propdel svn:mergeinfo
    

    To preview which files this will effect before you run it, change the last "propdel" to "propget" or remove the last xargs pipe altogether.

    0 讨论(0)
  • 2020-11-29 16:17

    As I am not confident with blind svn:merge-info property deletion, I have implemented a tool to analyze the current situation on a working copy and remove as much merge revisions as possible from non-root merge-info properties. After additional human checks and controls, the changes on the working copy can be committed.

    Here it is: svn-clean-mergeinfo

    Do not hesitate to report any issue about its usage to get it improved.

    Subversion 1.10 introduces a new tool dedicated to that task: svn-mergeinfo-normalizer

    0 讨论(0)
  • 2020-11-29 16:17

    I know it's been a while, but I ran into a similar problem. I'm using TortoiseSVN 1.6.7. It just so happened that the property was on the root of my working copy. When I viewed the properties on the root and clicked Remove on svn:mergeinfo, it asked me if I want to remove it recursively. This got rid of all of my svn:mergeinfo cockups.

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