Tuesday, 19 April 2011

Subversion Error: Failed to get lock on destination repos

During a regular copy of my main Subversion repository to a mirror I got the following inexplicable error message:
C:\Java\CollabNet Subversion Server>svnsync sync https://my_subversion_server.com/my_java_projects   --username myusername

Failed to get lock on destination repos, currently held by 'MyComputerName:7b9f4325-e08
0-db40-acc4-4453ff5fc85e'
Failed to get lock on destination repos, currently held by 'MyComputerName:7b9f4325-e08
0-db40-acc4-4453ff5fc85e'
Failed to get lock on destination repos, currently held by 'MyComputerName:7b9f4325-e08
0-db40-acc4-4453ff5fc85e'
Failed to get lock on destination repos, currently held by 'MyComputerName:7b9f4325-e08
0-db40-acc4-4453ff5fc85e'
Failed to get lock on destination repos, currently held by 'MyComputerName:7b9f4325-e08
0-db40-acc4-4453ff5fc85e'
The only reason I could think of that may have caused this was alterations to our network, but I’m wasn't sure. Doing a little digging causes of such an error may be your Subversion server incorrectly powering down whilst synchronizing to a repository.

The fix to the problem is simple, you need to remove the lock using the following command:
set TARGETREPOS=<url to My destination / mirror repository>
set USER=MyUserName
svn propdel svn:sync-lock --revprop -r 0 %TARGETREPOS% --username %USER%
Incidentally, in order to synchronise your repository with a mirror, use the following script:
cd "C:\Java\CollabNet Subversion Server"
svnsync sync %TARGETREPOS% --username %USER%

pause

No comments: