Mercurial workflow question (how to handle Config files)

前端 未结 6 1773
有刺的猬
有刺的猬 2021-01-05 12:26

I have a long standing problem: at work we\'re using mercurial as a DSCM, but we can\'t figure out how to keep our config files in sync.

The problem is that we want

6条回答
  •  别那么骄傲
    2021-01-05 13:10

    It's a bit of a bastardization, but you could use the KeywordExtension to automatically expand tokens. In your config file put something like this:

    db.host = $DBHOST$
    db.host = $DBUSER$
    db.host = $DBPASS$
    

    and then in their ~/.hgrc files user's would have something like this:

    [extensions]
    hgext.keyword=
    [keyword]
    # expand keywords in all python files in working dir
    **.conf =
    [keywordmaps]
    DBHOST = dev.server.internal
    DBUSER = myname
    DBPASS = mypass
    

    Production, of course, would have its own .hgrc.

    The scheme would cost everyone a little bit of set up time once, but after that it should be automatic. Defaults could be in the system-wise /etc/mercurial/hgrc file in case the user didn't want to set their own private connection strings.

提交回复
热议问题