"svn: E155009: Failed to run the WC DB work queue associated with"原因分析及解决方案

问题描述

在使用svn checkout一个项目时报错:

svn: E155009: Failed to run the WC DB work queue associated with '/home/.../doc', work item 39 (file-install doc/{U+7ED3}{U+7B97}{U+5FEB}{U+7167}.doc 1 0 1 1)

查看我的目录,发现文件没有完全checkout下来,于是想要执行svn update进行更新,结果报错。让我先执行cleanup

[nigel@DevTJ-todo-1507091995 ~/]$ svn update
svn: E155037: Previous operation has not finished; run 'cleanup' if it was interrupted

执行svn cleanup 时也报错,让我

[nigel@DevTJ-todo-1507091995 ~/]$ svn cleanup
svn: E155009: Failed to run the WC DB work queue associated with '/home/...', work item 39 (file-install doc/{U+7ED3}{U+7B97}{U+5FEB}{U+7167}.doc 1 0 1 1)

到了这里,已经完全没法执行下去了。

原因分析

遇到问题当然是要先google,在Stack Overflow上找到了一篇说明该问题的文章链接:https://changilkim.wordpress.com/2012/12/10/svn-cleanup-fails/
其中描述了这个问题出现的原因:

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 
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.

大意是:在svn checkout时,如果文件名中存在无法识别的符号,那么checkout操作会阻塞后面的其他操作——包括cleanup。此时我们只有采用其他方式来清理掉“to-do” list(操作列表)中这次失败的checkout操作,才能让svn继续工作。
从svn1.7之前,SVN采用众多的小文件来保存版本相关信息。但1.7之后,SVN使用一个集中式的SQLite 数据库来替代之前的下文件方式,该数据库位于.svn文件夹中,名字叫做wc.db。

[nigel@DevTJ-todo-1507091995 ~/dev/.../.svn]$ ls
entries  format  pristine tmp  wc.db  wc.db-journal

SVN的操作列表就存放在SQLite数据库的WORK_QUEUE表中。
因此,现在方向已经明确了——我们只需要将数据库SQLite中这次失败的checkout操作删除就万事大吉了。可是具体该怎么操作呢?

解决方案

要打开wc.db这个数据库,我们需要用到一个shell脚本——sqlite3,这可以从其官网 http://www.sqlite.org下载最新版。(如果不能翻墙,大家可以从这里下载2018最新版)
将解压过后将sqlit3拷贝到.svn文件夹下:

[nigel@DevTJ-todo-1507091995 ~/dev/.../.svn]$ ls
entries  format  pristine  sqlite3  tmp  wc.db  wc.db-journal

接着执行如下查询语句

sqlite3 wc.db “select * from work_queue”

来查看操作队列中阻塞的操作:

[nigel@DevTJ-todo-1507091995 ~/dev/.../.svn]$ sqlite3 wc.db "select * from work_queue"
39|(file-install doc/结算快照.doc 1 0 1 1)

可以看到有一条操作记录,接着执行下面的命令删除该操作:

sqlite3 wc.db “select * from work_queue”

这一步执行成功后没有任何提示:

[nigel@DevTJ-todo-1507091995 ~/dev/.../.svn]$ sqlite3 wc.db "select * from work_queue"
[nigel@DevTJ-todo-1507091995 ~/dev/.../.svn]$

大功告成!此时便可以执行svn cleanup了:

[nigel@DevTJ-todo-1507091995 ~/dev/...]$ svn cleanup
[nigel@DevTJ-todo-1507091995 ~/dev/...]$

猜你喜欢

转载自blog.csdn.net/zhoucheng05_13/article/details/81709921