Unable to upgrade SVN working copy

别说谁变了你拦得住时间么 提交于 2019-12-03 16:44:17

I have a very very large svn repo. When I try to use it (commit, update, etc.) it says there are locks.

Is this about a working copy or the repository? Two different things. Also, is this about a file that's locked because someone locked it, or because your working directory is locked due to an incomplete

You can have a lock on a file that prevents you from doing a commit. From the command line, you can do a svn status and see the K next to the locked file. You can then use svn lock --force to steal that lock, and check in your changes. (As long as there's no hook in the repository that prevents you from stealing locks).

Then, there is a locked working directory because of an incomplete operation. In this case, you'll see an L when you do a svn status. In that case, you can usually do a svn cleanup in the root directory of that working copy (Where the .svn folder is located.)

Remember that you can always delete a working directory and create a new one. Be careful about mixing up Subversion clients. At one time, it didn't seem to matter that much, but in Revision 1.6, 1.7, 1.8, and 1.9, the structure of the working copy has changed and may not be compatible with clients running other revisions.


Update 2

Yep. If I delete any directory in the working copy and hit update, it complains that it is locked. I can't clear the lock, 'cause of the format mismatch. I can theoretically just re-checkout the entire repo, then copy things back, but the repo is 12GB (210,000 files).

Deleting a directory and then doing a svn up doesn't clean up the lock issue. I meant to delete the entire working directory, and redoing a svn co. You don't have to checkout the entire repo. You only have to check out what you need. Do you need all 210 thousand files? I doubt it:

$ svn co http://server/repo            # NOOOO!
$ svn co http://server/repo/trunk      # A bit better, but do you need all
                                       # the projects under Trunk?
$ svn co http://server/repo/trunk/foo  # Now, I'm just checking out foo
$ svn co http://server/repo/trunk/bar  # Now, I'm just checking out bar

This checks out two working directories: One for foo and one for bar.

If you really, really want to checkout the entire trunk, use the --depth to sparsely checkout what you need:

# Checking out trunk, but only getting the project directories
$ svn co http://server/repo/trunk --depth=immediates
$ svn up --set-depth=infinity foo
$ svn up --set-depth=infinity bar

Here I am in theory checking out the entire trunk, but I'm only getting empty master project directories. I am only getting files from projectsfoo and bar. However, foo and bar share a working directory. Let's say I start a long update on foo, then I go to bar and try to commit. I'll get a warning that the working directory is locked. I can't do two separate Subversion commands on the same working directory even if they are in different sections of that working directory.

So, I was unaware that I had two clients, but I only only only use TortoiseSVN (1.8.10). I only discovered today that I had two when I was trying to troubleshoot.

If you install Tortoise, you can also install the Subversion command line client which is an optional install. I highly recommend it! Don't use a command line client downloaded from elsewhere (like SlikSVN or CollabeNet. It's not that these clients are bad. It's that you should use the command line client that comes with your version of TortoiseSVN in order to guarantee some parity between the two Subversion clients.

Cleanup vs. Upgrade vs. Svnadmin

It's very easy to get these confused. You shouldn't be using svnadmin commands on your working directory. The svnadmin is for the server. The issue you have is strictly client.

As Subversion moved from 1.6 to 1.7 to 1.8 and now to 1.9, the upgrade will upgrade your working directory to the new format. Once done, you cannot go back to the older format. You upgrade to the 1.8 format, 1.7 and 1.6 clients will no longer work.

Cleanup is to help remove locks due to incomplete Subversion client commands.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!