Search code examples
svntortoisesvn

svn edit commandline usage to replace old external to new external


I have an SVN external defined as ^/project/subproj1/subproj2/subproj3/trunk@revision lib which needs to be replaced with ^/project/subproj1/subproj2/subproj3/tags/tagname lib

I have tried to use the below command which is not working.

svn propedit svn:externals --editor-cmd "(echo /project/subproj1/subproj2/subproj3/tags/tagname lib) >" 
http://myname.com/project/subproj1/subproj2/subproj3/tags/subproj3tag/system -m "Test tag"

Solution

  • I would first dump the svn:externals property to a text file:

    svn propget svn:externals . > externals.txt
    

    ...then do the modification to the file with sed:

    sed -i 's/trunk@revision/tags\/tagname/' externals.txt
    

    ...and finally set the modified property again:

    svn propset svn:externals . -F externals.txt
    

    If you're feeling adventurous, you could even do it in a single command line:

    svn pg svn:externals . | sed 's/trunk@revision/tags\/tagname/' | svn ps svn:externals . -F -