用于 Eclipse 和 Android 开发的 Mercurial 忽略文件

发布于 2024-09-18 06:14:00 字数 1228 浏览 10 评论 0原文

我见过 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 技术交流群。

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

发布评论

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

评论(5

半寸时光 2024-09-25 06:14:00

绝对应该添加 eclipse 文件。一般准则是添加:

  • 手写/键入的所有内容
  • 构建项目所需的所有其他内容的最小子集

最后一个是您的判断所在。它显然不包括您自己构建的 .jar 文件和最终的 .apk ,但它包含您使用的第三方 .jar 吗?有些人确实包含它们,但更好的是包含依赖管理器(如“ivy”)的配置文件,它可以让下一个构建器自动下载他们需要的需求。

在我选择的工具中自动创建项目后,我只需执行如下命令:

hg status --unknown --no-status >> .hgignore

它将所有未知文件的列表添加到 .hgignore。然后我进去并删除我想要保存的东西(例如:.project)和将增长兄弟姐妹的通配符文件(例如:**.class)

The eclipse files should definitely be added. The general guideline is to add:

  • everything that is hand written/typed
  • the minimal subset of everything else necessary to build the project

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:

hg status --unknown --no-status >> .hgignore

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)

蓝梦月影 2024-09-25 06:14:00

有一个非常好的 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

等数载,海棠开 2024-09-25 06:14:00

这是我的 hgignore:

syntax: regexp
\.DS_Store
.swo
.swp
.metadata/
/bin/

它是否好是一个单独的问题

Here is my hgignore:

syntax: regexp
\.DS_Store
.swo
.swp
.metadata/
/bin/

Whether it's a good one or not is a separate issue

冷情妓 2024-09-25 06:14:00

好吧,如果它的 android 项目比

local.properties 也应该被忽略

well if its android projects than

local.properties should also be ignored

爱的故事 2024-09-25 06:14:00

我找到了 .hgignore 的一个很好的例子。这对我有用。

#Mercurial Ignore Rules for Android
#Save as .hgignore in the repository base directory and add it to source control.
syntax: glob
*.class
*.apk
*.dex
*.ap_
*.suo

syntax: regexp
^(.*[\\/])?gen[\\/].*
^(.*[\\/])?bin[\\/].*
^(.*[\\/])?obj[\\/].*
^(.*[\\/])?log[\\/].*
^(.*[\\/])?obf[\\/].*
^(.*[\\/])?jars[\\/].*
^(.*[\\/])?jar-sources[\\/].*
^(.*[\\/])?javadoc[\\/].*
^(.*[\\/])?\.svn[\\/].*
^(.*[\\/])?\.metadata[\\/].*
^(.*[\\/])?\.settings[\\/].*

来源:http://androidfragments.blogspot.ru/2011/11/hgignore -for-android.html

I have found a good example of .hgignore. It works for me.

#Mercurial Ignore Rules for Android
#Save as .hgignore in the repository base directory and add it to source control.
syntax: glob
*.class
*.apk
*.dex
*.ap_
*.suo

syntax: regexp
^(.*[\\/])?gen[\\/].*
^(.*[\\/])?bin[\\/].*
^(.*[\\/])?obj[\\/].*
^(.*[\\/])?log[\\/].*
^(.*[\\/])?obf[\\/].*
^(.*[\\/])?jars[\\/].*
^(.*[\\/])?jar-sources[\\/].*
^(.*[\\/])?javadoc[\\/].*
^(.*[\\/])?\.svn[\\/].*
^(.*[\\/])?\.metadata[\\/].*
^(.*[\\/])?\.settings[\\/].*

Source: http://androidfragments.blogspot.ru/2011/11/hgignore-for-android.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文