本文介绍了如何在Mercurial中为无提示修订创建分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的仓库中,我的修订版是1到10.我已经将修订版提高到5(因此下一个hg push将发布修订版6-10).

In my repo, I have the revisions 1 to 10. I've pushed up to 5 (so the next hg push would publish revisions 6-10).

但是我现在必须中断我的工作,结果还不是100%完整.因此,我想将6-10修订版移到新的实验"分支中,以允许其他人完成工作 而不会破坏每个人的资源.

But I have to interrupt my work now and the result isn't 100% complete. So I'd like to move the revisions 6-10 into a new "experimental" branch to allow someone else to complete the work without disrupting the sources for everyone.

如何将分支添加到非最新修订版(在我的情况下:从修订版6开始)?还是应该使用完全不同的方法?

How can I add a branch to a non-tip revision (in my case: Starting with revision 6)? Or should I use a completely different approach?

推荐答案

事实发生后,您不能在不修改历史记录的情况下应用分支名称.

You cannot apply a branch name after the fact without modifying your history.

最简单的方法是要求其他用户将修订5用作其创建的任何更改的父级.例如,其他用户将:

The most simple approach is to ask the other users to use revision 5 as the parent for any changes they create. For example, the other users would:

  1. hg clone <your repo>甚至hg clone --rev 5
  2. hg update -r 5
  3. 工作,工作,工作
  4. hg commit
  1. hg clone <your repo> or even hg clone --rev 5
  2. hg update -r 5
  3. work, work, work
  4. hg commit

当他们提交更改时,它将在default分支上创建第二个头部,但这不会造成任何问题.实验更改完成后,您只需要将两个头合并在一起即可.

When they commit a change, it will create a second head on the default branch, but that should not create any problems. You will simply need to merge the two heads together once your experimental changes are complete.

话虽如此,将变更集移动到分支上可以使用Mercurial Queues(MQ)来完成.以下序列显示了如何完成此操作:

That being said, moving your changesets onto a branch can be accomplished using Mercurial Queues (MQ). The following sequence shows how it be done:

  1. hg qinit(创建新的修补程序队列)
  2. hg qimport --rev 6:10(将r6-10导入新的补丁程序队列中)
  3. hg qpop -a(从工作副本中删除所有补丁)
  4. hg branch <branch name>(创建新的实验分支)
  5. hg qpush -a(将所有补丁程序应用到您的分支机构)
  6. hg qfinish -a(将所有修补程序转换为永久变更集)
  1. hg qinit (Create a new patch queue)
  2. hg qimport --rev 6:10 (import r6-10 into a new patch queue)
  3. hg qpop -a (remove all patches from your working copy)
  4. hg branch <branch name> (create your new experimental branch)
  5. hg qpush -a (apply all the patches to your branch)
  6. hg qfinish -a (convert all patches to permanent changesets)

这篇关于如何在Mercurial中为无提示修订创建分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 20:59