ChatGPT解决这个技术问题 Extra ChatGPT

Working copy locked error in tortoise svn while committing

I'm using Tortoise SVN to update and commit changes to the repository in the server whenever I make changes to my working copy. But from a few days I'm not able to commit the changes and I get the following error whenever I try to commit.

Working copy 'C:\Program Files\EasyPHP\www\project\php' locked.
'C:\Program Files\EasyPHP\www\project' is already locked.

I've tried to unlock the folder by right clicking on it and selecting Tortoise SVN > Release lock, it says

There's nothing to unlock. No file has a lock in this working copy

What might be the problem?


N
Nux

No problem... try this:

Go to top level SVN folder.

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

This will surely solve your problem. I did this lots of time... :)

Note. Make sure "Break locks" option is selected in the Cleanup dialog.


thanks @MicroEyes...now i'm able to commit. I just have one small doubt. After making changes to a file, should i first commit and then update the file (in working copy) or update and then commit?
Always follow update then commit. Otherwise your will get a message to update from TortoiseSVN, because your version copy is older then stored in SVN server. So in anyways, you have to update and commit.
yes..that solved the my issue related to update my current copy to svn revision.
i just added files in SVN and try to commit it but i got same error. i tried cleanUp command but i am not able to solve this issue.
I am experiencing this a lot. Can I reduce the time svn takes before showing this error message (five to ten seconds currently)? So I can start the cleanup earlier.
J
Johann

The accepted answer didn't work for me. To fix that issue, I had to right-click on the file that was locked, select repo-browser. This opened a popup with the files as they are on the SVN server. I then right-clicked on the locked file and selected break lock.

When I closed the repository browser, back on explorer I could finally commit!


You just need to make sure "Break locks" option is selected in the Cleanup dialog. I think it is selected by default (and that's why this wasn't mentioned in the original answer).
b
bluish

Right click on folder. TortoiseSVN->Check for modifications. Click on the Check repository button. Break lock on all files returned.


R
Randy Levy

I ran into this issue as well. For some I would like to point out that if it is locked CHECK WITH YOUR TEAM. Someone on the team might have some things locked because they are working on it (this allows developers to do work on things without others coming in and trying to work on the same content as well). If that is the case, releasing the lock and then updating has the potential to lose data for the developer who locked it.

With that in mind my concern was that the "clean up" option would possibly change my working copy or remove information from the Repo level of Subversion. That is not the case. The answer worked for me. Mine became locked when I clicked cancel during the middle of an update. I ended up pulling some of our branches and I did not need the stuff so I hit cancel. My working copy became locked. I could not find any documents that came up as "locked" when I used the command 'release lock'. This left me puzzled and upon some quick reading (and this thread) I attempted the 'clean up' command. After a clean up it resolved my issue and nothing was locked anymore.

source: http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-dug-locking.html


G
G. Stevens

There are multiple meanings of "lock" in SVN and some of these answers that talk about "break lock" or a teammate holding a lock are not using the relevant meaning for the original question. This question is dealing with "working copy locks" (i.e. they are entirely local to the working copy on your computer and have nothing to do with you or teammates holding a lock/check-out on a file). The accepted answer by MicroEyes is referring to the correct usage and is your best option when this happens.

If a cleanup doesn't work you may need to check out a fresh working copy of the project. If you have any modified, un-commited files you will need to copy them over to the fresh working copy so you don't lose your changes.

See this page in the Tortoise SVN docs for a description of the three usages of "lock": http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-dug-locking.html

Excerpt (emphasis added):

The Three Meanings of “Lock” In this section, and almost everywhere in this book, the words “lock” and “locking” describe a mechanism for mutual exclusion between users to avoid clashing commits. Unfortunately, there are two other sorts of “lock” with which Subversion, and therefore this book, sometimes needs to be concerned. The second is working copy locks, used internally by Subversion to prevent clashes between multiple Subversion clients operating on the same working copy. Usually you get these locks whenever a command like update/commit/... is interrupted due to an error. These locks can be removed by running the cleanup command on the working copy, as described in the section called “Cleanup”. ...


c
cosmoto91

I had no idea what file was having the lock so what I did to get out of this issue was:

Went to the highest level folder Click clean-up and also ticked from the cleaning-up methods --> Break locks

This worked for me.


b
bluish

I had tried various things, including "Clean Up" on lower subdirectories. Finally, I tried updating the top level folder. Nothing. Then I read the "Clean up top level" tip. I tried that. The clean up part succeeded, but the lock remained. My solution was to go back to the top level, clean up, then clean up each red (!) folder I could drill down to. After all was "Cleaned up", the update worked perfectly. The "break lock" tip looks good, too, with the exception that someone on your team might have a legitimate lock on things.


b
bluish

I managed to lock myself out of a file in svn - don't know how - but when I tried (re)-getting the lock (Tortoise was showing the "Get Lock" option for the file), it complained that already had the lock. I tried deleting the file and committing the directory change - same result. I tried CleanUp (including refreshing the overlay), but that failed too.

The solution was to go into the Tortoise repo-browser, find the file and use the break lock function.


R
RMK

If this (https://stackoverflow.com/a/11764922/3045875) does not help: Check if another SVN tool is interfering and close the tool. We just struggled a couple of hours at merging using TortoiseSVN and had dozens of such lock errors. Eventually we figured that Matlabs SVN integration is interfering and after closing it all worked out.


x
xiaoliuzi

Windows Solution:

https://sourceforge.net/projects/win32svn/

1.Download it, then add it to system path.

2.Go to work directory execute "svn clean" and "svn update" in cmd.