简体   繁体   English

设置svn:递归忽略目录结构

[英]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. 我已经将一个庞大的maven项目层次结构导入IntelliJ想法,现在想法已经创建了所有不同层次的.iml项目。 I would like to svn:ignore these files. 我想svn:忽略这些文件。

There are several similar questions, for example this one: svn (subversion) ignore specific file types in all sub-directories, configured on root? 有几个类似的问题,例如这一个: svn(subversion)忽略所有子目录中的特定文件类型,在root上配置?

However: the answer is always to apply svn:ignore with the --recursive flag. 但是:答案始终是使用--recursive标志应用svn:ignore 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 . 我想做的是为每个条目dir/project.iml添加svn:ignore *.imldir 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. 我猜我必须将上面的grep传输到sedawk并从那里传递给svn ,但我完全失去了一方面确切的sed或awk命令以及确切的svn命令(我不会另一方面,覆盖现有的svn:ignore values)。

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. 更新:我也不想要的是基于find解决方案,因为可能在这个层次结构中有.iml文件实际上已提交的项目,我不想干涉这些项目,所以我想添加该属性仅适用于我的IDE创建的.iml文件。

You can set up your client to globally ignore given file extensions. 您可以将客户端设置为全局忽略给定的文件扩展名。 Just add 只需添加

global-ignores = *.iml

into your Subversion config file. 进入你的Subversion配置文件。

Update: If you want to only ignore iml files in the directories involved, you can try 更新:如果您只想忽略相关目录中的iml文件,可以尝试

svn status | grep '^\?.*\.iml' | sed 's=^? *=./=;s=/[^/]*$==' | xargs svn propset svn:ignore '*.iml'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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