svn 错误:同名版本目录已存在

发布于 2024-09-06 02:35:46 字数 186 浏览 4 评论 0原文

我正在尝试将本地文件夹从分支切换到主干。我收到以下错误。

Failed to add directory 'Drive:\Path\To\The\Directory'
a versioned directory of the same name already exists

对此有何决议?

I am trying to switch my local folder from Branch to Trunk. I get the following error.

Failed to add directory 'Drive:\Path\To\The\Directory'
a versioned directory of the same name already exists

What is the resolution for this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

红尘作伴 2024-09-13 02:35:46

如果您在分支上创建了一个目录(即使我认为您还没有签入),但同时有人也在主干上创建了一个同名目录,您经常会看到这种情况。因此,当您从分支切换到主干时,它会尝试检查目录的主干版本,但它不能,因为它已经存在,所以它不想丢弃您的版本。

编辑:

解决此问题的最佳方法是在工作副本中重命名此目录,然后更新。更新后您可以决定是否需要将内容复制到新创建的目录中。

EDIT2:

SVN 没有自动解决此问题的好方法。听起来好像您已在工作副本中创建了此文件夹(当前已在分支上签出),而其他人已在主干上创建了此名称的文件夹。当您切换时,它会尝试创建新目录,但它不能,因为您已经有了一个目录。我认为处理这个问题的唯一方法是暂时重命名目录,然后切换并比较两个目录的内容,看看是否有额外的文件需要添加或合并。

You often see this if you have a situation where you've created a directory on the branch (even I think if you haven't checked it in), but meanwhile someone has also created a directory of the same name on the trunk. So when you switch from branch to trunk it's trying to check out trunk's version of the directory, but it can't because it already exists and so it doesn't want to trash your version of it.

EDIT:

The best way to resolve this is to rename this directory in your working copy then update. After the update you can decide whether you need to copy the contents into the newly created directory.

EDIT2:

There isn't a good way of SVN resolving this automatically. It sounds like you have created this folder in your working copy (which is currently checked out on the branch) while someone else has created a folder of this name on the trunk. When you switch it's trying to create the new directory, but it can't because you've already got one. I maintain that the only way of dealing with this is to rename the directory temporarily, then switch and then compare the contents of both directories to see if there are extra files you need to add or merge.

栖迟 2024-09-13 02:35:46

我怀疑 \Path\To\The\Directory 不存在于分支中,但存在于主干中。也许是新添加到后备箱的?当您切换时,SVN 认为它应该将其添加到您的本地目录,因为它不在(应该是)您要切换的分支中。但无论如何它都在那里。这可能是由于之前未进行适当结帐而进行切换的结果。即你之前做过这个切换,然后当你从主干切换回分支时,你没有清理污垢。所以现在剩余的目录存在,并且它不希望看到它。

I suspect that \Path\To\The\Directory doesn't exist in the branch, but does exist in the trunk. Newly added to the trunk maybe? When you switch, SVN thinks it should be adding it to your local directory, as it's not (supposed to be) in the branch that you're switching from. But it's there anyway. This could be a result of a prior switch without a proper checkout. i.e. you did this switch before, and then when you switched from the trunk back to the branch, you didn't clean up the crud. so now the leftover directory is present, and it doen't expect to see it.

野生奥特曼 2024-09-13 02:35:46

也许 Path/To/The/Directory 在您当前的分支中不存在,但它确实存在于主干中?

另一件可能出现问题的事情是,当 SVN 服务器运行区分大小写的操作系统(例如 *nix)并且您使用的是 Windows 时。在这种情况下,SVN 服务器会将:

Path/To/The/Directory
Path/To/The/directory

视为两个不同的目录。当有人更改目录名称的大小写时,通常会发生这种情况。

Maybe Path/To/The/Directory doesn't exist in your current branch, but it does exist in trunk?

Another thing that might be the problem is when the SVN server is running a case-sensitive OS (*nix, for example), and you are using Windows. In that case, the SVN server will consider:

Path/To/The/Directory
Path/To/The/directory

as two different directories. This usually happens when someone does a case change on the directory name.

七堇年 2024-09-13 02:35:46

一个简单的解决方案是使用 svn switch--force 标志。

例如,当我切换到分支后,当我切换回主干时,我看到了错误。这解决了我的问题:

svn switch --force ^/trunk

A simple solution is to use svn switch with the --force flag.

For example, I saw the error after switching to a branch, when I switched back to trunk. This solved my issues:

svn switch --force ^/trunk
留一抹残留的笑 2024-09-13 02:35:46

为了在保留目录的同时修复此错误,我发现以下技术有效:

  • SVN 将目录切换到存储库中的正确路径(如果它尚未指向那里)。
  • 将目录内的 .svn 隐藏文件夹移动到某个安全位置(您的桌面)。
  • SVN 清理并更新父目录。 更新可能会导致某些子目录出现相同的错误。忽略这一点。
  • 将在目录内创建一个新的 .svn 隐藏文件夹。将原始 .svn 隐藏文件夹移回目录内,覆盖新 .svn 文件夹的现有内容。
    我不记得我这样做是因为某些错误,还是出于预感……无论如何,它似乎成功了。
  • SVN 再次更新目录。
  • 瞧!

请注意,在一个系统上,这一技巧至少有一次导致所有子目录/文件显示 ?。从子目录中删除 .svn 文件夹并再次清理/更新父目录就可以了。

不确定这是什么巫术,但我后来做出了更改并更新了各种系统,他们看起来都很高兴。

仅供参考,由于一种不寻常的情况,我进入了这种状态:

/foo 是 /newfoo/bar 的 svn:external,并且需要撤消这种安排,因此 /newfoo/bar 被移动并重命名为 /foo。

  • 我删除了 / 上指向 /foo 的 svn:external 属性,并提交了。
  • 我使用TortoiseSVN的存储库浏览器首先将/newfoo/bar移动到/bar,然后将/bar重命名为/foo。
  • 我的本地副本上的 SVN 更新首先导致错误消息:当 /foo 存在(或类似的情况)时 /foo 指向 /newfoo/bar。
  • 我 SVN 将 /foo 切换到新路径 /foo
  • 现在 SVN 更新导致“同名版本目录已存在”错误。

To fix this error while leaving the directory in place, I found the following technique worked:

  • SVN switch the directory to the correct path in the repository (if it is not pointing there already).
  • Move the .svn hidden folder inside the directory to some safe location (your desktop).
  • SVN Cleanup and Update the parent directory. The Update may result in the same error on some subdirectory. Ignore this.
  • A new .svn hidden folder will have been created inside the directory. Move the original .svn hidden folder back inside the directory, overwriting existing contents of the new .svn folder.
    I don't recall if I did this because of some error, or as a hunch…anyway it seemed to do the trick.
  • SVN update the directory again.
  • Voila!

Note that at least one time on one system, this trick resulted in all subdirectories/files showing ?. Deleting a .svn folder from a subdirectory and Cleaning/Updating the parent again did the trick.

Not sure what voodoo this is, but I committed changes and updated various systems afterwards and they all seem happy.

FYI I got to this state due to an unusual situation:

/foo was an svn:external to /newfoo/bar, and this arrangement needed to be undone so /newfoo/bar was moved and renamed as /foo.

  • I deleted the svn:external property on / pointing to /foo, and committed.
  • I used TortoiseSVN's repository browser to first move /newfoo/bar to /bar, then rename /bar to /foo.
  • SVN Update on my local copy first resulted in the error message that /foo was pointing at /newfoo/bar when /foo existed (or somesuch).
  • I SVN switched /foo to the new path /foo
  • Now SVN Update resulted in the "versioned directory of the same name already exists" error.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文