颠覆(svn)钩子脚本的帮助 [英] help with subversion (svn) hook script

查看:184
本文介绍了颠覆(svn)钩子脚本的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建一个Subversion服务器挂钩脚本,以防止人们首先不拥有文件锁的情况下提交更改?

How to create a subversion server hook script that prevents people from committing changes if they don't own the lock on the file first?

SVN服务器在Windows上.

Svn server is on windows.

谢谢.

P.S.此问题中的其他信息

P.S. Additional info in this question

Subversion(svn + tortoiseSvn)提交未锁定的文件

推荐答案

使用预提交钩子.预提交挂钩接收2个参数:

Use a pre-commit hook. Pre-commit hook receives 2 arguments:

#   [1] REPOS-PATH   (the path to this repository)
#   [2] TXN-NAME     (the name of the txn about to be committed)

您需要使用svnlook来确定是否存在未锁定的svn:needs-lock文件.

You need to use svnlook to determine if there are svn:needs-lock files that aren't locked.

要确定此提交更改的路径:

To determine the paths changed by this commit:

svnlook changed $1 --transaction $2

在"changed"中浏览文件($PATH作为循环项),并确定svn:needs-lock,以及它们当前是否被锁定:

Loop through the files ($PATH as loop item) in 'changed' and determine svn:needs-lock, and if they're currently locked:

svnlook propget $REPOS-PATH svn:needs-lock $PATH
svnlook lock $1 $PATH

将an写入stderr并返回非零值以在需要时中止此提交.

Write an to stderr and return non-zero to abort this commit when needed.

这篇关于颠覆(svn)钩子脚本的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆