0
我們正在準備從SVN遷移到GIT。我們所有的項目(每個項目都有分支,標籤等)都在一個存儲庫下。在遷移期間,我們想讓一些項目爲只讀。是否可以編寫SVN提交掛鉤來檢查文件是否在某個特定路徑下被更改?SVN:是否有可能阻止提交特定路徑?
解決方法:
#!/bin/sh
REPOS="$1"
TXN="$2"
SVNLOOK=/opt/local/bin/svnlook
# Committing to migrated projects to GIT is not allowed
$SVNLOOK changed -t "$TXN" "$REPOS" | grep "\/some_path\/" && /bin/echo "This repository is read-only due to migration to GIT. Please commit to GIT repo instead!" 1>&2 && exit 1
# All checks passed, so allow the commit.
exit 0