Does Mercurial Conditional% include?

I would like the parent project directories to include the hgrc file to which the repo in this folder is inherited, for example

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

Any project in the work should inherit from work/hgrc, and any in the personal should inherit from personal/hgrc. I was thinking of adding a script to ~/.hgrcwhich on clone will look for any hgrc files in the parent directories and %includethem if they exist, but it is ugly if I add hgrc below it after I clone it will not be included. Only 5% of the review time, but still ...

+3
source share
2 answers

How about accommodation:

%include ../hgrc

inside each repo .hg / hgrc? You could do this automatically, but by putting this in your system /etc/mercurial/hgrc:

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

.:)

+3

@Ry4an, , . ~/.hgrc, .

[hooks]
# This hook adds "%include ../.hgrc" to .hg/hgrc if the .hgrc file exists in
# the top level.  This allows one to store a set of paths for example.
# See 
update = if [ -e .hgrc ] && touch .hg/hgrc                                  \
                         && ! grep -q '%include \.\./\.hgrc' .hg/hgrc; then \
           echo '%include ../.hgrc' >> .hg/hgrc;                            \
         fi

%include ../.hgrc .hg/hgrc, .hgrc . , update post-clone , .

0

Source: https://habr.com/ru/post/1791548/


All Articles