regexmercurialhgrc

Mercurial - User Specific Ignore file


I am trying to get mercurial to ignore hidden files for a specific user. I used the directions here:

How to make mercurial ignore all hidden files?

and got it to ignore files in a specific repo. I want to extend this behavior to all hg repos for a specific user.

The hgrc man page says you can link a user specific ignore file (e.g., ~/.hgignore) by including something like this in your ~/.hgrc:

[ui]
username = Some User <user@email.com>
ignore = ~/.hgignore

but that doesn't seem to be working.

I have also tried

ignore = /home/someuser/.hgignore
ignore = $HOME/.hgignore
ignore = ~/.hgignore2

But that doesn't seem to be working either. Am I missing something? I can't find anything on the Mercurial site or anywhere else. Please help, thanks.

**EDIT - I am on Linux. hg showconfig indicates that hg is reading my .hgrc file correctly, the ignore behavior outlined therein is not working though.

**EDIT2 - I also tried restarting my machine, just to see if that would update things. It did not.


Solution

  • You don't need to specify ~/.hgignore. It is automatically applied after system hgignore and before repo hgignore.

    I use many ignore files in ~/.hgrc without problem with hg 1.5 on linux.

    [ui]
    ignore = /home/geoffz/bin/hgext/hgignore
    ignore.local = /home/geoffz/bin/hgext/hgignore.local
    ignore.java = /home/geoffz/bin/hgext/hgignore.java
    

    Create a trivial repo with a few files you want to ignore, setup your ignore entries, and do hg st -A. If those files are shown as ? and not I, then you have a serious problem in your hg/linux setup.