ChatGPT解决这个技术问题 Extra ChatGPT

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

https://i.stack.imgur.com/PUtyF.png

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 ?

Jonathon J Howey's answer worked for me. I had to do one more thing, that is close my visual studio before clean up.

d
divinedragon

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.


worked for me when i cleaned up one directory level up from locked location
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.
Do not forget to check on "Break locks" check box if using GUI.
J
Jonathon J Howey

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.


Just running clean-up worked for me but this was after logging off and on again so may have killed the process that way.
I had Visual Studio running with AnkhSVN and had to close that also before cleanup would work.
After a lot of searching i finally found this. This should be more visible as it's the only thing that worked for me!
P
Prince

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


"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.
I got the same error when i didn't run cleanup in the top directory level
+1 for “at the top directory level”. Nobody else mentiones it and it seems to be important.
s
sgupta

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


Is DB Browser for SQL Lite the same as SQLLite editor?
Yes, it should be. For me, I just normally use Firefox extension to edit DB
A
Alexis Pigeon

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!


S
Sadikhasan

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.


S
Shirish

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'.


H
Hardik Savani

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"


those are two steps ;P ... or even three
P
Permana

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


R
Ram Balwad

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

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

You can update the svn properly without error


p
prashant thakre

Tortoise svn ->clean up

Thats all in SVN


Which often fails or cleans up indefinitely
What if a user is faced with the problem and does not use TortoiseSVN after all?
L
LivCool

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.


A
Alan Fletcher

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


F
Frank Roth

For PHPStorm or Intellij:

VCS -> Cleanup Project

K
KrishPrabakar

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.


L
Liam
svn cleanup test-lalala/
svn update

repeat twice


Can you explain that further? What does test-lalala stand for?
@NicoHaase That is the same name used in the question
And what do you mean by "repeat twice"?

关注公众号,不定期副业成功案例分享
Follow WeChat

Success story sharing

Want to stay one step ahead of the latest teleworks?

Subscribe Now