Mercurial: keep 2 branches in sync but with certain persistent differences?

前端 未结 5 1749
Happy的楠姐
Happy的楠姐 2021-02-02 01:25

I\'m a web developer working on my own using django, and I\'m trying to get my head round how best to deploy sites using mercurial. What I\'d like to have is to be able to keep

5条回答
  •  灰色年华
    2021-02-02 01:53

    Perhaps try something like this: (I was just thinking about this issue, in my case it's a sqlite database)

    • Add settings.py to .hgignore, to keep it out of the repository.
    • Take your settings.py files from the two separate branches and move them into two separate files, settings-prod.py and settings-dev.py
    • Create a deploy script which copies the appropriate settings-X file to settings.py, so you can deploy either way.

    If you have a couple of additional files, do the same thing for them. If you have a lot of files but they're all in the same directory by themselves, you could just create a pair of directories: production and development, and then either copy or symlink the appropriate one into a deploy directory.

    If you did something like this, you could dispense with the need for branching your repository.

提交回复
热议问题