Mercurial:一些与.hgignore有关的问题 [英] Mercurial: a few questions all related to .hgignore

查看:112
本文介绍了Mercurial:一些与.hgignore有关的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用.hgignore文件已经很长时间了,它很好,最近又添加了一种新的文件类型来忽略.当运行汞状态"时,我注意到了这一点:

M .hgignore

因此Mercurial认为.hgignore是需要跟踪的文件(如果它是项目的根目录).

现在我已经阅读了各种文档,但是我的要点并未得到特别解决,因此这里有一些非常详细的问题,希望可以帮助我弄清楚(很高兴有人回答可以引用并解决这三点[甚至并为每个问题简单回答是/否")):

  • .hgignore应该位于项目的根目录吗? (我想应该可以看到开发人员可以从事多个项目,而每个项目都有不同的.hgignore要求)

  • 可以忽略.hgignore是Mercurial吗?

  • 如果可以忽略,则Mercurial应该忽略 .hgignore(与上一个问题不同)

.hgignore不应忽略的情况下,如果使用了一个很旧且不完整的.hgignore时突然突然回滚,会不会发生一些真正坏的事情? /p>

我认为我看到某些基于用户的IDE项目文件(我并不是说所有IDE项目文件仅针对每个用户,但绝对是某些用户)发生了奇怪的事情,但是这些用户却被忽略了.回滚到一个旧版本,在该版本中使用了旧的.hgignore,然后突然提交了应该被忽略的文件,因为旧的.hgignore没有排除这些文件.

解决方案

您通常不会忽略.hgignore文件,因为您希望它成为存储库的一部分,因此所有用户最终都会使用它.

就回滚然后意外提交文件,您不应该-嗯,无论如何这确实可能发生.负责任地承诺.

对于您的其他问题:

  • 是的,.hgignore应该位于存储库的根目录.
  • 是的,.hgignore可以忽略自身.
  • 不,.hgignore不应该被忽略(除非您决定不想在存储库中使用它.)

I've been working for a long time with a .hgignore file that was fine and recently added one new type of files to ignore. When running "hg status", I noticed this:

M .hgignore

So Mercurial considers the .hgignore to be a file that needs to be tracked (if it's a the root of the project).

Now I've read various docs but my points weren't specifically adressed so here are some very detailed questions which hopefully can help me figure this out (it would be great is someone answering could quote and address these three points [even with a simply yes/no answer for each question]):

  • Should .hgignore be at the root of the project? (I guess it should, seen that a developer can potentially be working on several projects which would all have different .hgignore requirements)

  • Can .hgignore be ignored be Mercurial?

  • If it can be ignored, should .hgignore be ignored by Mercurial (which is different than the previous question)

In the case where .hgignore should not be ignored, can't some really bad thing happens if you suddenly rollback way earlier, when a really old and incomplete .hgignore was used?

I think I saw weird things happening with certain per-user IDE project files (I'm not saying all IDEs project files are per-user only, but some definitely are) that were supposed to be ignored, but then the user rolls back to an old version, where an old .hgignore gets used, and then suddenly files supposed to be ignored are committed because the old .hgignore didn't exclude these.

解决方案

You don't generally ignore the .hgignore file because you want it to be part of the repository so all of your users end up with it.

As far as rolling far back and then accidentally committing files you shouldn't - well, that really could happen at any point anyway. Commit responsibly.

To your other questions:

  • Yes, .hgignore should be at the root of the repository.
  • Yes, .hgignore can ignore itself.
  • No, .hgignore should not be ignored (unless you decide you don't want it in the repository).

这篇关于Mercurial:一些与.hgignore有关的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆