为什么我总是收到“SVN:工作副本 XXXX 已锁定;尝试执行“清理”?
如果您以前在 Eclipse 中使用过 SVN 工具(Subversion、subversive),那么您可能熟悉“工作副本 'XXX' 已锁定...”错误。
我在以下位置找到了一篇非常有用的文章,其中包含此问题的解决方法: 工作副本 XXX 在 SVN 中被锁定且清理失败
解决方法是,一遍又一遍地执行此操作很痛苦,有谁知道为什么我不断收到此错误以及我可以采取哪些步骤来防止它?
上下文:我正在创建一个涉及监听 SVN 事件的 Eclipse 插件,因此,在测试这个插件时,我通常每次打开工作区时都会进行 1 或 2 次提交,并且我会收到“工作副本已锁定”错误。为了不再发生这个错误,所以感谢任何建议
!
If you have worked with SVN tools in Eclipse (Subversion, subversive) before, then you are likely familiar with the 'working copy 'XXX' locked..." error.
I found a very useful post with a workaround for this problem at: Working copy XXX locked and cleanup failed in SVN
As great as the workaround is, it is a pain to do it over and over again. Does anyone know why I keep getting this error and what steps I could take to prevent it?
Context: I am creating an Eclipse plugin that involves listening for SVN events, so in testing this plugin, I am constantly opening and closing the workspace. I usually do 1 or 2 commits each time I open the workspace. Every so often the commit will fail and I get the 'working copy locked' error. I would love for this error to not happen anymore, so any advice is appreciated.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
问题已解决。
注意:以上步骤仅适用于 Eclipse(Indigo 包)
Problem Solved.
Note: The Above steps will work only Eclipse(Indigo package)
通常会创建一个 .lock 文件,并通过检查该文件是否存在来决定锁定/解锁状态。我想如果你只删除这个
.lock
文件,那么问题就会消失。Generally a
.lock
file is created and it decides lock/unlock state checking the existince of this file. I think if you delete this.lock
file only, then the problem will go away.我之前遇到过很多 SVN 问题,其中一件肯定给我带来问题的事情是在 Eclipse 之外修改文件或手动删除文件夹(其中包含 .svn 文件夹),这可能给我带来了最大的麻烦。
编辑
您还应该小心不要中断 SVN 操作,尽管有时可能会出现错误,这可能会导致
.lock
文件无法删除,从而导致错误。I've had a lot of issues with SVN before and one thing that has definitely caused me problems is modifying files outside of Eclipse or manually deleting folders (which contains the .svn folders), that has probably given me the most trouble.
edit
You should also be careful not to interrupt SVN operations, though sometimes a bug may occur and this could cause the
.lock
file to not be removed, and hence your error.确保你准确地清理了控制台所说的内容。例如,如果子文件夹(包)被锁定:
cleanup C:/Users/liparulol/workspace/tparser/src/de/mc/etn/parsers/order
那么您需要清理指定的文件夹而不是整个项目。如果您在 Eclipse 中右键单击包(而不是项目文件夹)并执行清理。
Make sure you exactly cleanup what the console says. For example if a subfolder (a package) is locked:
cleanup C:/Users/liparulol/workspace/tparser/src/de/mc/etn/parsers/order
Then you need to cleanup the specified folder and not the whole project. If you are in eclipse right click on the package, not on the project folder and execute the clean up.
经过更多的探索和测试,这个问题似乎是由调试插件和使用断点引起的。 SVN/Subclipse 显然不喜欢在执行过程中设置断点,因此会创建此锁定文件。当我开始运行该插件后,这个问题就消失了。
After more exploration and testing, it appears that this issue was being caused by debugging the plugin and using breakpoints. SVN/Subclipse apparently didn't like having breakpoints midway through their execution and as a result this lock files were being created. As soon as I started just running the plugin, this issue disappeared.
当项目中的某个文件夹出现问题时,就会发生这种情况。
您需要找出锁定的确切文件夹并在特定文件夹下执行
svn cleanup
。您可以通过以下方式解决此问题:
This will happen when something went wrong in one of your folders in you project.
You need to find out the exact folder that locked and execute
svn cleanup
under the specific folder.You can solve this as follows:
svn commit
command to find out which folder went wrong.svn cleanup
. Then it's done.以下内容应该解锁锁定的工作副本(在 svn 客户端版本 1.6.11 和 elipse 版本上测试:Mars.2 Release (4.5.2))
步骤 1:(转到工作副本目录) $cdworking_copy_dir
步骤 2:(连接到svn sqlite 数据库) $sqlite3 .svn/wc.db
步骤 3: (删除表 WC_LOCK 中的所有记录) sqlite>从 WC_LOCK 中删除;
步骤 4:(断开与 sqlite 3 数据库的连接)sqlite>ctrl + d
步骤 5:(从 Eclipse)右键单击您的工作副本,然后单击 Team ->刷新/清理
The following should unlock a locked working copy (tested on svn client version 1.6.11 and elipse version: Mars.2 Release (4.5.2))
step 1: (go to working copy directory) $cd working_copy_dir
step 2: (connect to svn sqlite database) $sqlite3 .svn/wc.db
step 3: (delete all records from table WC_LOCK) sqlite> delete from WC_LOCK;
step 4: (disconnect from sqlite 3 database) sqlite>ctrl + d
step 5: (from eclipse) right click on your working copy, then click Team -> Refresh/Cleanup
我使用 com.xxx.service.model 包也遇到了同样的问题。
为了解决这个问题,我首先备份了模型包中的代码更改。然后删除模型包并与存储库同步。它将显示传入的整个文件夹/包。然后更新了我的代码。
最后,将旧代码提交粘贴到 SVN 存储库。效果很好。
I had the same problem using the
com.xxx.service.model
package.To fix it, I first made a backup of the code changes in the model package. Then deleted model package and synchronized with the repository. It will show incoming the entire folder/package. Then updated my code.
Finally, paste the old code commit to the SVN Repository. It works fine.
当我从另一个颠覆项目复制目录并尝试提交时,就发生了这种情况。解决方案是删除我想要提交的目录中的 .svn 目录。
This happened to me when I copied a directory from another subversion project and tried to commit. The soluction was to delete the .svn director inside the directory I wanted to commit.
当您删除/移动文件时,可能会发生此类问题 - 本质上是对目录结构进行更改。 Subversion 仅检查已添加到 subversion 的文件中所做的更改,而不检查对目录结构所做的更改。不要使用操作系统的 copy 等命令,而是使用 svn copy 等命令。请参阅 http://svnbook.red-bean.com/en/1.7/svn.tour.cycle.html
此外,提交更改后 svn 首先存储待办事项列表中更改的“摘要”。在执行此待办事项列表中的 svn 操作时,它会锁定文件以防止在执行这些 svn 操作时进行其他更改。如果 svn 操作中途中断,例如崩溃,文件将保持锁定状态,直到 svn 完成待办事项列表中的操作。可以使用svn cleanup命令“重新激活”它。请参阅 http://svnbook.red-bean.com/en /1.7/svn.tour.cleanup.html
This type of problem can happen when you delete/move files around - in essence making changes to your directory structure. Subversion only checks for changes made in files already added to subversion, not changes made to the directory structure. Instead of using your OS's copy etc commands rather use svn copy etc. Please see http://svnbook.red-bean.com/en/1.7/svn.tour.cycle.html
Further, upon committing changes svn first stores a "summary" of changes in a todo list. Upon performing the svn operations in this todo list it locks the file to prevent other changes while these svn actions are performed. If the svn action is interrupted midway, say by a crash, the file will remain locked until svn could complete the actions in the todo list. This can be "reactivated" by using the svn cleanup command. Please see http://svnbook.red-bean.com/en/1.7/svn.tour.cleanup.html
解决方案:
第1步:必须删除“.svn”隐藏文件下的“lock”文件。
步骤2:如果没有“lock”文件,那么您会看到“we.db”,您必须打开此数据库,并且需要从下表中单独删除内容
-锁定
-wc_lock
第3步:清理您的项目
第四步:立即尝试承诺。
第五步:完成。
Solution:
Step1: Have to remove “lock” file which present under “.svn” hidden file.
Step2: In case if there is no “lock” file then you would see “we.db” you have to open this database and need to delete content alone from the following tables
– lock
– wc_lock
Step3: Clean your project
Step4: Try to commit now.
Step5: Done.