简体   繁体   中英

Recursive svn propset

I'm trying to recursively add properties to all files with a wildcard.

D:>dir *.bob /s/b
D:\Source\key-test\test.bob
D:\Source\key-test\test2.bob
D:\Source\key-test\sub\test3.bob

Actually -R is recursive. For example:

svn propset svn:eol-style 'LF' -R *

This will work on all subfolders as well. However:

svn propset svn:eol-style 'LF' -R *.php

...will only work on php files within the current folder, regardless of the -R. Adding:

svn propset svn:eol-style 'LF' -R */*.php

Will work on subfolders one level down. Adding extra /-s will go another level and so on...

I'm really not sure how to specify (or if it is even possible to do so) that it should be filtered based on file name AND recursive. Regardless, experimenting can't hurt, since the modifications are local and can always be thrown away by reverting...

From svn help propset :

The svn:keywords, svn:executable, svn:eol-style, svn:mime-type and
svn:needs-lock properties cannot be set on a directory. A non-recursive
attempt will fail, and a recursive attempt will set the property only on the file children of the directory.

Given that there is ambiguity over the docs for what -R does (or doesn't do) as pointed out by Gonzalo I've used this batch file instead of trying to get svn to do what I want

D:>type applyProps.cmd
@echo off
for /r . %%X in (*.bob) do (
svn propset svn:keywords "Author Id HeadURL Revision" "%%X"
)

If your working directory is under UNIX, you can also try this command. It works for me:

svn propset svn:keywords "Id" `du -a | cut -f 2 | grep -v "\.svn" | grep "\.bob$" | sed "s/ /[[:space:]]/g"`

Just recursively changed properties on .xml files from application\/xml to text\/xml and was trying to see if there was a better way to do it. I couldn't find one, but stumbled across this question. Though it's old, this is the most succinct way I found:

find /<root_dir> -print | grep '.<extension>' | xargin svn propset svn:<property> <new_ property_value> $@

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM