在Mercurial中使用默认值覆盖分支 [英] Overwriting branch with default in Mercurial

查看:80
本文介绍了在Mercurial中使用默认值覆盖分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个名为feature_x的功能分支,该分支已经进行了处理,然后樱桃选择了变更集并将其移植为默认值,然后关闭了该分支.不是最好的流程,而是Mercurial,因此无法更改历史记录.

Let say I had a feature branch called feature_x that was worked on, then changesets cherry-picked and transplanted to default, then the branch was closed. Not the best flow, but it's Mercurial, so there is no way of changing the history.

现在,我将再次使用功能X,我觉得重用feature_x分支会带来最少的混乱.但是,如果我重新打开该分支并将default合并到该分支,则会遇到两个问题.第一次合并冲突,第二次更改在该分支中被修改,但从未合并为默认值.因此,我想拥有的是干净的板岩,分支feature_x,但具有default中当前内容的精确副本.有没有比创建会遮盖名称的新分支更干净的方法了?

Now I'm going to work again on the feature X, and I feel reusing feature_x branch would be least confusing. However, if I reopen that branch and merge default to it, I've got two problems. First merge conflicts, second changes that were modified in that branch, but never merged into default. So what I'd like to have is clean slate, branch feature_x, but with exact copy of what's currently in the default. Is there a cleaner way of doing that, than creating new branch which will shadow the name?

推荐答案

我认为您最好的选择是从default的当前提示开始创建一个新分支,称为feature_x2feature_y,并保留过去的内容过去.

I think your best bet is to start a new branch off of the current tip of default called feature_x2 or feature_y and leave the past in the past.

但是,还有其他一些选择:

But here are some other options:

  1. 旧的feature_x分支是仅局限在您的存储库中还是被推送?如果是前者,则可以hg strip它,然后在当前default处重新开始分支.

  1. Is the old feature_x branch confined locally to your repo only or was it pushed? If the former, you could hg strip it and start the branch again at the current default.

如果feature_x名称确实非常重要,则可以使用

If the feature_x name is really, really important, you could do the merge default into it using the internal merge tools and force it to reflect the default branch exactly by doing

hg merge -r default --tool internal:other

  • 或者您可以只在branch_x的顶端提交default的(文件系统)副本.然后,您可以沿自己的快乐方式继续在该分支上.

  • Or you could just commit a (file system) copy of default on top of the tip of branch_x. Then you could continue on that branch along your merry way.

    我不知道2.或3.将来是否会引起奇怪的合并问题.我会进行测试,看看合并回默认值(或其他移植内容)以后是否会引起问题.

    I don't know if 2. or 3. will cause strange merge issues down the road. I would test to see if the merge back over to default (or another graft?) could cause issues later.

    这篇关于在Mercurial中使用默认值覆盖分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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