一个 Mercurial 存储库中的多个 Eclipse 项目
我有许多 Eclipse 项目,我想将它们放在两个单独的 hg 存储库中。
我已经成功地做到了这一点,首先使用 TortouiseHg 创建两个 hg 存储库,然后添加、提交我的项目到每个存储库。通过这样做,我现在有两个 hg 存储库,每个存储库中有两个项目。
接下来,我使用 MercurialEclipse 在 Eclipse 中克隆该存储库。这些项目在 Eclipse 中按预期显示。
示例 1:
Eclipse workspace
|
|--Project 1
|--Project 2
|--Project 3
|--Project 4
但是如果我查看目录结构,它看起来像这样:
示例 2:
c:--
|
|-workspace
|
hgRepository1
| |--.hg
| |--Project 1
| |--Project 2
|
|
hgRepository2
|--.hg
|--Project 3
|--Project 4
当我希望它看起来像这样时。
示例 3:
c:--
|
|-workspace
|--.hg
|--Project 1
|--Project 2
|--Project 3
|--Project 4
是否可以拥有一个 Mercurial 存储库并以某种方式克隆它,并使项目直接出现在工作区目录下,而不是出现在子目录中?
I have a number of eclipse projects that I'd like to have in two separate hg repositories.
I've managed to do this by first creating the two hg repository using TortouiseHg and adding, committing my projects to each of the repositories first. By doing that I now have two hg repositories with two projects in each.
Next I clone that repositories in Eclipse using MercurialEclipse. The projects appear as expected in Eclipse.
Example 1:
Eclipse workspace
|
|--Project 1
|--Project 2
|--Project 3
|--Project 4
But if I look in the directory structure it looks like this:
Example 2:
c:--
|
|-workspace
|
hgRepository1
| |--.hg
| |--Project 1
| |--Project 2
|
|
hgRepository2
|--.hg
|--Project 3
|--Project 4
when I want it to look like this.
Example 3:
c:--
|
|-workspace
|--.hg
|--Project 1
|--Project 2
|--Project 3
|--Project 4
Is it possible to have a single Mercurial repository and somehow clone it and have the projects appear directly under workspace directory, and not in a subdirectory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您不应从 Eclipse 工作区保存项目,也不应在 Eclipse 工作区中恢复它们。
这些项目(
.project
、.classpath
和 其他项目特定资源)应该位于 Eclipse 工作区之外的自己的目录中(然后导入到工作区)。这样,任何目录结构都可以将不同的项目导入到新的 Eclipse 工作区中。
You shouldn't save project from an Eclipse workspace, or restore them in an Eclipse workspace.
Those projects (
.project
,.classpath
, and other project specific resources) should be in their own directory, outside of the Eclipse workspace (and then imported into the workspace).That way, any directory structure will be fine for importing the different project into a new Eclipse workspace.
我自己就遇到了这个问题,而且解决方案并不是立即显而易见的。这篇博客文章有分步说明,展示了如何实现您所追求的目标:工作流程:使用 HgEclipse (Mercurial) 创建并初始化多项目存储库。
简而言之,您想要:
您会发现最终在 Eclipse 中得到了您想要的布局,并且所有项目都将共享位于项目文件夹中的存储库。
I ran into this exact problem myself, and the solution isn't immediately obvious. This blog post has step-by-step instructions showing how to achieve what you're after: workflow: create and init multi-project repositories with HgEclipse (Mercurial).
In short, you want to:
You'll find you end up with the layout you want in Eclipse and the projects will all share the repository located in projects-folder.
我不太明白。您无法将存储库克隆到其自身内部。为什么不能直接制作 Project1 和 Project2 的硬拷贝,创建 3 和 4?
I don't quite understand. You cannot clone the repo to inside of itself. Why can't you just make a hard copy of Project1 and Project2, creating 3 and 4?
我知道有些人不喜欢我的解决方案(而且我知道自从提出这个问题以来已经有一段时间了),但它是:
这已在 Linux 上的 Eclipse 的 CDT 中成功测试。我建议您将 Eclipse 创建的文件放入 .hgignore 中来管理您的项目。
我希望这有帮助。
I know some people wont like my solution (and I know that it's been some time since this question has been asked) but here it is:
This has been tested successfully in CDT in Eclipse on linux. And I advise you to put in your .hgignore the files created by Eclipse to manage your projects.
I hope this helps.