settings a SVN server so as to enable lock-modify-unlock mechanism of version control

久未见 提交于 2019-12-06 15:23:54
Albin Sunnanbo

Read Automatically add svn:needs-lock
Since you use Tortoise SVN you should especially read the part about tsvn:autoprops.

On the server side you can't change a thing like this. What would be possible to prevent people from checking in files which don't have the property (svn:needs-lock) set...via Hook script. But that's not a recommended way to work with SVN.

The best option is to enforce all committed files to have the svn:needs-lock property. There are several links on how to do this.

Here are some handy scripts and hooks for windows.

For unix, here is a variant of http://www.codenition.com/shell-script-to-enforce-svnneeds-lock that actually works (exit 1 in a forked while loop does not behave as expected).

Add the following code to /path/to/repo/hooks/pre-commit

# Make sure every file has the svn:needs-lock property set
while read REPOS_PATH
do
if [[ "$REPOS_PATH" =~ "^(A|M|U)[[:blank:]]{3}(.*)" ]]; then
    if [ ${#BASH_REMATCH[*]} -ge 2 ]; then
        if [ -z "`$SVNLOOK propget -t \"$TXN\" \"$REPOS\" svn:needs-lock \"${BASH_REMATCH[2]}\"`" ]; then
            STATUS="1"
            echo "$REPOS_PATH must have the svn:needs-lock property set">&2
            exit 1
        fi
    fi
fi
done <<< "`$SVNLOOK changed -t "$TXN" "$REPOS"`"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!