如何在Mercurial中重复合并分支 [英] How to repeatedly merge branches in Mercurial

查看:73
本文介绍了如何在Mercurial中重复合并分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在工作的地方使用Mercurial,并且我想要一个类似于我使用SVN的设置:

We're using Mercurial where I work and I want to have a setup similar to how I used SVN:

  • 后备箱
  • 标签
    • 生产
    • Trunk
    • Tags
      • Production

      由于Mercurial本机支持分支,因此我知道如何创建命名分支,但是找不到有关如何将"Trunk"与"Production"重复合并的任何文档.

      Since Mercurial supports branches natively, I know how to create a named branch, but I can't find any documentation on how to repeatedly merge 'Trunk' with 'Production'.

      很简单,我想拥有一个用于正常工作的开发分支和一个生产分支,我通常将更改从开发分支引入.我该如何使用Mercurial?

      Quite simply, I want to have a development branch for normal work and a production branch that I routinely pull changes from the development branch into. How do I do this with Mercurial?

      推荐答案

      如前所述,移植扩展可以用于挑选从一个分支到另一个分支的单个更改.但是,如果您始终希望将 all 进行最新更改,则hg merge命令将带您到那里.

      As the previous poster mentioned, the transplant extension can be used for cherry-picking individual changes from one branch to another. If, however, you always want to pull all the latest changes, the hg merge command will get you there.

      最简单的情况是使用克隆来实现分支时(因为这是围绕Mercurial设计的用例).假设您已打开<中的内置获取扩展名c1>/Mercurial.ini:

      The simplest case is when you're using clones to implement branching (since that's the use case Mercurial is designed around). Assuming you've turned on the built-in fetch extension in your .hgrc / Mercurial.ini:

      cd ~/src/development
      # hack hack hack
      hg commit -m "Made some changes"
      cd ../production
      hg fetch ../development
      

      如果您使用的是本地分支机构:

      If you're using local branches:

      hg update -C development
      # hack hack hack
      hg commit -m "Made some changes"
      hg update -C production
      hg merge development
      hg commit -m "Merged from development"
      

      这篇关于如何在Mercurial中重复合并分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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