Break lock with cleanup through command line

1,188 views
Skip to first unread message

Ragnar Hägg

unread,
Oct 3, 2016, 11:59:54 AM10/3/16
to us...@tortoisesvn.tigris.org
I want to create a bat script that uses TortoiseSVN to update a svn repo. It should be able to handle the repo being locked from if something went wrong the last update.

What I tried was this (running 1.9.4):

START /WAIT TortoiseProc.exe /command:cleanup /path:"c:\svn\repoName" /cleanup /noui /nodlg
START TortoiseProc.exe /command:update /path:"c:\svn\repoName" /closeonend:2

But the cleanup command doesn't seem to handle breaking locks. When I run the cleanup command without /noui I get the cleanup options, where "Break locks" is an option, which isn't the case for 1.8.11. In the documentation (https://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-automation.html) it says that the :cleanup command "Cleans up interrupted or aborted operations and unlocks the working copy...". 

Is it possible that the "Break locks" functionality was removed as a default behavior for cleanup when the option was introduced in later versions, but no command line option to do it was added? Or is there a way of doing this?

Best regards,
Ragnar Hägg

Stefan Küng

unread,
Oct 3, 2016, 2:20:42 PM10/3/16
to us...@tortoisesvn.tigris.org
On 03.10.2016 17:20, Ragnar Hägg wrote:
> I want to create a bat script that uses TortoiseSVN to update a svn
> repo. It should be able to handle the repo being locked from if
> something went wrong the last update.
>
> What I tried was this (running 1.9.4):
>
> START /WAIT TortoiseProc.exe /command:cleanup /path:"c:\svn\repoName"
> /cleanup /noui /nodlg
> START TortoiseProc.exe /command:update /path:"c:\svn\repoName" /closeonend:2
>
> But the cleanup command doesn't seem to handle breaking locks. When I
> run the cleanup command without /noui I get the cleanup options, where
> "Break locks" is an option, which isn't the case for 1.8.11. In the
> documentation
> (https://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-automation.html)
> it says that the :cleanup command "Cleans up interrupted or aborted
> operations and unlocks the working copy...".

"unlocks the working copy" means getting rid of 'command locks', i.e.
locks that are set to prevent other svn commands from interfering
(similar to thread locks).
And that's what you want. Breaking locks of user locked files is also
possible, but I don't think that's what you're looking for.

Why do you think it doesn't clean the 'command locks' when you run the
cleanup?

> Is it possible that the "Break locks" functionality was removed as a
> default behavior for cleanup when the option was introduced in later
> versions, but no command line option to do it was added? Or is there a
> way of doing this?

Pass the /breaklocks parameter, which will break all locks which were
set with the "get lock" command on files.

other parameters for the cleanup command:

/cleanup : runs cleanup
/revert : also does a revert on the wc
/delunversioned : removes all unversioned files and folders
/delignored : removes all ignored files
/refreshshell : forces a refresh of the explorer overlays
/externals : includes all externals for the specified command(s)
/breaklocks : removes all user file locks
/fixtimestamps : changes the file times according to the last-commit-date
/vacuum : removes unneeded metadata

Stefan

--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest interface to (Sub)version control
/_/ \_\ http://tortoisesvn.net

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=3188188

To unsubscribe from this discussion, e-mail: [users-un...@tortoisesvn.tigris.org].

Ragnar Hägg

unread,
Oct 4, 2016, 2:53:54 AM10/4/16
to us...@tortoisesvn.tigris.org
mån 3 okt. 2016 kl 20:20 skrev Stefan Küng <torto...@gmail.com>:
On 03.10.2016 17:20, Ragnar Hägg wrote:
> I want to create a bat script that uses TortoiseSVN to update a svn
> repo. It should be able to handle the repo being locked from if
> something went wrong the last update.
>
> What I tried was this (running 1.9.4):
>
> START /WAIT TortoiseProc.exe /command:cleanup /path:"c:\svn\repoName"
> /cleanup /noui /nodlg
> START TortoiseProc.exe /command:update /path:"c:\svn\repoName" /closeonend:2
>
> But the cleanup command doesn't seem to handle breaking locks. When I
> run the cleanup command without /noui I get the cleanup options, where
> "Break locks" is an option, which isn't the case for 1.8.11. In the
> documentation
> (https://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-automation.html)
> it says that the :cleanup command "Cleans up interrupted or aborted
> operations and unlocks the working copy...".

"unlocks the working copy" means getting rid of 'command locks', i.e.
locks that are set to prevent other svn commands from interfering
(similar to thread locks).
And that's what you want. Breaking locks of user locked files is also
possible, but I don't think that's what you're looking for.

Why do you think it doesn't clean the 'command locks' when you run the
cleanup?

I think it doesn't clean 'command locks' by default since when I run update right after the cleanup (as my example above), it fails for reason:

Error: Working copy 'c:\svn\repoName' locked.  
Error: 'c:\svn\repoName' is already locked.  
Error: Please execute the 'Cleanup' command. 

But this was fixed by the argument /breaklocks for cleanup. Byt since this argument wasn't listed in the documentation I linked to it sounded like it would do this automatically.
 

> Is it possible that the "Break locks" functionality was removed as a
> default behavior for cleanup when the option was introduced in later
> versions, but no command line option to do it was added? Or is there a
> way of doing this?

Pass the /breaklocks parameter, which will break all locks which were
set with the "get lock" command on files.

other parameters for the cleanup command:

/cleanup : runs cleanup
/revert : also does a revert on the wc
/delunversioned : removes all unversioned files and folders
/delignored : removes all ignored files
/refreshshell : forces a refresh of the explorer overlays
/externals : includes all externals for the specified command(s)
/breaklocks : removes all user file locks
/fixtimestamps : changes the file times according to the last-commit-date
/vacuum : removes unneeded metadata

Stefan 

Thanks you, /breaklocks was the argument I was looking for. I'm not sure if I was looking at the wrong documentation, or if the documentation hasn't caught up with the code, but I was googling for quite a while and couldn't find it.

Best regards,
Ragnar

Balázs

unread,
Mar 5, 2018, 7:02:21 AM3/5/18
to TortoiseSVN
The documentation at https://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-automation.html is still not updated with /breaklocks
Reply all
Reply to author
Forward
0 new messages