AP257
AP257

Reputation: 529

Mercurial in Windows doesn't see .hgignore - why?

Windows fails to pick up my .hgignore file. I'm running Mercurial from the command line, and "hg status" shows lots of files in the ignored directories.

The .hgignore file looks like this (there's no whitespace at the start of the file, or at the start of each line). I've put it in the root directory of the repository.

\.pyc$
\.pyo$
\.DS_Store
\.Python
\.installed.cfg
^bin$
^build$
^develop-eggs$
^eggs$
^include$
^lib$
^parts$
^pip-log.txt$
^web/localsettings.py$

I've tried saving the file in ANSI and UTF-8, and it doesn't seem to make a difference.

I know the file is working OK on Linux, is there anything different about the paths in Windows?

Upvotes: 4

Views: 3810

Answers (4)

Aulimaitar
Aulimaitar

Reputation: 158

Also, be aware of this: Even if Mercurial is picking up your new .hginore file, it won't necessarily ignore all the specified files! Any file that had previously been added to the repository will NOT be ignored until you explicitly remove it from the repository.

Upvotes: 1

SuperPython
SuperPython

Reputation: 1017

  • First, the .hgignore file must be in the root of your repository
  • Then, you must specify the used syntax at the first line of your .hgignore file (in your case, regexp):

syntax: regexp

Upvotes: 0

Samuel Meacham
Samuel Meacham

Reputation: 10425

If the .hgignore file is in your user profile directory (%userprofile%/.hgignore), then edit your mercurial.ini (which should also be in your user profile folder) to have this:

[ui]
ignore = %USERPROFILE%/.hgignore

That will cause hg to recognize and use your .hgignore file. The .hgignore file in your user profile directory will affect hg's behavior for all repositories. If you want to have specific per-repository settings, you should be able to put .hgignore files in the root of each repository.

Upvotes: 16

Derek Slager
Derek Slager

Reputation: 13851

"hg status" shows lots of files in the ignored directories

Are you referring to .DS_Store and .Python exclusively? The rule for ^bin$ will only ignore entries with that exact string. It will not, for example, ignore "bin/a.out".

The only other thing I could think of is if there is some global setting that sets the syntax to glob (as opposed to the default of regex) hiding somewhere. I'm not aware of any such thing, and it certainly isn't on by default if installing an official binary version of Mercurial.

Upvotes: -3

Related Questions