Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial .hgignore frustration

I have a RE checker that says this should work. What am I doing wrong?!?

Example of what I am trying to ignore:

apps/cms/templates/cms/test_bup_DEPRECATED/widgets/page_link.html

And my .hgignore file:

syntax: regexp
^static
.*_DEPRECATED.*

I have tried all sorts of things and no success :(

Another failed attempt:

syntax: glob
_DEPRECATED/*

UPDATE: I edited the .hgignore file to this:

syntax: glob
**_DEPRECATED/**

But hg st still doing this:

$ hg st | grep DEPR
A apps/cms/templates/cms/test_DEPRECATED/base.html

Same result for this:

syntax: glob
_DEPRECATED
like image 799
Drew Nichols Avatar asked Oct 21 '25 14:10

Drew Nichols


1 Answers

First, .hgignore won't ignore files already tracked by Mercurial. Your example indicates the file is already tracked:

$ hg st | grep DEPR
A apps/cms/templates/cms/test_DEPRECATED/base.html

The file has already been added, but not committed. Use hg forget to forget about the file, and then the ignore pattern will take effect.

.hgignore patterns match any part of the path, so this is all you need:

syntax: regexp
_DEPRECATED/

Note you may want the trailing slash for a directory or it will match files ending in _DEPRECATED as well, otherwise drop it.

To work out ignore patterns, the ignore GUI in TortoiseHg (thg ignore) is very helpful. It displays all files not tracked and not ignored, and patterns can be entered until the right files are ignored.

like image 140
Mark Tolonen Avatar answered Oct 26 '25 18:10

Mark Tolonen