svn 错误:同名版本目录已存在
我正在尝试将本地文件夹从分支切换到主干。我收到以下错误。
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果您在分支上创建了一个目录(即使我认为您还没有签入),但同时有人也在主干上创建了一个同名目录,您经常会看到这种情况。因此,当您从分支切换到主干时,它会尝试检查目录的主干版本,但它不能,因为它已经存在,所以它不想丢弃您的版本。
编辑:
解决此问题的最佳方法是在工作副本中重命名此目录,然后更新。更新后您可以决定是否需要将内容复制到新创建的目录中。
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.
我怀疑 \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.
也许
Path/To/The/Directory
在您当前的分支中不存在,但它确实存在于主干中?另一件可能出现问题的事情是,当 SVN 服务器运行区分大小写的操作系统(例如 *nix)并且您使用的是 Windows 时。在这种情况下,SVN 服务器会将:
视为两个不同的目录。当有人更改目录名称的大小写时,通常会发生这种情况。
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:
as two different directories. This usually happens when someone does a case change on the directory name.
一个简单的解决方案是使用
svn switch
和--force
标志。例如,当我切换到分支后,当我切换回主干时,我看到了错误。这解决了我的问题:
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 文件夹并再次清理/更新父目录就可以了。
不确定这是什么巫术,但我后来做出了更改并更新了各种系统,他们看起来都很高兴。
仅供参考,由于一种不寻常的情况,我进入了这种状态:
/foo 是 /newfoo/bar 的 svn:external,并且需要撤消这种安排,因此 /newfoo/bar 被移动并重命名为 /foo。
To fix this error while leaving the directory in place, I found the following technique worked:
I don't recall if I did this because of some error, or as a hunch…anyway it seemed to do the trick.
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.