且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法升级SVN工作副本

更新时间:2023-02-26 19:06:25

我有一个非常非常大的 svn 存储库.当我尝试使用它(提交、更新等)时,它说有锁.

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

你可以对一个文件设置一个来阻止你提交.从命令行,您可以执行 svn status 并查看锁定文件旁边的 K.然后您可以使用 svn lock --force窃取那个锁,并检查您的更改.(只要存储库中没有阻止您窃取锁的钩子即可).

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

然后,由于操作不完整,有一个锁定的工作目录.在这种情况下,当您执行 svn status 时,您将看到一个 L.在这种情况下,您通常可以在该工作副本的根目录(.svn 文件夹所在的位置)执行 svn cleanup.

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

请记住,您可以始终删除工作目录并创建一个新目录.小心混淆 Subversion 客户端.曾几何时,这似乎并不重要,但在 Revision 1.6、1.7、1.8 和 1.9 中,工作副本的结构发生了变化,可能与运行其他版本的客户端不兼容.

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.

是的.如果我删除工作副本中的任何目录并点击更新,它会抱怨它被锁定.我无法清除锁定,因为格式不匹配.理论上我可以重新签出整个 repo,然后将内容复制回来,但 repo 是 12GB(210,000 个文件).

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

删除目录然后执行 svn up 并不能解决锁定问题.我的意思是删除整个工作目录,并重做一个 svn co.您不必签出整个 repo.你只需要检查你需要什么.您需要所有 21 万个文件吗?我怀疑:

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

这会检查两个工作目录:一个用于 foo,另一个用于 bar.

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

如果你真的,真的想检查整个行李箱,使用 --depth 来稀疏地检查你需要的东西:

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

理论上我在这里检查了整个主干,但我只得到空的主项目目录.我只从项目foobar 获取文件.但是,foobar 共享 一个工作目录.假设我开始对 foo 进行长时间更新,然后我转到 bar 并尝试提交.我会收到工作目录被锁定的警告.我无法在同一个工作目录上执行两个单独的 Subversion 命令,即使它们位于该工作目录的不同部分.

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.

所以,我不知道我有两个客户端,但我只使用 TortoiseSVN (1.8.10).我今天才发现我在尝试排除故障时有两个.

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.

如果您安装 Tortoise,您还可以安装 Subversion 命令行客户端,这是一个可选安装.我强烈推荐它!不要使用从其他地方下载的命令行客户端(比如 SlikSVN 或 CollabeNet.并不是这些客户端不好.而是你应该使用你的 TortoiseSVN 版本附带的命令行客户端,以保证两者之间的一些奇偶校验Subversion 客户端.

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.

很容易混淆这些.你不应该在你的工作目录上使用 svnadmin 命令.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.

随着 Subversion 从 1.6 到 1.7 到 1.8 再到 1.9,upgrade 会将您的工作目录升级到新格式.完成后,您将无法返回到旧格式.您升级到 1.8 格式,1.7 和 1.6 客户端将不再工作.

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.

清理是为了帮助移除由于 Subversion 客户端命令不完整造成的锁.

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