SVN cleanup fails

When trying to update your local repository, if the names of some files to be created are not permitted on an operating system, svn complaints with a message something like:

X:\workspace>svn up
...    ...
A    some\directory\build\Project.build\Release\Project.build\Objects-normal\i386\MainWindow.o~>
svn: E720123: Can't move 'X:\workspace\.svn\tmp\svn-XXXXXXXX' to 'X:\workspace\some\directory\build\Project.build\Release\Project.build\Objects-normal\i386\MainWindow.o~>': The filename, directory name, or volume label syntax is incorrect.

Trying yet to update the repository gives you:

X:\workspace>svn up
svn: E155037: Previous operation has not finished; run 'cleanup' if it was interrupted

And trying to cleaning up:

X:\workspace>svn cleanup
svn: E720123: Can't move 'X:\workspace\.svn\tmp\svn-XXXXXXXX' to 'X:\workspace\some\directory\build\Project.build\Release\Project.build\Objects-normal\i386\MainWindow.o~>': The filename, directory name, or volume label syntax is incorrect.

Well, again:

X:\workspace>svn up
svn: E155037: Previous operation has not finished; run 'cleanup' if it was interrupted

And so on and so forth.

This happens, for instance, when you (sure, unintentionally) included an Xcode build directory to your svn repository and try to check it out on Windows, which will not allow some characters to be used in a file name–‘>’ in the example above. SVN doesn’t resolve this problem: the unaccomplished operation to check out a file with unallowed name is still at svn’s private “to-do” list, which should be done prior to any other operations through “svn cleanup”, which in essence flush all unfinished operations. This, however, makes an error as it tries to do something not achievable.

Since SVN 1.7, the repository is managed with a centralized SQLite data base instead of numerous, small chunks of files inside .svn directory within each subdirectory. The data base is located at .svn directory at your local copy’s top level directory, and named wc.db.

Open wc.db using sqlite3, a command line shell of SQLite, which can be downloaded from http://www.sqlite.org.

X:\workspace>sqlite3 .svn\wc.db

The “to-do” list is stored in a table called WORK_QUEUE:

sqlite> select * from WORK_QUEUE;

which might look like:

XXXX|(file-install 142 some/directory/build/Project.build/Release/Project.build/Objects-normal/i386/MainWindow.o~> 1 0 1 1)
XXXX|(file-install 142 some/directory/build/Project.build/Release/Project.build/Objects-normal/i386/MainWindow.o~? 1 0 1 1)
XXXX|(file-install 142 some/directory/build/Project.build/Release/Project.build/Objects-normal/i386/MainWindow.o~$ 1 0 1 1)
...

Remove all the entries related to the file name problem (here just I remove all):

sqlite> delete from WORK_QUEUE;
sqlite> .quit

“svn cleanup” should work now:

X:\workspace>svn cleanup

Before update, remove the files that caused this problem, or better the build directory containing the files, from the repository to avoid running into the same problem again:

X:\workspace>svn --force rm some\directory\build
X:\workspace>svn up

Reference: http://subversion.1072662.n5.nabble.com/quot-svn-cleanup-quot-fails-because-it-can-t-find-a-temp-file-td157577.html

SVN cleanup fails