Mercurial汞状态显示忽略的文件

Mercurial汞状态显示忽略的文件

本文介绍了Mercurial汞状态显示忽略的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我为什么Mercurial会显示"hg status"命令的忽略文件?

Can anyone tell me why mercurial is displaying ignored files for the 'hg status' command?

这是确认,Mercurial确实忽略了文件:

Here's the confirmation that mercurial is indeed ignoring the files:

$ hg addremove
$ hg commit
nothing changed

现在,看看状态输出.我在上面几行之后立即运行了此命令. (部分打印,删除了可识别的文本)

Now, have a look at the status output. I ran this immediately after the lines above. (Prinout is partial, with identifiable text removed)

$ hg status
? Core/target/Core-0.0.1-SNAPSHOT-tests.jar
? Core/target/Core-0.0.1-SNAPSHOT.jar
? Core/target/classes/META-INF/MANIFEST.MF
? Core/target/classes/xxx/yyy/zzz/X.class
? Core/target/classes/xxx/yyy/zzz/XBackup.class
? Core/target/classes/xxx/yyy/zzz/XBackupInput.class
? Core/target/classes/xxx/yyy/zzz/XBackupOutput.class
? Core/target/classes/xxx/yyy/zzz/XImpl$GetResultsAndStatistics.class
? Core/target/classes/xxx/yyy/zzz/XImpl$MonitoringMode.class
? Core/target/classes/xxx/yyy/zzz/XImpl$UpdateMode.class
? Core/target/classes/xxx/yyy/zzz/XImpl.class
? Core/target/classes/xxx/yyy/zzz/XIsFullException.class
? Core/target/classes/xxx/yyy/zzz/XSource.class
? Core/target/classes/xxx/yyy/zzz/XUsageException.class
? Core/target/classes/xxx/yyy/zzz/CheckResults.class
? Core/target/classes/xxx/yyy/zzz/Noise.class
? Core/target/classes/xxx/yyy/zzz/core/DateTimeGenerator$TemporalMeasure.class
? Core/target/classes/xxx/yyy/zzz/core/DateTimeGenerator.class
? Core/target/classes/xxx/yyy/zzz/core/LoggingConfigurator.class
? Core/target/classes/xxx/yyy/zzz/core/ManagedIterator.class
? Core/target/classes/xxx/yyy/zzz/core/NetworkUtils.class
? Core/target/classes/xxx/yyy/zzz/core/StackTraceUtils.class
? Core/target/classes/xxx/yyy/zzz/core/Summarisable.class
? Core/target/classes/xxx/yyy/zzz/core/TimingUtils.class
? Core/target/classes/xxx/yyy/zzz/core/XMLStaticStringUtils.class
? Core/target/classes/xxx/yyy/zzz/core/Zipper.class
...

状态打印输出中显示了大约一千行这些被忽略的文件;那是个严重的问题.

There's something like a thousand lines of these ignored files showing in the status printout; that's some serious guff.

我该如何摆脱呢?

谢谢

更新:

这是我的.hgignore文件.

Here's my .hgignore file.

syntax:glob
.metadata*

syntax:regexp
^target.*$
^[^/]*/target.*$
^[^/]*/[^/]*/target.*$
^bin.*$
^[^/]*/bin.*$
^[^/]*/[^/]*/bin.*$

更新:

修改后的正则表达式*->.*

Modified regexps a wee bit * -> .*

推荐答案

非常感谢大家的帮助.我没有找到问题的答案,但是我确实找到了解决该问题的方法.因此,我假设在修改hgignore正则表达式时,mercurial有时会混淆并破坏其内部数据……或其他东西.我不了解足够多的内部人员来知道这可能是什么.

Many thanks for everyone's help on this. I haven't found an answer to the problem but I did find a workaround that got rid of it. So I'm assuming that at some point when modifying the hgignore regexps mercurial got confused and corrupted it's internal data... or something. I don't know enough internals to know what this could have been.

无论如何,如果您发现自己在同一条船上,这就是我所做的:

Anyway, should you find yourself in the same boat, here's what I did:

  1. 请确保您的.hgignore文件说出了您想要的内容,并且所有处于hg状态的文件都是您要忽略的文件.
  2. 添加所有要忽略的文件. hg addremove不起作用,因为它确实遵守了hgignore的内容,因此我使用了Eclipse的hg插件,并手动完成了每个文件(嗯,我选择了所有文件,然后Eclipse分别将添加内容应用于了它们).
  3. 还原所有添加的文件.我使用以下内容是因为我在linux上. (多亏了另外一个关于SO的单独问题的发帖人-不幸的是,现在我再也找不到了)

  1. Make sure your .hgignore file says what you want it to and that all the files turning up in the hg status are the ones you want to ignore.
  2. Add all the files to be ignored. hg addremove doesn't work because it does honour the hgignore contents, so I used Eclipse's hg plugin and did each file manually (well, I selected them all and Eclipse applied the add to them all individually).
  3. Revert all added files. I used the following because I'm on linux. (thanks to another poster on a separate question here on SO - which I can now no longer find unfortunately)

汞状态-an0 | xargs -0 hg恢复

hg status -an0 | xargs -0 hg revert

重复上述步骤,直到不再起作用.在我的情况下,有时最多可以连续进行3次还原! (不知道它实际上在做什么:(()

repeat the above step until it no longer works. In my case this was sometimes up to as many as 3 reverts in a row! (No idea what it was actually doing though :( )

现在您应该不再在hg状态输出中看到被忽略的文件.

You should now no longer see the ignored files in the hg status output.

对不起,我不知道为什么会这样,或者最初的问题是什么.如果有人这样做,我很想知道您的想法.

I'm sorry, I have no idea why this worked, or what the original problem was. If anyone does, I'd be very interested to know your thoughts.

再次感谢大家:)

这篇关于Mercurial汞状态显示忽略的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 20:04