Per project config options

Steve Hoelzer shoelzer at gmail.com
Wed Apr 25 13:44:00 UTC 2012


I think it would be really useful for Mercurial to support per project
config options in addition to per repo and per user options. When I
say "per project", I mean that options would be version controlled and
transferred between repos on clone/push/pull operations, just like
hgignore rules.

This idea came about while playing with the largefiles extension [1]
and considering it for my team at work. We would like everyone to use
standard options for `minsize` and `patterns`. Right now, the only way
to make that happen is for every person to manually set those options
(and not forget to do it, and not make a mistake). If our standard
changes, everyone has to manually update those options again. But if
these options could be set per project, just one person would make the
change and everyone else would get the new config when they pull.

The obvious way to have project level config options is to track a
special file. For example, largefiles options could be moved to
`<repo>/.hglargefiles`. I bet that having per project config options
would be useful for more than just largefiles, though, so a general
purpose config file like `<repo>/.hgrc` would be better. It would be
just another config file where any option could be specified. The
order of precedence would be:

1. Per repo (<repo>/.hg/hgrc)
2. Per project (<repo>/.hgrc)
3. Per user ($HOME/.hgrc).

I do realize that some things would not be appropriate as per project
options and could cause issues when transferred to a different repo. I
contend that this is a semi-advanced feature so the user should know
what they are doing. I also think that the benefits outweigh this
potential downside.

What do you think?

Thanks,
Steve

[1]: http://mercurial.selenic.com/wiki/LargefilesExtension



More information about the Mercurial mailing list