Working Copy Locked
Asked Answered
Q

16

70

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 ?

Quincuncial answered 6/1, 2012 at 2:1 Comment(1)
Jonathon J Howey's answer worked for me. I had to do one more thing, that is close my visual studio before clean up.Boatright
Q
1

I ended up using export command rather than update command. This is the post-commit hook

"C:\Program Files\VisualSVN Server\bin\svn.exe" export "D:\xampp\htdocs\test-lalala" --quiet --non-interactive --force --username myusername --password mypassword

Quincuncial answered 2/2, 2012 at 3:49 Comment(0)
C
197

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.

Calcic answered 25/7, 2012 at 20:23 Comment(3)
worked for me when i cleaned up one directory level up from locked locationGenesis
It is working on Ubuntu, I have Ubuntu on Client and Linux on server and it works. Actually this problem happens to me on Linux more often than it was on Windows.Urbanist
Do not forget to check on "Break locks" check box if using GUI.Leontina
S
35

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.

Sibert answered 4/3, 2013 at 20:54 Comment(3)
Just running clean-up worked for me but this was after logging off and on again so may have killed the process that way.Tanagra
I had Visual Studio running with AnkhSVN and had to close that also before cleanup would work.Cereus
After a lot of searching i finally found this. This should be more visible as it's the only thing that worked for me!Pollinize
L
22

Run a "Clean up" at the top directory level.

Leaper answered 18/4, 2013 at 17:3 Comment(3)
"working directory locked" error may arise due to there is a lock by svn client at the time of folder/file ADD and not properly commit and it may be fix by cleanup.Leaper
I got the same error when i didn't run cleanup in the <b>top directory</b> levelDisdainful
+1 for “at the top directory level”. Nobody else mentiones it and it seems to be important.Corelation
O
12

I solved it by deleting WC_Lock record in the SQLite ".svn\wc.db" file lock record in the WC_LOCK table.

Just open "wc.db" file with SQLite editor and executed

delete from WC_LOCK

The solution was given in another link that I cannot find right now. But really quite a fix; without worrying about deleting all directories

Odine answered 27/2, 2015 at 20:4 Comment(2)
Is DB Browser for SQL Lite the same as SQLLite editor?Anthropomorphize
Yes, it should be. For me, I just normally use Firefox extension to edit DBOdine
L
7

I fixed it by deleting the hidden .svn folder and replaced it with the fresh checkout .svn and it worked. Probably this hidden folder got messed up!

Lowborn answered 22/3, 2012 at 23:7 Comment(0)
T
5

I am sure It working fine for you

Goto top level SVN folder.

Right Click on folder(that has your svn files) -> TortoiseSVN -> CleanUp

This will surely solve your problem.

Tress answered 23/7, 2014 at 4:34 Comment(0)
P
4

You can fix it with only one step.

Step 1 : Open terminal and go to your project then fire command "svn cleanup" then "svn update"

Pes answered 13/4, 2018 at 10:17 Comment(1)
those are two steps ;P ... or even threeUnaware
J
3

If you are Windows guy and using "Tortoise SVN' user.

Select the File. Right Click. Option 'Tortoise SVN' --> get Lock. Use option 'Steal The Lock'.

Jelks answered 10/1, 2014 at 15:49 Comment(0)
Q
1

I ended up using export command rather than update command. This is the post-commit hook

"C:\Program Files\VisualSVN Server\bin\svn.exe" export "D:\xampp\htdocs\test-lalala" --quiet --non-interactive --force --username myusername --password mypassword

Quincuncial answered 2/2, 2012 at 3:49 Comment(0)
K
1

error "working copy locked", Just follow the steps :

  1. In which directory you are getting error on update
  2. Go to its parent directory
  3. In parent directory go to ".svn" hidden directory
  4. Remove file with name "lock"
  5. Clean up and Done

You can update the svn properly without error

Klausenburg answered 11/7, 2013 at 7:6 Comment(0)
S
1

Tortoise svn ->clean up

Thats all in SVN

Suspensive answered 26/1, 2015 at 5:42 Comment(2)
Which often fails or cleans up indefinitelyYuen
What if a user is faced with the problem and does not use TortoiseSVN after all?Bloodsucker
P
1

As you get working copy error, Just run the svn cleanup which clean all the unwanted files and folders. If still error comes, then do one thing.

Copy your files to other drive and delete the working copy folder or file and then take a update it will fetch the fresh file and after this replace with your updated copy and commit the same.

Parfleche answered 27/2, 2015 at 12:3 Comment(0)
N
0

I have experienced the same issues as you described. It appears to be a bug on Tortoise 1.7.3. I have reverted back to 1.7.2, executed a cleanup and an update. Now my SVN/Tortoise is working fine again

Neoptolemus answered 26/1, 2012 at 17:21 Comment(0)
N
0

For PHPStorm or Intellij:

VCS -> Cleanup Project
Neese answered 4/6, 2014 at 10:52 Comment(0)
S
0

Is your BitLocker disk encryption running? In my case, it locked the whole drive of the disk for encryption, and SVN failed with this error.

Stet answered 5/9, 2018 at 10:41 Comment(0)
A
-1
svn cleanup test-lalala/
svn update

repeat twice

Appropriate answered 5/3, 2019 at 10:11 Comment(3)
Can you explain that further? What does test-lalala stand for?Bloodsucker
@NicoHaase That is the same name used in the questionHindermost
And what do you mean by "repeat twice"?Bloodsucker

© 2022 - 2024 — McMap. All rights reserved.