58

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?

6 Answers 6

67

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

2
  • 13
    This option is not available in v1.6
    – bratan
    Sep 5, 2013 at 3:28
  • 1
    This option is available only from v1.7 Dec 15, 2016 at 21:30
54

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
3
  • 11
    No, not the remote repository--the locally synched (mirrored) repository. Feb 29, 2012 at 16:10
  • 1
    Just a note, this might need to be the URL. I run it from the destination machine, so the cmd would be: svn propdel --revprop -r0 svn:sync-lock localhost/svn/repo Oct 19, 2012 at 20:24
  • Worth noting IMO that sync-locks are always applied to revision 0.
    – NReilingh
    Nov 23, 2012 at 18:46
11

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}
3

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.

3

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!

1
  • 1
    this helped a lot, for me the property was svn:rdump-lock (running svnrdump).
    – J S
    Nov 28, 2016 at 5:21
2

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.

1
  • 1
    revprops are required for syncing in the first place, so one assumes that has already been configured if we encounter an error during the sync process.
    – NReilingh
    Nov 23, 2012 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.