在hooks目录下添加一个脚本就ok
#!/usr/bin/env python
#-*- encoding: utf-8 -*-
#########################################################################
# File Name: pre-commit.py
# Author: LookBack
# Email: admin#dwhd.org
# Version:
# Created Time: 2015年09月28日 星期一 18时53分18秒
#########################################################################
#SVN提交前检查钩子
#功能:
# 1、强制填写提交注释,内容10字节以上
# 2、强制注释格式为:xxx:xxx
# 3、提交文件检查,过滤不允许提交的文件
#########################################################################
import sys
import os
import re
def main(argv):
(repos, txn) = argv
badlist = (".*config.php$", ".*/php/cache", ".*test", "config.js$","^.*.db$")
message = "".join(os.popen("/usr/bin/svnlook log '%s' -t '%s'" % (repos, txn)).readlines()).strip()
if len(message) < 10:
sys.stderr.write("请输入本次提交的修改内容,10字节以上.n");
sys.exit(1)
if message.find(':') < 1:
sys.stderr.write("请按规范填写注释,格式为:功能名: 修改说明.n");
sys.exit(1)
changelist = os.popen("/usr/bin/svnlook changed '%s' -t '%s'" % (repos, txn)).readlines()
for line in changelist:
for pattern in badlist:
if re.search(pattern, line):
sys.stderr.write("请不要把 %s 加入版本库.n" % line[1:].strip());
sys.exit(1)
sys.exit(0)
if __name__ == "__main__":
main(sys.argv[1:])
根据系统自带的pre-commit.teml中的内容弄清楚这段脚本的含义:
The pre-commit hook is invoked before a Subversion txn is
# committed. Subversion runs this hook by invoking a program
# (script, executable, binary, etc.) named 'pre-commit' (for which
# this file is a template), with the following ordered arguments:
#
# [1] REPOS-PATH (the path to this repository)
# [2] TXN-NAME (the name of the txn about to be committed)
#
# [STDIN] LOCK-TOKENS ** the lock tokens are passed via STDIN.
#
# If STDIN contains the line "LOCK-TOKENS:n" (the "n" denotes a
# single newline), the lines following it are the lock tokens for
# this commit. The end of the list is marked by a line containing
# only a newline character.
茶杯头甜蜜终章dlc 官方手机版v1.0.0.3
下载火柴人传说暗影格斗内置菜单 最新版v3.0.1
下载荒野乱斗测试服 安卓版v61.10.3
下载荒野乱斗彩虹服 安卓版v61.10.3
下载寒霜启示录 安卓版v1.25.10
寒霜启示录是一款生存模拟游戏,不少玩家可能对于末日都有着自己
末日城堡免广告版 安卓最新版v0.7.1
末日城堡免广告版是一款非常好玩的模拟经营类游戏,内部可以不看
甜蜜人生模拟器 最新版v1.4.5
甜蜜人生模拟器是一款非常好玩的模拟恋爱手游,玩家在这里能够对
武器锻造师内置功能菜单 v10.4
武器锻造师内置菜单版是游戏的破解版本,在该版本中为玩家提供了
开放空间overfield 安卓版v1.0.5
开放空间Overfield是一款箱庭养成经营手游,让你在广阔