Sunday, April 19, 2015

Subversion cleanup issue.


I have been using subversion for last two years. TortoiseSVN is a great free subversion client for freelancer like me. Although I am using AnkhSVN subversion client to manage subversion from Visual Studio IDE. Today during work, I have deleted a folder manually from my project working directory. After that my nightmare has just began. Whenever I was trying to commit/update/revert/unlock my project, it was showing a nice error "Previous operation has not finished: run 'cleanup' if it was interrupted". Sometimes the error text was different but was containing at-least "cleanup" word. Like, "Please execute the 'Cleanup' command". Well, there is a cleanup button in both TortoiseSVN and AnkhSVN subversion client. But same error was showing after clicking cleanup button too.


It was clear to me that, I was ended up in such issue, which was not possible to resolve by my subversion client. After a long time I have found a solution in stackoverflow. Subversion repository is using a internal SQLite database (wc.db in .svn folder) which contains a table named work_queue. Whenever we are trying to do an event, subversion repository searches previous pending task in that table and compare current task with that pending task and forward.


The solution was to delete all entries of work_queue table. There is an executable file of SQLite in SQLite official website. Download and unzip in project working directory. Then run the following command from windows command prompt(cmd.exe) to see the pending tasks -


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

To delete all old pending task, run the following command

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

Then try again "Cleanup" from subversion client. 
Hope this will help to get rid of this cleanup issue. 

Happy coding.