提交subversion时可以修改文本文件吗?

gro*_*rom 3 svn hook

我想在正在提交的文本文件上运行以下脚本:

# Send the commands H and w to ed
# ed will append newline if the file does not end in one
printf "%s\n" H w | ed -s $1

# Strip trailing whitespace
sed -i 's/[ \t]*$//g' $1

# Convert tabs to 4 spaces
sed -i -r "s/\t/    /g" $1
Run Code Online (Sandbox Code Playgroud)

我看到subversion有一个start-commit和pre-commit钩子,但是我不能按照有关如何用上面的脚本处理文本文件的文档.

Gra*_*ant 7

你的意思是在文本文件提交之前更改它?你可以(我不确定如何),但它通常不是一个好主意,因为它不告诉客户端有关更改,因此本地副本在提交时变为无效.

我要做的是阻止提交(非零退出),并给出一个错误消息,说明为什么你不希望该修订通过.