【问题标题】:Can you modify text files when committing to subversion?提交颠覆时可以修改文本文件吗?
【发布时间】:2008-09-02 01:01:56
【问题描述】:

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

# 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

我看到 subversion 有一个 start-commit 和 pre-commit 钩子,但我无法按照文档了解如何使用上述脚本处理文本文件。

【问题讨论】:

    标签: svn hook


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2010-09-13
      • 2011-07-27
      • 1970-01-01
      • 2011-10-13
      • 2015-01-04
      • 1970-01-01
      • 1970-01-01
      • 2011-01-11
      • 2010-09-27
      相关资源
      最近更新 更多