Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set svn:ignore recursively for a directory structure

I have imported a huge hierarchy of maven projects into IntelliJ idea, now idea has created .iml projects on all different levels. I would like to svn:ignore these files.

There are several similar questions, for example this one: svn (subversion) ignore specific file types in all sub-directories, configured on root?

However: the answer is always to apply svn:ignore with the --recursive flag. That's not what I am looking for, I just want to ignore the files I created, not set a property on the hundreds of directories underneath.

Basically, what I have is the output of

svn status | grep .iml

which looks like this:

?       foo/bar/bar.iml
?       foo/baz/phleem.iml
?       flapp/flapp.iml

etc.

What I would like to do is for each entry dir/project.iml to add svn:ignore *.iml to dir. I am guessing I have to pipe the above grep to sed or awk and from there to svn, but I am at a total loss as to the exact sed or awk command on one hand and the exact svn command (with which I won't override existing svn:ignore values) on the other hand.

Update: what I am also not looking for are solutions based on find, because possibly there are projects in this hierarchy where .iml files are in fact committed and I wouldn't want to interfere with those projects, so I'm looking to add the property only for .iml files my IDE has created.

like image 772
Sean Patrick Floyd Avatar asked Feb 21 '23 00:02

Sean Patrick Floyd


1 Answers

You can set up your client to globally ignore given file extensions. Just add

global-ignores = *.iml

into your Subversion config file.

Update: If you want to only ignore iml files in the directories involved, you can try

svn status | grep '^\?.*\.iml' | sed 's=^? *=./=;s=/[^/]*$==' | xargs svn propset svn:ignore '*.iml'
like image 163
choroba Avatar answered Feb 23 '23 13:02

choroba