Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Working Copy Locked

I'm developing a web using subversion as version control, but got "working directory locked" error message

Here's the story:

I have

PC-A:

  • Windows XP Pro
  • VisualSVN 2.5.2
  • Tortoise SVN 1.7.3

PC-B:

  • Windows XP Home
  • Tortoise SVN 1.7.3

I have create repository on PC-A using VisualSVN.

From PC-B, I Checkout http:\\PC-A:81\svn\test\trunk to D:\xampp\htdocs\test-lalala.

From PC-A, I also checkout http:\\PC-A:81\svn\test\trunk to D:\xampp\htdocs\test-lalala.

I Create a post-commit hooks running my-post-commit.bat file so when I commit to http:\\PC-A:81\svn\test\trunk, folder D:\xampp\htdocs\test-lalalaon PC-A will updated, so other people can see the result.

"C:\Program Files\VisualSVN Server\bin\svn.exe" update "D:\xampp\htdocs\test-lalala" --username myusername --password mypassword --config-dir "C:\Program Files\VisualSVN Server\conf"  

On PC-B, Create index.php file, and commit. When I commit, I get this error message

error message

On PC-A, I try to right-click on D:\xampp\htdocs\test-lalala TortoiseSVN > CleanUp, and check "cleanup working copy status" and "Include externals" (checked by default). Try to add file and commit, but still got the same error message.

I try to look for lock file on .svn folder but there are no lock file. I also try to delete working copy on PC-A D:\xampp\htdocs\test-lalala and checkout again, but when I commit, still got the same error message.

How to solve this error message? So when I commit, the folder will updated automatically ?

like image 413
Permana Avatar asked Jan 06 '12 02:01

Permana


People also ask

Why is svn locked?

The lock tells other users that the file is being edited, and you can avoid merge issues. When you set up source control, you can configure SVN to make files with certain extensions read only. Users must get a lock on these read-only files before editing.

What is svn working copy?

A Subversion working copy is your own private working area, which looks like any other ordinary directory on your system. It contains a COPY of those files which you will have been editing on the website.


2 Answers

Every time I get a Working copy locked error I run a "Clean up". After that everything is back to normal.

On the command line you can execute svn cleanup which also removes lock files.

Note: Perform this operation on one level up directory and that should resolve most of the times.

like image 72
tatianes Avatar answered Nov 08 '22 12:11

tatianes


To anyone still having this issue (Error: Working copy '{DIR}' locked.), I have your solution:

I found that when one of TortoiseSVN windows crash, it leaves a TSVNCache.exe that still has a few handles to your working copy and that is causing the Lock issues you are seeing (and also prevents Clean Up from doing it's job).

So to resolve this:

Either

1a) Use Process Explorer or similar to delete the handles owned by TSVNCache.exe

1b) ..Or even easier, just use Task Manager to kill TSVNCache.exe

Then

2) Right click -> TortoiseSVN -> Clean up. Only "Clean up working copy status" needs to be checked.

From there, happy updating/committing. You can reproduce Lock behavior by doing SVN Update and then quickly killing it's TortoiseProc.exe process before Update finishes.

like image 23
Jonathon J Howey Avatar answered Nov 08 '22 11:11

Jonathon J Howey