我有一个像这样的剧本
#!/bin/sh
REPOS=”$1"
TXN=”$2"
# Make sure that the log message contains some text.
SVNLOOK=/usr/local/bin/svnlook
$SVNLOOK log -t “$TXN” “$REPOS” | grep “[A-z a-z]” && exit 0
echo “Please write a log message describing the purpose of your changes and then try c
ommitting again.” 1>&2
exit 1
如果我必须只跟踪svnlook中的cpp文件并在条件失败时抛出错误,我还应该用这个脚本添加什么? )grep和find逻辑不起作用**
答案 0 :(得分:0)
因此,请准确解释您的需求:
.cpp
个文件,则需要检查提交注释。否则,您要忽略该评论。.cpp
个文件,则需要检查提交注释。否则,您要忽略该评论。.cpp
个文件。没有其他的。并且,您要拒绝任何包含非C ++文件的提交。无论您正在做什么,您都必须运行svnlook changed
命令并查看已更改的文件的所有内容。请记住,所有提交的文件只有一个提交注释。
您可能想要结帐我的kitchen sink pre-commit hook。这个预提交钩子几乎可以处理你想要的任何情况。它使用控制文件进行配置,因此您无需修改代码。
想阻止人们处理任何非C ++文件吗?
# Remove all permission
[file You don't have permission to add these files to the repository]
match = .*
access = read-only
users = @ALL
# Allow only files ending in .cpp
[file You don't have permission to add these types of files to the repository]
file = **/*.cpp
access = read-write
users = @ALL
# Users must be able to add directories
[file You don't have permission to add these types of files to the repository]
match = /$
access = read-write
users = @ALL
# Probably want to allow the addition of Makefiles too
[file You don't have permission to add these types of files to the repository]
match = [mM]akefile$
access = read-write
users = @ALL
想确保提交评论有效吗?
[revprop You must add a VALID comment to your commits]
property = svn:log
value = .{10,}
type = regex