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

前端 未结 5 1746
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:41

    Here are two possible solutions one using mercurial and one not using mercurial:

    1. Use the hostname to switch between prod and devel. We have a single check at the top of our settings file that looks at the SERVER_NAME environment variable. If it's www.production.com it's the prod DB and otherwise it picks a specified or default dev/test/stage DB.
    2. Using Mercurial, just have a clone that's dev and a clone that's prod, make all changes in dev, and at deploy time pull from dev to prod. After pulling you'll have 2 heads in prod diverging from a single common ancestor (the last deploy). One head will have a single changeset containing only the differences between dev and prod deployments, and the other will have all the new work. Merge them in the prod clone, selecting the prod changes on conflict of course, and you've got a deployable setup, and are ready to do more work on 'dev'. No need to branch, transplant, or use queues. So long as you never pull that changeset with the prod settings into 'dev' it will always need a merge after pulling from dev, and if it's just a few lines there's not much to do.

提交回复
热议问题