如何在DVCS中的分支中移动错误修正? [英] How to move bugfixes across branches in DVCS?

查看:105
本文介绍了如何在DVCS中的分支中移动错误修正?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我们发现某些分支中的错误,我们修复它(检查图片上的 New 版本)。但是我们也有兴趣将这个修正移到 Old 版本和 Main 开发分支:

 
a - > b - > c(旧版本)
|
A - > B - > C - > D(主要版本)
|
1 - > 2 - > bugfix - > 4(新版本)

svn 记住在svn:合并属性(从svn 1.6,2009)哪个版本合并到哪个分支。所以下次如果你合并版本的区域合并以前的版本,合并版本将被跳过。



如何处理现代DVCS?

我需要制作简单的补丁并将其应用于每个分支,或者存在DVCS的帮助吗?

注意:我可以不仅仅是将 New 分支合并到 Main ,因为之前的变更集也会移动到 Main 分支。

<因为 New 发行版给许多开发人员,所以也不可能实现Rebase。



我对回答命名分支模式和多种资源库模式感兴趣。 / p>
$ b

PS。 Andy 建议寻找所有分支机构的共同父母,以便对其进行更新,更新,应用修复到bug并将修复移到受影响的分支。

通过更新旧变更集并进行更改,您可以创建新分支。我建议创建命名分支(将其命名为 bugID ),以便您可以轻松地返回它。



我们有兴趣修复bug的所有分支机构。

第一个解决方案(建议 Andy )使用 $ hg / git / bzr blame 并仔细检查所有受影响文件的输出。这涉及到首先修复一些最新的变更集的错误,然后您发现责备哪些变更引入了一个错误。然后您需要 rebase 修复(修补程序)到常见的父变更集。 / strong>(您也可以手动执行更新以查找引入错误的第一个修订版)。这可以是广阔的,但更多真正的解决方案,因为允许将bug修补程序填充到任何分支中存在错误的分支。



I认为先找到第一个BAD 变更集,然后修正一个缺陷,而不是首先修复一个缺陷,然后找到第一个BAD 变更集(除非你已经知道如何修复BUG)。还有一个引入的差异可以帮助理解为什么发生。



PPS。到任何受影响的分支。



如果询问如何从开发分支到发布分支的backport功能,有趣的问题就来了。如您所见,您必须提交在发布分支之前以changeset开头的功能更改集。但是,当你开发功能时,你可能不知道你需要什么backport功能。使用 svn:merge VCS记住您所有的backports。如何处理DVCS?

解决方案

您可以:


  1. 找到共同的父母。





    li>

  2. 检出公共父项

    git checkout A


  3. 创建新分支来修复

    git checkout -b bugFix

  4. $ b $上的错误b
  5. 修正错误并将它们提交给bugFix分支


  6. 需要错误修复的Checkout分支

    git checkout branchToApplyFixTo

  7. 将bugFix合并到分支

    git merge bugFix



If we discover bug in some branche we fix it (check New release on picture). But also we interesting in moving this fix to Old release and Main development branch:

a-->b-->c              (Old release)
|    
A-->B-->C-->D           (Main release)
    |
    1-->2-->bugfix-->4  (New release)

svn remember in svn:merge properties (from svn 1.6, 2009) which revision merged to which branches. So next time if you merge region of revisions previously merged revisions was skipped from merge patch.

How deal with modern DVCS?

I need make plain patch and apply it to each branches or there are exist some help from DVCS?

Note: I can not just merge New branche to Main as previous changesets move also to Main branche.

Rebase also not possible as New release come to many developers.

I interesting in answer for named braches schema and for multirepository schema.

PS. Andy suggest find common parent to all branches for which bug have affect, update to it, apply fix to the bug and move fix to affected branches.

By updating to old changeset and making changes you create new branch. I recommend create named branch (name it as bugID), so later you can easy back to it.

There are problem on finding common parent to all branches in which we have interest to fix bug.

First solution (that suggest Andy) is using $ hg/git/bzr blame and carefully check output for all affected files. This involve first fix bug on some newest changeset before you find with blame what changeset introduce a bug. Then you need rebase fix (patch) to common parent changeset.

Another solution is using $ hg/git/bzr bisect (you can also manually perform updates to find first revision in which bug introduced). This can be expansive but more true solution as allow populate bugfix to any branches in which bug present.

I think it is better first find first BAD changeset and then fix a bug, instead of first fix a bug and then find first BAD changeset (except case when you already know how fix bug). Also having a diff that introduce can help in understanding why it occur.

PPS. With bugs it is clear which branch effected to allow merge changes to any effected branch.

Interesting question come if ask how backport feature from development branch to release branch. As you can see you must commit feature changesets starting with changeset that before release branch. But when you develop feature you can don't know where you need backport feature. With svn:merge VCS remember for you all backports. How about DVCS?

解决方案

You could:

  1. Find common parent. Thanks to Novelocrat for this step.
    git merge-base branch1 branch2 branch3 ...

  2. Checkout the common parent
    git checkout A

  3. create new branch to fix bugs on
    git checkout -b bugFix

  4. Make bug fixes and commit them to bugFix branch

  5. Checkout branch that needs the bug fix
    git checkout branchToApplyFixTo

  6. Merge the bugFix into the branch
    git merge bugFix

这篇关于如何在DVCS中的分支中移动错误修正?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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