push local ./hg/hgrc file?

Michael McNeil Forbes michael.forbes at gmail.com
Sun Oct 15 15:10:54 UTC 2017


> On Oct 14, 2017, at 10:15 PM, Augie Fackler <raf at durin42.com> wrote:
> 
> 
>> On Oct 14, 2017, at 4:51 AM, Uwe Brauer <oub at mat.ucm.es> wrote:
>> 
>> 
>> Hi
>> 
>> I want to push repo1 (laptop1) to USB and then to repo1(Laptop2).
>> 
>> The problem is that the local hgrc file will not be pushed since he is
>> inside the .hg directory,  I could try to make a symbolic link to
>> another file and add it to hg.
>> 
>> 
>> But is there a way to include the information of the local hgrc file in
>> a unique way to the global hgrc file? Like
>> 
>> 
>> [repo]
>> Repo.repfix = /home/oub/repo1
>> 
>> [hooks]
>> incoming.notify = python:hgext.notify.hook
>> outgoing.notify = python:hgext.notify.hook
>> [notify]
>> config = /home/oub/repo1/.hg/notifyconf
>> test = False
>> strip = 6
>> template = Subject: [Bitbucket] {webroot|strip}\n
>> branches:  {branches}
>> changeset: {rev}:{node|short}
>> user:      {author}
>> date:      {date|date}
>> description:
>> {desc}\n
>> 
>> I cannot find a working example in the net.
>> 
>> Any suggestions?
> 
> I thought I had a vague memory of a third-party extension that would let you do something like this, but https://www.mercurial-scm.org/wiki/ProjrcExtension appears to be what I was remembering, which I don’t think helps you. We don’t have any way of putting per-repo config options anyplace but in the .hg/hgrc file, sorry.
> 
> One option is you might be able to use the %include syntax in the .hg/hgrc file - see `hg help config` for more details.

I do this with the following hook (which I keep in my ~/.hgrc file).  Then I can keep customizations in the project's .hgrc file which will get pushed.  This hook will add "%include ../.hgrc" to the projects ".hg/hgrc" file on update if the file exists and is not already included.

http://stackoverflow.com/a/24195392/1088938

[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 http://stackoverflow.com/a/24195392/1088938
update = if [ -e .hgrc ] && touch .hg/hgrc \
                         && ! grep -q '%include \.\./\.hgrc' .hg/hgrc; then \
           echo '%include ../.hgrc' >> .hg/hgrc; \
         fi


> 
>> Thanks
>> 
>> Uwe Brauer 
>> 
>> _______________________________________________
>> Mercurial mailing list
>> Mercurial at mercurial-scm.org
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial
> 
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial




More information about the Mercurial mailing list