243

If I try to update my subversion repo, it says I must run cleanup. If I run cleanup, it says a file is missing. (I deleted a MASSIVE directory of files that failed to commit this morning from my home pc, but then I commit the same set of files from work, and now my home repo is bust). So, cleanup says:

Cleanup failed to process blablabla Can't set file blablabla read-write: The system cannot find the file specified.

If I update it says:

Command: Update Error: Previous operation has not finished; run 'cleanup' if it was interrupted Error: Please execute the 'Cleanup' command. Completed!:

How do I get this unstuck?

droidev
  • 7,352
  • 11
  • 62
  • 94
rockstardev
  • 13,479
  • 39
  • 164
  • 296
  • (other than deleting all the SVN info, and re-checking out) – rockstardev Apr 12 '12 at 16:59
  • 3
    that annoying error is why I hate svn. Each time facing this I have to re-checkout because cleanup from root folder or parent folder doesn't work. But the biggest problem is that it doesn't display overlay icons at that time so I don't know which file has been changed to backup before checking out – phuclv Sep 03 '13 at 04:24

29 Answers29

340

There is often no need for a new checkout or copying.

I have just solved a similar issue relating to the error "previous operation has not finished" with help from this (Link)

It seems that svn sometimes gets stuck while processing commands/operations. All of these operations are stored in the database file wc.db in the .svn folder.

By downloading SQLite to my checkout directory and running

sqlite3.exe .svn/wc.db "select * from work_queue"

you can get a list of all pending operations. These operations are the ones the error is referring to as "not finished".

By running

sqlite3.exe .svn/wc.db "delete from work_queue"

all of the old operations are deleted from the work queue and the error disapears. No need for a new checkout or anything

Sigurd V
  • 5,077
  • 4
  • 18
  • 27
  • This fall me in another error. Finally I install **tortoisesvn** and run `cleanup` to solve my problem. – Iman Mahmoudinasab Apr 07 '14 at 17:16
  • 5
    You should always try to run cleanup before trying the above solution. This works if you want to get a stuck SVN repository up and running without having to checkout a new working copy. – Sigurd V May 01 '14 at 13:00
  • For me, cleanup was stuck even after I checked out a new working copy. It couldn't find a file. This procedure worked to got over that. Clean ran again without any problems. – Marnee KG7SIO Aug 08 '14 at 22:58
  • 7
    Downloading sqlite.exe and running the delete was actually faster than checking out and merging -- great answer – Jeffrey Knight Aug 25 '14 at 16:33
  • Didn't work for me. I end up with "Working Copy XXX is locked" after that when trying clean up. – Vitor Canova Nov 04 '14 at 18:18
  • 13
    I've also gotten a "locked" after this but have gotten past it with a "svn cleanup" – Jeffrey Knight Nov 10 '14 at 04:46
  • For me the SQL command appears to be case sensitive so doing everything in CAPS worked. – RyanfaeScotland Feb 09 '15 at 12:32
  • 1
    I ran this on Debian, install using apt-get install sqlite3, then you can run the above commands without the .exe – Richard Merchant Apr 13 '16 at 12:23
  • I deleted the queue as described above using SqliteManager for Firefox add-on and had to run svn Clean up before I could Commit. This solution works like a charm. – Adrian Hedley May 13 '16 at 09:04
  • 5
    I got the 'locked' message as well, but then I ran the 'Clean Up' command checking the box that says "breaks locks", and it worked – McCoy Aug 12 '16 at 15:11
  • Fantastic! I used the following tool in VS 2017 (https://marketplace.visualstudio.com/items?itemName=ErikEJ.SQLServerCompactSQLiteToolbox#overview), connected to the .db and using same method as describe in your article and got it cleared up...good job! – Dave Oct 23 '17 at 14:27
  • I had to subsequently cleanup with 'break lock' and then also resolve, but that was it and I could update again. Excellent solution. – Jacob Feb 02 '18 at 08:34
122

Running console svn cleanup has solved the same problem for me.

Stephane Delcroix
  • 16,134
  • 5
  • 57
  • 85
user2902464
  • 1,221
  • 1
  • 8
  • 2
  • 21
    The console command `svn cleanup` will also provide more detailed information than using the Tortoise Explorer plug-in, which makes it very useful in situations like this. – Brandon S Nov 19 '13 at 17:24
  • 7
    Running the console command will probably give enough info to actually solve the problem. This is a much better answer. – DDS Dec 15 '13 at 22:54
  • 1
    well i selected the most top folder and used `svn cleanup`, thanks – deadfish May 19 '14 at 14:14
  • I've often had success with traversing up parent directories and running clean up on them, but it's a bit time consuming and 'magic'. Never knew this would return a detailed error, +1. – Phil Cooper Nov 28 '14 at 11:05
  • When you run `svn cleanup`, make sure the console is elevated. I didn't do this initially and I got the `red-write: Access is denied` error. – Tony Aug 20 '15 at 16:52
  • How do you access the console? – Tony Sep 14 '15 at 17:09
  • Fantastic, I was trying to do a revert and was stuck on this error. This simple solution solved it. Thanks a bunch! – makoshichi Mar 18 '16 at 16:59
  • The cmd command solved the issue immediately, although the TortoiseSVN client was not able to perform it. – Richard Kiefer Oct 05 '16 at 09:05
  • Worked for me too. Had to go back to my tortoise SVN installer and add the command line tools. Then made sure to run cmd.exe as administrator. svn cleanup ran without any messages. Then I could right click SVN Update again without errors! – Josh P Apr 04 '17 at 14:56
  • I'm using netbeans with svn and tortoise svn (in win10), both failed, but command line didn*t fail - thanks :-) – Gunnar Oct 05 '17 at 14:02
  • Worked for me too and that too without even running cmd with Admin privileges. This is the best answer. – prem Oct 15 '19 at 13:05
  • just shift + right click on the folder and open in PowerShell. So much easier than navigating a cmd or ps from c:/windows etc/ – Larry Sep 29 '21 at 00:02
104

I've been in similar situations. Have you tried running cleanup from the root of your workspace? I know sometimes a cleanup from a child directory (where the problem lies) doesn't work, and cleanup from the root of the workspace does.

If that still fails, since you had deleted a child dir somewhere. Try deleting 1 level higher from the child dir as well (assuming that is not the root), and re-trying update and cleanup.

If cleanup attempts aren't succeeding at any level then the answer is unfortunately checkout a new working copy.

Joshua McKinnon
  • 24,489
  • 11
  • 57
  • 63
  • 4
    for cleaning up from the child dir! It works for me! – Franva Apr 09 '15 at 07:45
  • 1
    If you are reading this you are in trouble :) I never ran into such a mess with Git (so far). I ended up cleaning / reverting / cleaning etc. on any directory I could, if Svn would let me. – aliopi Jul 13 '17 at 07:16
  • 1
    I did run the Cleanup from Windows FileExplorer (with Turtoise) and it gave me a more elaborated error wich told me what was the file with the problem, somehow SVN lost that file, a darm *.cache file, so i took another .cache and rename it to replace the missing file, run the cleanup, no errors this thime, ALL FIXED!! – Jhollman Sep 13 '18 at 16:15
26

I just had a similar issue. Running Process Explorer showed that another program (Notepad++) had a file handle to a folder that SVN had tried to delete. When I closed Notepad++, "Clean Up" was able to run successfully.

Glen Little
  • 6,951
  • 4
  • 46
  • 68
  • That could produce the problem mentioned in the question. But I am afraid, it can't liquidate it if it already happened. – Gangnus Apr 03 '14 at 11:25
24

I had tried the most voted answers here and a few others to no avail. My WORK_QUEUE table was empty and I wasn't able to try a clean up at a higher folder. What did work was the following (this is via Tortoise SVN);

  • Right click on folder
  • Go to TortoiseSVN -> Clean Up...
  • Make sure the option to Break Locks is ticked and click OK

The Clean Up operation now completes successfully and I can continue. No downloading of sqlite3 or other convoluted solutions required.

DiskJunky
  • 4,750
  • 3
  • 37
  • 66
  • 2
    Break locks does not do what I thought. It only breaks local locks that it uses on your system. Not locks that someone else has set. – Brian Carlton Mar 05 '18 at 18:15
  • 1
    sqlite3 sometimes solved my problem , but that method was too difficult to remember and clean up failed so often. This method saved me.. – s.c Jul 17 '19 at 08:57
  • 1
    Thanks a lot, it worked for me! Checking "Break Locks" is the trick. – Anshul Gupta Aug 14 '20 at 15:39
20

I was facing this problem after adding a jar which is already in the SVN and I added the new Version of it with the same name.

In Eclipse I tried this

  1. Right click on folder > Team > Refresh/Cleanup.
  2. Clean, build and refresh my application.
  3. Restart the Eclipse.

Using above steps I am able to Synchronize.

Rakesh Chouhan
  • 1,196
  • 12
  • 28
11

I use tortoise SVN. When clean up failed, check cleanup option

Make sure the option to Break Locks is checked.

Cleanup step

  • left mouse button in explore folder
  • select 'Tortoise SVN' -> 'Clean up...' menu
  • check 'Break Locks' checked and press 'ok'

It already answered ,but sometimes picture helps

enter image description here

s.c
  • 768
  • 6
  • 15
9

Trying to run cleanup while your files are open gave me problems. as soon as I closed my application (Visual studio) I ran clean up and it was successful

John
  • 91
  • 1
  • 1
4

I got the same problem, in my case I was using svn tortoise with the application I mean. Using the cmd shell of windows in root mode I applied svn cleanup and then svn update.... Then you can comeback to the application mode aand it will work perfectly!

GutiMac
  • 2,402
  • 1
  • 20
  • 27
3

I have also stuck with the same issue I have tried blow:

1.Try kill the process related to svn i.e. TSVNCache.exe and TortoiseProc 2.Reverting the unversioned files and deletion of same, which I have in svn . 3.cleanup using command prompt "svn cleanup"

and finally when restarted the desktop it worked for me , So for restart of system worked for me

Ankur Nirmalkar
  • 133
  • 1
  • 8
2

I tried removing the .svn folder to other location and placed it back in the same root folder. After when I tried to update the SVN, it got updated. I don't know how exactly it worked.

2

I had the same problem, and somehow found that I had a hidden .svn file at the c:\ level. Once I deleted this hidden folder (.svn), everything worked okay. I must have unintentionally created a working directory at the root drive.

mike gold
  • 1,551
  • 12
  • 12
2

In my case I had gulp-watch running that caused the problems. After stopping it I could execute Cleanup command.

Mariusz Pawelski
  • 25,983
  • 11
  • 67
  • 80
2

In my cases, after I close Visual Studio and retry the CleanUp, it works.

peterh
  • 11,875
  • 18
  • 85
  • 108
Ali Sadri
  • 1,570
  • 14
  • 15
2

I resolved this error today when it occurred trying to Commit to SVN. The error was genuine, TortoiseSVN could not access a file which I tried to Commit. This file had been saved while running a program "As Administrator" in Windows. This means the file has Administrator access but not access from my account (TortoiseSVN running as interactive user). I took ownership of the nominated file under my windows account and after that Cleanup was able to proceed.

2

I have seen several issues with svn, including this one, solved by deleting/creating an .svn/tmp directory. Then run svn cleanup

Vinnie James
  • 5,763
  • 6
  • 43
  • 52
1

delete the svn from the main folder and replace it from another viable copy you have from elsewere.and then update. svn folder will be normally a hidden folder. So, please make sure, to unhide the folder before doing the above steps.

digish a d
  • 441
  • 1
  • 6
  • 10
1

Workaround that worked for me:

  1. Cut the content of your directory and copy it to another folder.
  2. Run cleanup from command line on the empty folder.
  3. Copy the files back in the original folder.

Done, but I cannot explain why this happens. If you don't remove the files, the cleanup command say that he can't read/write those files.

Paolo
  • 11
  • 1
1

I had the same issue, what worked for me:

  1. Copy your folders and files to another place, say to a folder (I changed my files recently and the commitment failed and led to the addressed problem)
  2. check out a new working copy
  3. copy your changed files from folder to your working copy and override existing files. Commiting / Updating should work now
guest
  • 11
  • 1
1

I had an error such as "Can't change perms of file '/Users/Code/UnitTest.cpp': No such file or directory". The subversion is confused about a file that is no longer there. I simply did something like "echo ABCD >> /Users/Code/UnitTest.cpp" to create a copy of the file, then cleanup. It worked.

ABCD
  • 7,914
  • 9
  • 54
  • 90
1

In my case, the error appeared when trying to commit from within an IDE. When I executed the commit of the same directories with TortoiseSVN in the explorer, the operation succeeded.

Dani
  • 2,602
  • 2
  • 23
  • 27
1

That has happened for me when using externals and one of them was corrupt. I had to go to that folder and perform a cleanup. Then the cleanup worked for the entire working copy.

Example: Using external ^/widgets/foo common/foo-widget, first perform cleanup on folder common/foo-widget.

erikH
  • 2,286
  • 1
  • 17
  • 19
1

I initially got this problem trying to check in with TortoiseSVN. Initially, both, TortoiseSVN clean up and console svn cleanup both failed with similar messages as the original poster.

But my solution, (found out accidentally) was just to wait a few minutes. I am thinking TSVNCache was holding on to some of those files at the time of check in.

James John McGuire 'Jahmic'
  • 11,728
  • 11
  • 67
  • 78
1

In my case a background Java Virtual Machine instance was running, killing which cleanup was successful.

coretechie
  • 1,050
  • 16
  • 38
1

I had taken .svn folder from my fellow developer and replaced my .svn folder with this. It worked for me. Don't know what may be other consequences!

Manish Dubey
  • 706
  • 4
  • 17
1

This can happen when you have files still open when you try to SVN switch / cleanup.

I had a branch where I had created a new file, which I had open in another application. Switching to another branch could not remove the file causing the switch to fail. This was also causing the svn cleanup to fail, however this is not displayed as the reason in the Tortoise SVN UI.

Running svn cleanup from a console window (on the root folder) clearly shows the error file\location\file.ext: The process cannot access the file because it is being used by another process

Closing any open file handles / windows and running the console svn cleanup then allows the cleanup to work correctly.

Long story short - run svn cleanup in the console to see a more detailed error.

Jamie Pollard
  • 1,571
  • 1
  • 10
  • 21
1

Further to Sigurd V's answer (you should try that first), some larger code bases have multiple '.svn' folders, and it's not necessarily the one in the root directory which has the locked task.

If that's the case, you have to check each one. If you've already got SQLite and Powershell you can locate the offending directory quickly.

To find which folders is locked run (replacing path\to\sqlite.exe):

Get-ChildItem -Path . -Filter '.svn' -Recurse -Hidden | foreach { $toFind = $_.FullName + "\wc.db" ; gci $toFind | foreach { echo $_.FullName ; path\to\sqlite.exe $_.FullName "select * from work_queue" } }.

This gives a list of .svn directories and, below each one, a list of any current tasks.

If there are any with unfinished tasks, for each one run (replacing path\to\sqlite.exe and path\to\.svn\wc.db):

path\to\sqlite.exe path\to\.svn\wc.db "delete from work_queue"

Robert Gowland
  • 7,677
  • 6
  • 40
  • 58
1

In Eclipse;

  1. Right click on your project folder > Team > Refresh/Cleanup.
  2. In Eclipse window, select clean option under Project menu item
  3. Finally, restart Eclipse
harun ugur
  • 1,718
  • 18
  • 18
0

follow below steps.

1) Go to the directory where you are not able to successfully clean up via svn.(Root folder or child folder).

2) Select .svn folder in the directory, cut that folder and paste it in the separate drive or separate location (out of svn directory)

3) Now, go back to the directory - right click and select TortoiseSVN -->Repo-browser

4) Checkout the folder(it will not perform fresh checkout).

5) All your items will be versioned again, and it will repair the internal issue of svn, and problem should be solved.

candidJ
  • 4,289
  • 1
  • 22
  • 32
Kunal Khatri
  • 451
  • 3
  • 12