Mercurial & a global ignore file

So I've been using mercurial for a while now, and each of my repositories has had it's own .hgignore file. After reading the hgrc/mercurial.ini docs I noticed that you can specify an 'ignore' setting in the [ui] section and point it at a file that all repos will use as an ignore file. Great! I only need a single ignore file now. So I set the value to:

ignore = "D:/source/hgignore.txt"

However, when running "hg st" it showed up all the files that should be ignored as missing from the repo. Seems hg wasn't loading the ignore file (and i had removed the file from the repo itself).

Turns out if there is any whitespace at the start of the path mercurial will ignore the file. Changing the line to:

ignore=D:/source/hgignore.txt

allows the ignore file to be read by hg and it correctly ignores the files in my repository.

Comments (3) -

  • I've happy(ish) memories of us trying to make VSS work in a collaborative environment.  It's not the same, is it? Smile

    Can't offer any intelligent comments about Mercurial, I'm afraid.  I used Subversion for a while, but eventually migrated to Git for both work and play.  I'm kind of curious about Mercurial (I gather it's vaguely similar to Git in overall architecture), but am hesitant to investigate as I'm a bit scared of mental overload: I'm not sure how much space I have left in my limited brain for source control tools.
  • Hey Jake! It's been a while! How's things? Smile

    Yeah I do remember our VSS nightmares, and all the locked checkouts etc. Not good.

    I've played a bit with both git and mercurial, and I have to say that they are very similar from the point of view of using them, how they differ under the hood I'm not too sure, but I ended up using Hg as it seems a little more windows friendly (don't need to install some form of cygwin etc.)
  • I'm pretty good, thanks, Matt.  Probably less antipodean than you, though. Smile

    Ah, Windows.  I'd forgotten about that.  Yeah, I suppose using that operating system (must ... not ... insert ... scare ... quotes) might change things a bit.  I seem to remember reading that much of Git was rewritten to be more Windows-friendly not long ago, but I've not used Windows since - at a rough guess - about 2003, so haven't been able to check.  It's very easy to get into the habit of assuming that the entire world is POSIX-compatible; really I suppose that's no better than assuming that the entire world uses Windows.

    So are you storing anything exciting in your version control system?  Hello world?
Comments are closed