[PATCH 3 of 3] localrepo: look at .hg/hgrc.d/*.rc after .hg/hgrc
Peter Arrenbrecht
peter.arrenbrecht at gmail.com
Wed Mar 12 09:59:04 UTC 2008
On Tue, Mar 11, 2008 at 11:17 PM, Matt Mackall <mpm at selenic.com> wrote:
>
> On Tue, 2008-03-11 at 07:57 +0100, Peter Arrenbrecht wrote:
> > Matt, any chance of this making it into 1.0?
>
> I'm still unclear what this gets us.
It's a basis for anyone who needs to manage separate aspects of a
repo's config separately. Already today, in /etc it is used so
packages installing hg extensions can cleanly install and remove their
added config as separate files, with no need to parse and modify
central hgrc files. I want the same thing for repo configs. Cases in
point:
a) Consider an extension that clones parts of a repo's config when you
locally clone it (certain hooks, for example). jglick proposed a
syntax where somewhere in your .hg/hgrc, you have a section that
indicates which config items to clone. If .hg/hgrc.d/*.rc were
accepted, we could simplify this to just copying over
.hg/hgrc/cloned.rc to the new repo (if cloned.rc exists). I also
intend to use this in a similar manner in my rexec extension that
supports server-side clones and queue inits.
b) Coupled with the above, this same scheme is very handy for keeping
parts of a bunch of repos's config centralized using symlinks. If the
extension that clones .hg/hgrc/cloned.rc respects symlinks such that
if the original .hg/hgrc/cloned.rc is a symlink to some file, say
../../../common.hgrc, then the copied cloned.rc is a symlink to the
same file, we can just update common.hgrc to update all repo configs
referencing it.
Example:
~/dev-hg/
common.hgrc
upstream/
.hg/
hgrc
hgrc.d/
cloned.rc -> ../../../common.hgrc
If I now clone upstream/ to feature branches with the hypothetical
extension that clones .hg/hgrc/cloned.rc active, we get:
branch-one/
.hg/
hgrc
hgrc.d/
cloned.rc -> ../../../common.hgrc
branch-two/
.hg/
hgrc
hgrc.d/
cloned.rc -> ../../../common.hgrc
Still, I can just update common.hgrc to affect all these sibling
clones simultaneously.
It really just extends the benefits /etc/mercurial/.hgrc already
enjoys today to .hg/hgrc in repos.
Clear now?
-peo
More information about the Mercurial-devel
mailing list