svnsync - couldn't get lock on destination repos

SvnSvnsync

Svn Problem Overview


Using svnsync

$ svnsync --non-interactive sync ${REPO}

after an abort of the process there was this error message with retry

Failed to get lock on destination repos, currently held by 'svn.test.com:0e4e0d98-631d-0410-9a00-9330a90920b3'  
...  
Failed to get lock on destination repos, currently held by 'svn.test.com:0e4e0d98-631d-0410-9a00-9330a90920b3'   
svnsync: Couldn't get lock on destination repos after 10 attempts  

Is there a way to fix this problem?

Svn Solutions


Solution 1 - Svn

Actually, there is some functionality built into svnsync (since v1.7) that can "steal" the lock.

svnsync help sync

shows:

--steal-lock             : Steal locks as necessary.  Use, with caution,
                           if your mirror repository contains stale locks
                           and is not being concurrently accessed by another
                           svnsync instance.

and when I run it, I get a nice:

Stole lock previously held by '[hostname]'

So, you don't need the propdel thing after all

Solution 2 - Svn

You have to remove the lock property on the remote repository via svn command line on the remote site which has been left over from a failure during synchronization.

svn propdel --revprop -r0 svn:sync-lock file:///path/to/the/repository

Solution 3 - Svn

Technically, it is the destination repository that you need to delete the property from, not necessarily the remote repository, as the destination could be local. So for this specific question:

svn propdel --revprop -r0 svn:sync-lock ${REPO}

Solution 4 - Svn

Removing the Lock worked for me. However, I had to use a slightly different command, as I needed to send the username and password of the account to use to unlock the account.

svn pdel --revprop -r 0 --username ??? --password ??? svn:sync-lock file:///path/to/the/repository

I also had to run this command from the drive that the repository was on. (change to d: in the command prompt before running the command, if my Repository was on d:)

Prior to entering the username and password, when I ran the command I got the following error:

revprop change blocked by pre-revprop-change hook (exit code 255)

I found and opened the pre-revprop-change hook file, and it had code in there listing only a certain username that could make the required changes. Using that username and password in the above command removed the hook.

Solution 5 - Svn

To confirm the presence of lock(although the err obviously tells it), run proplist with -verbose

svn pl --revprop -v -r 0 file:///svn/slave

then delete the prop as necessary!

Solution 6 - Svn

You have to do two things to solve the problem. One is deleted the lock as noted above. Then you have to edit the pre-revprop-change.tmpl file to be empty, and make it executable. Use chmod +x on Linux/Unix/Mac but change the file name to pre-revprop-change.bat on Windows. After this you can load dump files into your repository and then mirror it where ever you need.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionsduView Question on Stackoverflow
Solution 1 - Svns3v1View Answer on Stackoverflow
Solution 2 - SvnkhmarbaiseView Answer on Stackoverflow
Solution 3 - SvnMatt WhiteView Answer on Stackoverflow
Solution 4 - SvnAMRAAMView Answer on Stackoverflow
Solution 5 - SvnvenkraoView Answer on Stackoverflow
Solution 6 - SvnDanny Remington - OMSView Answer on Stackoverflow