我在一个工作文件夹中有很多更改,在尝试进行更新时出错了。

现在当我发出'svn cleanup'时,我得到:

>svn cleanup .
svn: In directory '.'
svn: Error processing command 'modify-wcprop' in '.'
svn: 'MemPoolTests.cpp' is not under version control

MemPoolTests.cpp是另一个开发人员添加的新文件,在更新中被删除了。以前我的工作文件夹里不存在。

我能做些什么来尝试并继续前进,而不必签出存储库的新副本吗?

澄清:感谢您提出的关于将目录移出并删除一个新副本的建议。我知道这是一个选项,但这是我想避免的,因为有许多更改嵌套在几个目录深处(这应该是一个分支…)

我希望有一种更积极的方式来做清理,也许以某种方式迫使文件SVN有麻烦回到一个已知的状态(我尝试删除它的工作副本…这并没有帮助)。


当前回答

在之前的回答中有一些非常好的建议,但如果你在Windows上使用TortoiseSVN(一个好产品,但是…)时遇到问题,总是退回到命令行,首先做一个简单的“svn清理”。

在许多情况下,Windows客户端不会运行清理命令,但是使用SVN命令行实用程序可以很好地进行清理。

其他回答

最新版本(我使用的是1.9.5)通过在清理菜单上添加“打破锁”选项来解决这个问题。请确保在清理时选中了此复选框。

看一看

http://www.anujvarma.com/svn-cleanup-failedprevious-operation-has-not-finished-run-cleanup-if-it-was-interrupted/

以上链接修复的总结(感谢Anuj Varma)

Install sqlite command-line shell (sqlite-tools-win32) from http://www.sqlite.org/download.html sqlite3 .svn/wc.db "select * from work_queue" The SELECT should show you your offending folder/file as part of the work queue. What you need to do is delete this item from the work queue. sqlite3 .svn/wc.db "delete from work_queue" That’s it. Now, you can run cleanup again – and it should work. Or you can proceed directly to the task you were doing before being prompted to run cleanup (adding a new file etc.)

每当我有类似的问题,我使用rsync(注意:我使用Linux或Mac OS X)来帮助这样:

# Go to the parent directory
cd dir_above_borked

# Rename corrupted directory
mv borked_dir borked_dir.bak

# Checkout a fresh copy
svn checkout svn://... borked_dir

# Copy the modified files to the fresh checkout
# - test rsync
#   (possibly use -c to verify all content and show only actually changed files)
rsync -nav --exclude=.svn borked_dir.bak/ borked_dir/

# - If all ok, run rsync for real
#   (possibly using -c again, possibly not using -v)
rsync -av --exclude=.svn borked_dir.bak/ borked_dir/

这样您就有了一个新的签出,但是使用相同的工作文件。 对我来说,这总是很有效。

我最近也遇到过这种情况。对我来说,诀窍是在选择“清理”后,在弹出的选项对话框中,选择“打破锁”,然后选择“确定”。它为我成功地清理了。

如果问题是大小写敏感(签出到Mac和Windows时可能会出现问题),并且你没有签出到*nix系统的选项,下面的方法应该可以工作。这是从头开始的过程:

% svn co http://[domain]/svn/mortgages mortgages

(接着是结帐……然后……)

svn: In directory 'mortgages/trunk/images/rates'
svn: Can't open file 'mortgages/trunk/images/rates/.svn/tmp/text-base/Header_3_nobookmark.gif.svn-base': No such file or directory

这里,SVN试图检出两个名称相似但大小写不同的文件——Header_3_noBookmark.gif和Header_3_noBookmark.gif。Mac文件系统默认为大小写不敏感,在这种情况下会导致SVN阻塞。所以…

% cd mortgages/trunk/images/rates/
% svn up
svn: Working copy '.' locked
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)

但是,正如我们所知,运行svn cleanup不起作用。

% svn cleanup
svn: In directory '.'
svn: Error processing command 'modify-wcprop' in '.'
svn: 'spacer.gif' is not under version control

gif不是这里的问题…它只是不能从前一个错误移动到下一个文件。所以我删除了目录中除了. SVN之外的所有文件,并删除了SVN日志。这使得清理工作得以进行,这样我就可以检出并重命名有问题的文件。

% rm *; rm -rf .svn/log; svn cleanup
% svn up Header_3_nobookmark.gif
A    Header_3_nobookmark.gif
Updated to revision 1087.
% svn mv Header_3_nobookmark.gif foo
A         foo
D         Header_3_nobookmark.gif
% svn up
A    spacer.gif
A    Header_3_noBookmark.gif

在此之后,我可以返回到项目的根目录,并运行svn up来检查它的其余部分。