用于 Eclipse 和 Android 开发的 Mercurial 忽略文件
我见过 Mercurial 忽略 Visual Studio 等文件的示例。
我刚刚开始尝试 Android 开发,我也利用这段时间尝试 Mercurial。 所以我的问题是:有没有人有一个用于 Eclipse 和 Android 开发的 .hgignore
文件的好示例?
对于初学者,我自己有以下内容:
# use glob syntax
syntax: glob
# Ignore patterns
.metadata\
bin\
gen\
有吗任何其他应该包含的忽略模式?例如,Eclipse 文件 .classpath
和 .project
是否也应该从版本控制中省略?
-- 在下面编辑 --
我还没有完全得到我所希望的答案,所以我将提供赏金并尝试更清楚地指定我正在寻找的内容。
经过我自己的尝试,我似乎发现上面列出的建议的 .hgignore
似乎就足够了。我所做的唯一添加是一行 .settings
(这是我运行 Android Tools -> Fix Project Properties 后出现的一个文件夹)。我还发现(正如 Ry4an 所提到的)Eclipse 文件 .classpath
和 .project
不应该被排除。
然而,当我处理比基本教程稍大一点的项目时,我不确定这个小忽略文件是否足够(如果它实际上很好,请解释原因,您将获得荣誉)。总结一下我正在寻找的内容:
- 我想要一个 Eclipse 下 Android 项目的
.hgignore
文件的具体示例 - 忽略文件应该是这样,以便每当我在以下位置查看存储库的副本时:一个新位置,它应该立即工作(即不必弄乱路径和引用,添加丢失的文件等)。
- 还请解释为什么你的包含文件看起来像这样(我想了解为什么某些文件/目录被排除(以及为什么肯定应该包含某些文件/目录))
- 如果您包含操作系统特定的排除项,请同时说明(顺便说一句,我在 Windows 7 上运行。)
I have seen samples for Mercurial ignore files for Visual Studio, amongst others.
I've just started playing around with Android development, and I also use this time to experimenting with Mercurial. So my question is: does anyone have a good example of a .hgignore
file to use for Eclipse and Android development?
For starters I've got the following myself:
# use glob syntax
syntax: glob
# Ignore patterns
.metadata\
bin\
gen\
Are there any other ignore patterns that should be included? Should for instance the Eclipse files .classpath
and .project
be omitted from version control as well?
-- Edit below --
I haven't quite gotten the answers I hoped for yet, so I'll put out a bounty and try to specify a bit clearer what I'm looking for.
After experimenting a bit myself, I seem to have found that the suggested .hgignore
listed above seems to be sufficient. The only addition I've made, is one line with .settings
(this was a folder that appeared after I ran Android Tools -> Fix Project Properties). I've also found that (as mentioned by Ry4an) that the Eclipse files .classpath
and .project
should not be excluded.
I am however uncertain that this small ignore file will be sufficient when I get to projects a bit bigger than the basic tutorials (if it actually is all good, please explain why, and you'll get the credit). So to summarize what I'm looking for:
- I want a concrete example for a
.hgignore
file for an Android project under Eclipse - The ignore file should be so that whenever I check out a copy of the repository at a new location, it should work straight away (i.e. without having to mess with paths and references, add missing files etc.)
- Please also explain why your include file looks like it does (I want to understand why certain files/directories are excluded (and why some definitely should be included))
- If you include OS specific excludes, please also state so (I'm running on Windows 7 btw.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
绝对应该添加 eclipse 文件。一般准则是添加:
最后一个是您的判断所在。它显然不包括您自己构建的 .jar 文件和最终的 .apk ,但它包含您使用的第三方 .jar 吗?有些人确实包含它们,但更好的是包含依赖管理器(如“ivy”)的配置文件,它可以让下一个构建器自动下载他们需要的需求。
在我选择的工具中自动创建项目后,我只需执行如下命令:
它将所有未知文件的列表添加到 .hgignore。然后我进去并删除我想要保存的东西(例如:.project)和将增长兄弟姐妹的通配符文件(例如:**.class)
The eclipse files should definitely be added. The general guideline is to add:
That last one is where your judgement comes in. It clearly excludes the .jar files you build yourself and your final .apk, but does it include third party .jar's you use? Some people do include them, but better is to include a configuration file for a dependency manager like 'ivy' which lets the next builder download the requirements they need automatically.
After auto-creating a project in my tools of choice, I'll just do a command like this:
which adds the list of all unknown files to .hgignore. Then I go in and remove things I wants saved (ex: .project) and wildcard files that will grow siblings (ex: **.class)
有一个非常好的 Android 示例 .hgignore,位于 http://androidfragments.blogspot.com/2011/ 11/hgignore-for-android.html
There's a very nice sample .hgignore for Android at http://androidfragments.blogspot.com/2011/11/hgignore-for-android.html
这是我的 hgignore:
它是否好是一个单独的问题
Here is my hgignore:
Whether it's a good one or not is a separate issue
好吧,如果它的 android 项目比
local.properties 也应该被忽略
well if its android projects than
local.properties should also be ignored
我找到了 .hgignore 的一个很好的例子。这对我有用。
来源:http://androidfragments.blogspot.ru/2011/11/hgignore -for-android.html
I have found a good example of .hgignore. It works for me.
Source: http://androidfragments.blogspot.ru/2011/11/hgignore-for-android.html