Friday, October 31, 2014

Thread safe concurrent svn update

Subversion (svn) update is not thread safe which means you cannot script an update that could interfere with some other update process or otherwise you will face:
svn: Working copy '.' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
# How to test this is a valid solution?
# 1. Run 'while true; do svn update; done' in one SSH session
# 2. Run the below 'while' in a separate SSH session until you see the echo message indicating that there is locking
set +e
while svn update 2>&1 | grep "Working copy.*locked"; do echo "Retrying 'svn update' after in locked working copy"; sleep 5; done
set -e

No comments:

Followers