hgrc - [defaults] does not apply ignore (-X) to listed files

Issue #2292 wontfix
Aaron Jones
created an issue

create a file called test.txt in your repo and add the following to hgrc:

status = -X test.txt
commit = -X test.txt

Although the command-line ensures that test.txt is ignored upon hg status and hg commit, when you view your working directory in thg, it still sees test.txt as dirty and it also commits the file if you choose to commit.

Ideally thg would follow the same convention as the command-line, though perhaps a message should go to the console that states the file is being ignored during the current operation (status or commit)

Comments (7)

  1. Yuya Nishihara

    Maybe it isn't always a good idea to imitate the command behavior.

    FWIW, if you just want to exclude test.txt, you should put .hgignore file or use [ui] ignore = your/local/hgignore. [defaults] section is not recommended now.

  2. Aaron Jones reporter

    In my scenario, the local file being changed is already under version control, so [ui] hgignore is not working. [defaults] allows for ignoring a file upon commit/status (-X) even if it is under version control. if defaults is no longer recommended, perhaps there is a better way to achieve my desired results which I have not found in my substantial googling on the subject.

  3. Yuya Nishihara

    If test.txt is a config or data file, I'll exclude it from version control, and put test.txt.tmpl or test.txt.sample instead.

    If the modifications are temporary hack, I prefer to use MQ.

  4. Steve Borho

    See also the auto-exclude list in the commit page of the settings tool. it will automatically uncheck those files when the status and commit tools are opened.

  5. Log in to comment