[PATCH] handle relative paths for hgrc's ignore files

Greg Ward greg-hg at gerg.ca
Tue Jun 1 14:33:34 CDT 2010


On Tue, Jun 1, 2010 at 1:17 PM, Roger Pate <roger at qxxy.com> wrote:
> # HG changeset patch
> # User Roger Pate <roger at qxxy.com>
> # Date 1275411353 14400
> # Node ID abcaddaadfc893794166c9d4dcd7a8c0d5238e82
> # Parent  c61442f6d106ae2b91672898715e0fee26eeb54d
> handle relative paths for hgrc's ignore files

Good idea.  I have wanted this myself on occasion.

> --- a/doc/hgrc.5.txt    Mon May 31 13:47:51 2010 +0200
> +++ b/doc/hgrc.5.txt    Tue Jun 01 12:55:53 2010 -0400
> @@ -836,12 +836,14 @@
> +    [...] Relative paths
> +    are resolved from the repository root, so to specify a file in the
> +    same directory as ``.hg/hgrc``, you can set ``ignore =
> +    .hg/hgignore2``.

...but I'm not sure I like this.  If I edit .hg/hgrc and put a
reference to my-ignore-patterns, then I expect hg to read
.hg/my-ignore-patterns.  I.e. if a config file has a relative path, it
should be resolved relative to that config file.

Hmmm... if you take that far enough, then ignore files in ~/.hgrc
should be relative to my home directory.  On reflection, that still
feels right to me.  If I understand your patch correctly, a ui.ignore
setting in ~/.hgrc would mean different things in different places.
That feels wrong.  But it would require throwing out your existing
patch and trying again.

So... what does everyone else feel?  I think the options are:

1) status quo: ui.ignore is relative to current dir, meaning only
absolute paths are useful
2) Roger's idea: ui.ignore is relative to repo root, meaning a
ui.ignore setting in ~/.hgrc means different things in different
places
3) my idea: ui.ignore is relative to the config file, making the
implementation harder

Oh, you should probably add your test to test-hgignore rather than
adding a new test script.

Thanks for the patch!

Greg


More information about the Mercurial-devel mailing list