Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial Conditional %include?

Tags:

mercurial

hgrc

I would like parent directories of projects to include an hgrc file that a repo in that folder inherits from, e.g.

~/work/
~/work/hgrc
~/work/project1/
~/work/project2/
~/personal/hgrc
~/personal/project1
~/personal/project2
~/personal/project3

Any project in work should inherit from work/hgrc, and any in personal should inherit from personal/hgrc. I was thinking of adding a script to ~/.hgrc that on clone would search for any hgrc files in parent directories and %include them if they exist, but this has the uglyness that if I add an hgrc below it after I clone it it won't be included. Only a 5% of the time consideration, but still...

like image 960
Jonathan Avatar asked Apr 06 '26 17:04

Jonathan


1 Answers

How about putting:

%include ../hgrc

inside each repo's .hg/hgrc? You could even do that automatically but putting this in your systemwide /etc/mercurial/hgrc:

[hooks]
post-clone = echo '%include ../hgrc' >> .hg/hgrc

I've not tested that hook. :)

like image 136
Ry4an Brase Avatar answered Apr 13 '26 12:04

Ry4an Brase



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!