version-controlmercurialdvcshgignore

hg local ignore


I could have sworn there was a way to keep a local ignore file in an hg repo, i.e. a file similar in function to .hgignore, but not checked into the repo. This could be used to ignore changes to an IDE project file if different IDEs are being used, for example. I'm having trouble finding how it's done. Does anyone recall the details?


Solution

  • This is what I was looking for.

    Add the following to the repo's .hg/hgrc:

    [ui]
    ignore = /path/to/repo/.hg/hgignore
    

    and create a new file .hg/hgignore beside it. This new file will be untracked, but work the same as the versioned .hgignore file for this specific working copy. (The /path/to/repo bit is unfortunate but necessary to make it work when invoking 'hg' from within a subdir of the repo.)