将现有 Eclipse 项目与现有 SVN 存储库相关联

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2273548/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 19:11:59  来源:igfitidea点击:

Associating existing Eclipse project with existing SVN repository

eclipsesvnsubclipse

提问by Richard H

I have an eclipse project on my hard disk, which is a fairly recent check out from an SVN repository. I've imported this project into my Eclipse workspace, and now want to associate it with the SVN repository.

我的硬盘上有一个 eclipse 项目,这是最近从 SVN 存储库中检出的。我已将此项目导入到我的 Eclipse 工作区,现在想将它与 SVN 存储库相关联。

How do I do this? The only options I seem to have under Right-click -> Team is "Share Project", which only seems to allow me to do an initial import.

我该怎么做呢?我似乎在右键单击-> 团队下唯一的选项是“共享项目”,它似乎只允许我进行初始导入。

Edit: Motivation - It's a largish repository, and I don't really want to have to import the whole thing over the network.

编辑:动机 - 这是一个较大的存储库,我真的不想通过网络导入整个内容。

Edit 2:There are (for some reason) no .svn dirs in the project. So maybe a fresh import from svn is the only option

编辑 2:(出于某种原因)项目中没有 .svn 目录。所以也许从 svn 重新导入是唯一的选择

回答by amarillion

Team->Share projectis exactly what you need to do. Select SVNfrom the list, then click "Next". Subclipsewill notice the presence of .svn directories that will ask you to confirm that the information is correct, and associate the project with subclipse.

Team->Share project正是您需要做的。从列表中选择SVN,然后单击“下一步”Subclipse会注意到 .svn 目录的存在,它会要求您确认信息是否正确,并将项目与subclipse相关联。

回答by Marcus

I just wanted to add that if you don't see Team -> Share project, it's likely you have to remove the project from the workspace before importing it back in. This is what happened to me, and I had to remove and readd it to the workspace for it to fix itself. (This happened when moving from dramatically different Eclipse versions + plugins using the same workspace.)

我只是想补充一点,如果你没有看到 Team -> Share project,很可能你必须在重新导入之前从工作区中删除该项目。这就是发生在我身上的事情,我不得不删除并阅读它到工作区,以便它自行修复。(当使用相同的工作空间从截然不同的 Eclipse 版本 + 插件移动时,就会发生这种情况。)

subclipse not showing "share project" option on project context menu in eclipse

subclipse 未在 Eclipse 中的项目上下文菜单上显示“共享项目”选项

回答by Addy

I came across the same issue. I checked out using Tortoise client and then tried to import the projects in Eclipse using import wizard. Eclipse did not recognize the svn location. I tried shareoption as mentioned in the above posts and it tried to commit these projects into SVN. But my issue was a version mismatch. I selected svn 1.8 version in eclipse (I was using 1.7 in eclipse and 1.8.8 in tortoise) and then re imported the projects. It resolved with no issues.

我遇到了同样的问题。我使用 Tortoise 客户端签出,然后尝试使用导入向导在 Eclipse 中导入项目。Eclipse 无法识别 svn 位置。我尝试了上述帖子中提到的共享选项,并尝试将这些项目提交到 SVN。但我的问题是版本不匹配。我在eclipse中选择了svn 1.8版本(我在eclipse中使用1.7,在tortoise中使用1.8.8),然后重新导入项目。它解决了没有问题。

回答by Kaliappan

I am using Tortoise SVN client. You can alternativley check out the required project from SVN in some folder. You can see a .SVN folder inside the project. Copy the .SVN folder into the workspace folder. Now remove the project from eclipse and import the same again into eclipse. You can see now the project is now associated with svn

我正在使用 Tortoise SVN 客户端。您可以替代地从某个文件夹中的 SVN 检出所需的项目。您可以在项目中看到一个 .SVN 文件夹。将 .SVN 文件夹复制到工作区文件夹中。现在从 eclipse 中删除该项目并将其再次导入到 eclipse 中。您现在可以看到该项目现在与 svn 相关联

回答by srishti singh

Try this- Close the project then open it. It links with svn automatically,if project was checked out from valid svn path.

试试这个 - 关闭项目然后打开它。如果项目是从有效的 svn 路径中检出的,它会自动与 svn 链接。

回答by Zoltán Ujhelyi

In case of SVN servers you have to creating a central repository with all projects. The contents of the repository can be uploaded with the Team/Share command; in case of the Subversive client it automatically runs a commit after the import, so you can upload your files.

对于 SVN 服务器,您必须为所有项目创建一个中央存储库。可以使用 Team/Share 命令上传存储库的内容;如果是 Subversive 客户端,它会在导入后自动运行提交,因此您可以上传文件。

This step cannot be circumvented in any way using a centralized version management system such as SVN.

使用集中式版本管理系统(例如 SVN)无法以任何方式绕过此步骤。

回答by feder

I'm asked this question very frequently, if it's smart to use "Share project..." if a eclipse project has been disconnected from it SVN counterpart in the repository. So, I append my answer to this thread.

我经常被问到这个问题,如果 Eclipse 项目与存储库中的 SVN 对应项断开连接,使用“共享项目...”是否明智。所以,我将我的答案附加到这个线程。

The SVN-Team option "Share project ..." is totally fine for projects that exist in SVN and in your Eclipse workspace, even if the Eclipse project is missing the hidden .svn configuration. You can still connect them. Eclipse SVN-implementation (Subclipse/Subversive) will verify if the provided SVN http(s) source is populated. If yes, all existing files will be copied and linked (checked out in SVN terms) to your very personal Eclipse workspace.

SVN-Team 选项“Share project ...”对于存在于 SVN 和 Eclipse 工作区中的项目完全没问题,即使 Eclipse 项目缺少隐藏的 .svn 配置。您仍然可以连接它们。Eclipse SVN 实现(Subclipse/Subversive)将验证是否填充了提供的 SVN http(s) 源。如果是,所有现有文件将被复制并链接(以 SVN 术语签出)到您非常个人的 Eclipse 工作区。

Word of caution:

注意事项:

  • Do a backup if you depend on you local files. The SVN implementation may vary its behaviour with every release.
  • If you have multiple projects encapsulated within each other, make sure you point the SVN path to the correct local path.
  • 如果您依赖本地文件,请进行备份。SVN 实现可能会随每个版本而改变其行为。
  • 如果您有多个相互封装的项目,请确保将 SVN 路径指向正确的本地路径。

regards, Feder

问候,费德