对于我们的项目,我们避免在用户的svn配置文件中使用svn global-ignores,因为这些svn设置仅限于客户端,而不是项目的属性。我们想要一种使用类似.gitignore文件的方法来管理项目子目录中被忽略的文件。我开发了一个简单的方案,它使用.svnignore文件和一个脚本相结合,该脚本(1)在目录树中查找.svnignore文件,(2)在每个找到.svnignore文件的目录上更新svn:ignore属性。当有人更新文件时,他们只需要记住运行脚本;我们发现这比手动管理目录上的svn:ignore属性更容易。
下面是脚本:
#!/bin/sh
# Syntax of the .svnignore file: like what "svn propset svn:ignore" accepts,
# and in addition, lines in the .svnignore file that begin with a pound sign
# (#) are ignored so that one can put comments in the file.
find $1 -depth -name .svnignore | while read file ; do
dir="`dirname $file`"
egrep -v '^[ ]*#' $file | svn propset svn:ignore -F - $dir
svn update $dir
svn commit --depth=immediates -m"Updated list of ignored files." $dir $dir/.svnignore
done
echo "Done."下面是这个脚本接受的一个.svnignore文件的示例:
# WARNING: This .svnignore file is not understood by SVN directly.
# WARNING: It is meant to be used in conjunction with our script in
# WARNING: trunk/project/scripts/svn-update-from-svnignore.sh
autom4te.cache
Makefile
config.log
config.status
.deps
include
TAGS
CTAGS
*.o我的问题是:
谢谢你的建议。
发布于 2013-02-28 22:20:15
svn up在循环中( WC的根中的单个更新将是更优雅的方式)-print0)可以通过管道传输到xargs进行svn propset,完全消除循环。发布于 2013-03-02 02:52:09
现在帮不上什么忙,但Subversion 1.8 (发行版时)将有Repository指定的配置,这将对您有所帮助。特别是1.8将有一个svn:全局-忽略属性,它的工作方式类似于全局-忽略配置选项。此外,1.8将具有可继承的属性和svn:全局-忽略是这样的可继承属性。因此,在目录上设置此属性将影响该目录下的任何内容。
http://subversion.apache.org/docs/release-notes/1.8.html#repos-dictated-config
发布于 2013-02-28 22:54:53
不要这么快就放弃对全球的忽视。您可以通过SVN外部的一些机制更新它们,例如登录脚本或(在Windows上)全局策略。
当然,只有当您有一个集中管理的环境时,例如在公司网络中,这才能起作用。对于开源项目,这是行不通的。但那样的话,您可能就不会使用SVN了。
https://stackoverflow.com/questions/15145919
复制相似问题