记录SVN使用过程中遇到的问题及其解决方案:

本文根据原文r33959,由Subversion中文站的中文化翻译小组翻译,欢迎各位参与翻译工作,加入地址:http://code.google.com/p/svncndoc/。参与翻译的志愿者包括rocksun、akeybupt2004、zhaozhi和jiaqifeng。

常见问题:

如何使用:

疑难解答:

开发者问题

说明:

工作过程中遇到的问题及其解决方案

1. Locked, Cleanup, Not a working copy

The following is an example of a problem I've had with Subversion on a number of occasions. The problem arises because a versioned directory (working copy) contains an unversioned resource/directory. This prevents subversion doing anything with the resources, as in the following example:

steph@dimwit:java # ls
com
steph@dimwit:java # svn revert -R com
svn: Working copy 'com' locked
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
steph@dimwit:java # svn cleanup com
svn: 'com/opencms' is not a working copy directory
steph@dimwit:java # cd com
steph@dimwit:com # svn add opencms
svn: Working copy '.' locked
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
steph@dimwit:com # svn status
L .
~ opencms

If you type svn status you'll probably see some resources preceeded with a tilda. This means that the versioned item is obstructed by some item of a different kind (i.e. an unversioned one). Some of the other resources may be locked too (indicated with a capital L).

Unfortunately, the only solution I know of is to replace the unversioned resource with the latest from the repository. If it's a directory this will mean restoring the directory and everything it contains. Of course, this means you will loose all versioning since your last commit.

  1. Backup the unversioned resource by renaming it. For the above example, I'd rename the opencms directory to opencms.bak with mv opencms opencms.bak.
  2. Clean up the working copy with svn cleanup.
  3. Update up the working copy with svn update, to make sure it's up to date.
  4. Remove any references to the unversioned resource from the .svn/entries file. You may have to do this as root. For the above example I'd remove the entry like <
  5. Remove any .svn directories from the backed-up resource. You can do this for the current directory (and all subdirectories) with find . -name .svn -print0 | xargs -0 rm -rf. For the above example it'd be find ./opencms.bak -name .svn -print0 | xargs -0 rm -rf.
  6. Rename the backed-up resource to what it should be. For the above example this would be cp opencms.bak opencms (note that I copied it rather than moving it - always best to maintain a backup just in case).
  7. Add the resource to version control as usual. For the above example, svn add opencms.
  8. If all has gone well, delete the backed-up resource. Even better, move it somewhere else, out of the working copy. Hopefully you'll never need it again.

2. Not a working copy(LINUX)(不是工作目录)

备份本地工作目录文件,删除其中.svn(find /path/to/destdir -name '.svn' -exec rm -r {} \;),然后svn checkout svn://address,完成之后,将备份目录中删除了.svn文件夹的内容覆盖掉工作目录中的内容,然后svn add等

3. solve svn error "can't recode string"

原因:SVN服务器中的内容可能包含特殊字符

解决办法:(1)SVN服务器上更改相关文件名为非特殊字符或者删除特殊字符的文件(夹);

(2)LINUX环境下,添加以下环境变量~/.bash_profile :

export LC_CTYPE="en_US.UTF-8"
export LANG="en_US.UTF-8"
此文章由 flyinweb 于 2009-12-03 08:22:26 编辑

本日志由 flyinweb 于 2009-12-02 18:23:58 发表,目前已经被浏览 7194 次,评论 1 次;

作者添加了以下标签: SVN

引用通告:http://www.517sou.net/Article/343/Trackback.ashx

评论订阅:http://www.517sou.net/Article/343/Feeds.ashx

相关文章

评论列表

  1. Gravatar
    lurenjia
    2010-05-26 16:47:53 | # | 回复
    今天遇到了“Cleanup failed to process the following paths:- ' ' is not a working copy directory”问题,用你介绍的方法解决的,非常感谢!
(必填)
(必填,不会被公开)