svnsync - couldn't get lock on destination repos
Asked Answered
C

6

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?

Croaker answered 2/11, 2010 at 12:27 Comment(0)
C
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

Concurrence answered 17/4, 2013 at 7:2 Comment(2)
This option is not available in v1.6Westfahl
This option is available only from v1.7Lilybel
U
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
Unlearned answered 2/11, 2010 at 12:37 Comment(3)
No, not the remote repository--the locally synched (mirrored) repository.Sr
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/repoTarry
Worth noting IMO that sync-locks are always applied to revision 0.Hemorrhage
R
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}
Rhyner answered 23/12, 2011 at 6:48 Comment(0)
O
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.

Overmatch answered 9/6, 2011 at 21:19 Comment(0)
L
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!

Learnt answered 14/10, 2013 at 5:44 Comment(1)
this helped a lot, for me the property was svn:rdump-lock (running svnrdump).Okapi
G
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.

Giacometti answered 3/11, 2011 at 16:14 Comment(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.Hemorrhage

© 2022 - 2024 — McMap. All rights reserved.