[PATCH] Check for .hgrc files in ancestor directories above the repository

Matt Mackall mpm at selenic.com
Sun Jan 13 14:25:20 CST 2008


On Sun, 2008-01-13 at 15:08 -0500, Jesse Glick wrote:
> Matt Mackall wrote:
> > there's a much bigger problem with this approach: we've just spent a 
> > lot of work making hgrc files get read before we actually open a 
> > repository. This lets us localize extensions to particular
> > repositories, etc.
> 
> I see. Too bad, unless you would find the following algorithm acceptable 
> (patch on request):
> 
> 1. If no *@* sections, exit.
> 
> 2. If .hg/identity exists, try to read it and if matches a *@* section, 
> apply. Whether it matches or not, exit. If read fails, continue silently.
> 
> 3. Open changelog index, read 0-rev hash, close. If any I/O error, warn 
> and exit.
> 
> 4. If matches a *@* section, apply.
> 
> 5. Try to write .hg/identity~ and rename to .hg/identity (i.e. atomic 
> operation). If I/O error, ignore silently.
> 
> I don't think any extensions would have anything to influence in step 
> #3,

Bzzt. Imagine an extension that lets you access a remote store. You
know, that incredibly slow and painful feature that people are always
whinging about bzr having? Totally easy to do in an extension.

> nothing would happen unless you actually used clone defaults, and 
> the cost of the extra open would happen only once per clone unless it is 
> not writable. That cost on my laptop is around 30 msec on a "cold" 
> repository down to as little as 3 msec on a "warm" repository, for
> 
>    hex(changelog.changelog(self.sopener).node(0))

How big is your index?

> > I wasn't particularly convinced by the arguments against it.
> 
> I had suggested previously that includes could be skipped if they were 
> tracked by an enclosing repo,

I had forgotten the enclosing repo case, that's an excellent
counter-argument.

> "Read hgrcinclude files from ancestor directories of the repository if 
> they are readable and owned by a trusted user and not themselves inside 
> any repository, or .hg/hgrcinclude files from ancestor directories if 
> readable and trustable."

Eek. People are already plenty confused by hgrc trust issues without
having to wrap their brains around that. And what happens if my ~ is
under hg?

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list