Jiew Meng
Jiew Meng

Reputation: 88189

Why my hgignore does not appear to work?

When I do hg status I see:

[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

So I made .hgignore look like

syntax: glob

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

When I do hg status again, I see a similar/non noticeable difference in output. Why? I expected all those to be gone from hg status

Upvotes: 1

Views: 210

Answers (1)

VonC
VonC

Reputation: 1323095

If you have already added those files, you need to "hg forget" them before seing the hgignore directives applied.
See "What is the difference between hg forget and hg remove?": hg remove -Af (ie hg forget) will remove them without deleting them from the working directory.
See also this thread:

Un-tracked files show up with a question mark in 'hg status', unless they are matched by the .hgignore file.

Upvotes: 5

Related Questions