/!\ This page is primarily intended for Mercurial's developers.

{i} This page appears to contain material that is no longer relevant. Please help improve this page by updating its content.

Custom Configuration of Sets of Repositories in .hgrc

This page summarizes a lengthy discussion on the developer mailing list. It originated with issue 918: Option to copy some of .hg/hgrc upon local clone.

What's the idea?

One often has several local clones of the same project. Sometimes these clones all require the same extra configuration in their local .hg/hgrc files ([email] to=mercurial-devel@selenic.com for all clones of hg, for instance). It's easy to forget adding that when creating a new clone. The idea now is to:

Obviously, this defines a notion of sets of clones where such extra configuration should apply, as opposed to others where it does not.

Key issues:

Recap Of Discussion Up To Jan 15, 2008

Copy elements from .hg/hgrc on local clone

This was the initial proposal. A repo's .hg/hgrc would contain instructions as to which of its elements to copy over when cloned locally. See issue 918 for details.

This proposal stands apart from the others:

Grouping Mechanisms

We discussed two approaches which both apply extra config to qualifying repositories dynamically. They differ in the selector by which repos are included in a set (grouped):

Definition Of Sets

We discussed:

[sets]
hg = ~/dev/hg/
afc = ~/dev/afc/, /public/repos/afc/ # multiple selectors
nb = glob:/sources/netbeans/*
jdk = re:.*/jdk/.*
jcite = rev0:b626de8b95d1

Note that in the last example, there is no need to support all the listed selector options. And I didn't list the other explicit definition syntax proposals here because this one seems least likely to cause problems with special characters like : in selectors.

Configuration Location

We discussed these approaches for where to keep the extra config:

[defaults@nb]
log = -M

[email@hg]
to = mercurial-devel@selenic.com

[set-configs]
hg = ~/.hgrc-hg, ~/.hgrc-python
afc = ~/.hgrc-java
jcite = ~/.hgrc-java, ~/.hgrc-sourceforge

What Now?

I, Peter Arrenbrecht, favor a first implementation using just:

[sets]
hg = ~/dev/hg/ # path prefix as default and only option for selecting repos
afc = ~/dev/afc/, /public/repos/afc/ # multiple selectors allowed

[set-configs]
hg = ~/.hgrc-hg, ~/.hgrc-python
afc = ~/.hgrc-java
jcite = ~/.hgrc-java, ~/.hgrc-sourceforge

I think Jesse Glick favors the variants using [section@set-name] in ~/.hgrc, but I guess he could accept the above [set] element.

Maxim Dounin thinks introducing sets and section suffixes is overkill, and still suggests much more simple syntax:

[include]
/path/prefix = /path/to/included/config

Where Matt stand now, I have no idea.

Note that my and Jesse's favorites could coexist, but I think that would be overkill for a feature that will likely not see that much use in practice.

Comments

Paul Crowley said (on IRC):

Peter Arrenbrecht said (on IRC):

Marcin Kasperski said (shamelessly writing inside this page):


SpecificHgrcForSetsOfRepos (last edited 2012-10-25 20:41:54 by mpm)