Re: .hgignore in subfolders?

1,935 views
Skip to first unread message

Martin Geisler

unread,
Feb 21, 2011, 7:47:39 AM2/21/11
to Stian Østerhaug, merc...@selenic.com
Stian Østerhaug <stian.o...@triona.no> writes:

> Hello,
>
> Is it possible to have .hgignore files in subfolders instead of one
> giant .hgignore for the entire repo?

No, you must collect your patterns at the top of the repository.

How many patterns do you have?

--
Martin Geisler

aragost Trifork
Professional Mercurial support
http://aragost.com/en/services/mercurial/blog/
_______________________________________________
Mercurial mailing list
Merc...@selenic.com
http://selenic.com/mailman/listinfo/mercurial

Dirkjan Ochtman

unread,
Feb 21, 2011, 7:47:10 AM2/21/11
to Stian Østerhaug, merc...@selenic.com
On Mon, Feb 21, 2011 at 13:35, Stian Østerhaug
<stian.o...@triona.no> wrote:
> Is it possible to have .hgignore files in subfolders instead of one giant .hgignore for the entire repo?

It's not (and I'd argue that this is a feature, not a bug).

Cheers,

Dirkjan

Stian Østerhaug

unread,
Feb 21, 2011, 7:35:48 AM2/21/11
to merc...@selenic.com
Hello,

Is it possible to have .hgignore files in subfolders instead of one giant .hgignore for the entire repo?


--
Stian Østerhaug

Dmitry Zanozin

unread,
Feb 21, 2011, 8:08:22 AM2/21/11
to Stian Østerhaug, merc...@selenic.com
21.02.2011 15:35, Stian Østerhaug wrote:
> Hello,
> Is it possible to have .hgignore files in subfolders instead of one giant .hgignore for the entire repo?
> --
> Stian Østerhaug

No. But if you care about a scope of the pattern you can use subfolder
name as a prefix for the pattern, for example:
<my_sub_folder_1>/<my_sub_folder_2>/<my_sub_folder_3>/*.ext
<my_sub_folder_4>/*

Stian Østerhaug

unread,
Feb 21, 2011, 8:01:42 AM2/21/11
to Martin Geisler, merc...@selenic.com
I was just looking at the linux source and saw that git supports it (am I allowed to say git in here?!).

I have one repo for a server app written in python and a client written in java that resides in their own subfolder, and it would be less hassle to maintain two hgignore files. I should probably split it up in two repos.


--
Stian Østerhaug

Mads Kiilerich

unread,
Feb 21, 2011, 7:47:14 AM2/21/11
to Stian Østerhaug, merc...@selenic.com
On 02/21/2011 01:35 PM, Stian Østerhaug wrote:
> Hello,
>
> Is it possible to have .hgignore files in subfolders instead of one giant .hgignore for the entire repo?

No.

That would make it ambiguous which .hgignore applied and we would have
to define (confusing) rules for how multiple .hgignores should be combined.

We also want to avoid the performance overhead of looking for .hgignore
in every folder.

/Mads

Haszlakiewicz, Eric

unread,
Feb 22, 2011, 11:26:16 AM2/22/11
to Mads Kiilerich, Stian Østerhaug, merc...@selenic.com
>-----Original Message-----
>From: mercuria...@selenic.com [mailto:mercuria...@selenic.com]
>
>On 02/21/2011 01:35 PM, Stian Østerhaug wrote:
>> Hello,
>>
>> Is it possible to have .hgignore files in subfolders instead of one giant
>.hgignore for the entire repo?
>
>No.
>
>That would make it ambiguous which .hgignore applied and we would have
>to define (confusing) rules for how multiple .hgignores should be combined.

I figure that the rules would be simple:
A .hgignore in a directory has the path to that directory prepended to all entries.
For any directory, concatenate all the .hgignore files starting from the repository root down to that directory, and process the result normally.

Is that confusing? Or are there some details that I'm overlooking?

>We also want to avoid the performance overhead of looking for .hgignore
>in every folder.

Is that really such a performance impact? Mercurial already needs to read every directory to figure out which files are tracked or not, so looking for extra .hgignore files seems like it would just add N in-memory string comparisons, where N is the total number of files present.
Has anyone actually tried measuring this?

eric

Steve Hollasch

unread,
Feb 25, 2011, 2:47:16 PM2/25/11
to Stian Østerhaug, merc...@selenic.com
> From: Stian ├ÿsterhaug
>
> Is it possible to have .hgignore files in subfolders instead of one giant .hgignore
> for the entire repo?

It would be a very simple matter to write up a script to run through
your tree and aggregate all of your .hgignore file rules into a root
.hgignore file. It does mean that you'd need to run this tool whenever a
sub .hgignore file changed, but perhaps there's an obvious time when
you'd do this. It's not exactly the solution you're looking for, but it
is something you could deploy today.
Reply all
Reply to author
Forward
0 new messages