为什么我的hgignore看起来不起作用?

时间:2012-10-30 05:58:08

标签: mercurial

当我hg status时,我看到了:

[jiewmeng@JM Code]$ hg status
M examples/SampleTestingSolution/EmptyGeneralTesting/Debug/SPA.lib
M examples/SampleTestingSolution/EmptyGeneralTesting/Debug/UnitTesting.exe
M examples/SampleTestingSolution/EmptyGeneralTesting/Debug/UnitTesting.ilk
M examples/SampleTestingSolution/EmptyGeneralTesting/Debug/UnitTesting.pdb
M examples/SampleTestingSolution/EmptyGeneralTesting/EmptyGeneralTesting.suo
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/AST.obj
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/CL.read.1.tlog
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/CL.write.1.tlog
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/DesignExtractor.obj
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/Lib-link.read.1.tlog
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/Lib-link.write.1.tlog
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/Node.obj
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/PKB.obj
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/Parser.obj
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/Query Evaluator.obj
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/Query Processor.obj
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/SPA.Build.CppClean.log
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/SPA.lastbuildstate
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/SPA.log
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/VarTable.obj
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/cl.command.1.tlog
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/lib.command.1.tlog
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/vc100.idb
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/vc100.pdb
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/SPA.vcxproj
M examples/SampleTestingSolution/EmptyGeneralTesting/SPA/SPA.vcxproj.filters
M examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/Debug/CL.read.1.tlog
M examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/Debug/CL.write.1.tlog
M examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/Debug/NodeTest.obj
M examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/Debug/UnitTest.obj
M examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/Debug/UnitTesting.lastbuildstate
M examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/Debug/UnitTesting.log
M examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/Debug/cl.command.1.tlog
M examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/Debug/link.command.1.tlog
M examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/Debug/link.read.1.tlog
M examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/Debug/link.write.1.tlog
M examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/Debug/mt.command.1.tlog
M examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/Debug/mt.read.1.tlog
M examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/Debug/mt.write.1.tlog
M examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/Debug/vc100.idb
M examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/Debug/vc100.pdb
M examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/source/UnitTest.cpp
M examples/SampleTestingSolution/EmptyGeneralTesting/source/Parser.cpp
M examples/SampleTestingSolution/EmptyGeneralTesting/source/Parser.h
A .hgignore
? examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Debug/SPA.write.1.tlog
? examples/SampleTestingSolution/EmptyGeneralTesting/SPA/Parser.h
? examples/SampleTestingSolution/EmptyGeneralTesting/UnitTesting/Debug/UnitTesting.write.1.tlog

所以我让.hgignore看起来像

syntax: glob

*.lib
*.tlog
*.log
*.obj
*.tlog
*.idb
*.pdb
*.exe
*.ilk
*.filters

当我再次进入hg状态时,我看到输出中有类似/不明显的差异。为什么?我期望所有这些都从hg status

消失

1 个答案:

答案 0 :(得分:5)

如果您已添加这些文件,则需要" hg forget"他们在申请hgignore指令之前 请参阅" What is the difference between hg forget and hg remove?":hg remove -Af(即hg forget)将删除它们而不将其从工作目录中删除。
另请参阅this thread

  

未跟踪的文件会在&{39; hg status'中显示问号,除非它们与.hgignore文件匹配。