Mercurial:保持2个分支同步但有一定的持续性差异? [英] Mercurial: keep 2 branches in sync but with certain persistent differences?

查看:102
本文介绍了Mercurial:保持2个分支同步但有一定的持续性差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名使用django的网站开发人员,我正在努力让我的头脑尽可能地最好地使用mercurial部署网站。我想要的是能够保留一个可用于生产和开发工作的存储库。生产/开发之间总会有一些差异(例如,他们可能会使用不同的数据库,开发总是会启用调试),但总的来说它们将保持同步。我也想直接在生产服务器上进行更改(整理html或css,简单的错误修复等)。

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 one repository that I can use for both production and development work. There will always be some differences between production/development (e.g. they might use different databases, development will always have debug turned on) but by and large they will be in sync. I'd also like to be able to make changes directly on the production server (tidying up html or css, simple bugfixes etc.).

我打算的工作流程使用这样做如下:

The workflow that I intend to use for doing this is as follows:


  • 创建2个分支,prod和dev(所有设置最初设置为生产设置)

  • 在开发分支中更改settings.py和其他一些内容。所以现在我有2个头,从现在开始,存储库总是有2个头。

  • (在dev机器上)更改dev,然后使用'hg移植'复制

  • 推送到主存储库

  • (在生产服务器上)从主站回收,更新为prod头

  • Create 2 branches, prod and dev (all settings initially set to production settings)
  • Change settings.py and a few other things in the dev branch. So now I've got 2 heads, and from now on the repository will always have 2 heads.
  • (On dev machine) Make changes to dev, then use 'hg transplant' to copy relevant changesets to production.
  • push to master repository
  • (On production server) Pull from master repo, update to prod head

注意:只要将更改移植到dev中,您还可以直接进行更改。

Note: you can also make changes straight to prod so long as you transplant the changes into dev.

此工作流程的缺点是,每当您进行更改时,不仅必须将其提交给您进行更改的任何分支,还必须将其移植到另一个分支。有没有更合理的方法来做我想要的,也许使用补丁?还是没有这样做,是否有一种自动化提交过程来自动将变更集移植到另一个分支的方法,这将是一个好主意?

This workflow has the drawback that whenever you make a change, not only do you have to commit it to whichever branch you make the change on, you also have to transplant it to the other branch. Is there a more sensible way of doing what I want here, perhaps using patches? Or failing that, is there a way of automating the commit process to automatically transplant the changeset to the other branch, and would this be a good idea?

推荐答案

我可能会使用Mercurial Queues这样的东西。将主存储库保留为开发版本,并且有一个 for-production 补丁,可以对生产进行任何必要的更改。

I'd probably use Mercurial Queues for something like this. Keep the main repository as the development version, and have a for-production patch that makes any necessary changes for production.

这篇关于Mercurial:保持2个分支同步但有一定的持续性差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆