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?

peterh
  • 11,875
  • 18
  • 85
  • 108
sdu
  • 2,740
  • 4
  • 31
  • 30

6 Answers6

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

Demi-Lune
  • 1,868
  • 2
  • 15
  • 26
s3v1
  • 2,923
  • 2
  • 33
  • 25
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
khmarbaise
  • 92,914
  • 28
  • 189
  • 235
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}
Matt White
  • 329
  • 3
  • 11
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!

venkrao
  • 383
  • 4
  • 17
  • 1
    this helped a lot, for me the property was svn:rdump-lock (running svnrdump). – J S Nov 28 '16 at 05:21
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.

Arun
  • 3,406
  • 4
  • 30
  • 55
AMRAAM
  • 31
  • 1
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.

Danny Remington - OMS
  • 5,244
  • 4
  • 32
  • 21
  • 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 '12 at 18:43