如何确保 Subversion 版本分支中的错误修复合并到主干中
我们将我们的软件版本作为 Subversion 中的分支进行管理。最新发布的版本是 trunk。较旧的发布版本是一个分支(也按构建和发布进行标记)。当开发人员修复旧版本中的错误时,他有责任将修复合并到主干中。如果错过了这一步,则很难注意到,直到该错误可能在更高版本中再次出现。然后我们必须重新调试和修复它。
有没有办法监控合并以确保它们完成?
或者有没有更好的方法来使用 Subversion 的分支来获得更好的结果。
更新:人们指出解决方案应该包括错误跟踪系统。我们确实使用 Jira 并使用 Jira 问题 ID 标记每个提交。目前尚未实施进一步的整合。
解决方案可能是采用更好的流程。但如果有任何工具可以支持这个更好的过程,我想了解它们的存在,或者使用它们的方式。
We are managing our software versions as branches in Subversion. The latest upcoming release is the trunk. Older released versions are a branch (also tagged per build and release). When a developer is fixing a bug in an older version, it is his responsibility to merge the fix into the trunk. In case this step is missed, it is hard to notice until, maybe, the bug shows up again in a later version. Then we have to debug and fix it all over again.
Is there a way to monitor the merges to make sure they are done?
Or is there a better way to use Subversion's branching to get better results.
UPDATE: People pointed the solution should include a bug tracking system. We do use Jira and mark every commit with the Jira issue ID. No further integration is implemented right now.
It is possible the solution is in having a better process. But if there are any tools to support this better process, I would like to learn about their existence, or the way to use them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
如果您的错误在错误跟踪器中(它们应该是),您可以使用它来跟踪它。您的错误跟踪器中应该有某种方法来标记哪些版本受到影响。
为了确保已关闭的错误确实得到解决,质量检查/测试人员应该测试该错误在所有受支持的版本中实际上已修复。
SVN 的合并跟踪可以帮助一些人,但最终它无法告诉您:
测试确实是确保错误消失的最佳方法。如果您没有 QA/测试人员,您可以让其他开发人员来完成或雇用软件测试人员。
If your bugs are in a bug tracker (and they should be), you can use it to track this. There should be some way in your bug tracker to mark which versions are affected.
To make sure that a closed bug is actually resolved, QA/testing people should test that the bug is actually fixed in all supported releases.
SVN's merge tracking can help some, but ultimately it can't tell you:
Testing is really the best way to be sure a bug is gone. If you don't have QA/test people, you can have a different developer do it or hire software testers.
从版本 1.5 开始,SVN 将有关合并修订的信息放入属性中。您应该能够在那里找到它并理解它。但是,这仅告诉您合并了哪些修订版,而不是忘记合并哪些修订版。
最后,我想,这一切都归结为那些对分支进行修复的人也负责将其合并到主干中。确保这种情况发生的最好方法可能是同侪压力。 <代码>:)
Beginning with version 1.5, SVN puts information about merged revisions into the properties. You should be able to find it there and make sense of it. However, this only tells you which revisions were merged, not which revisions were forgotten to merge.
In the end, I guess, it all boils down to those who make a fix on a branch also being responsible for merging it into the trunk. The best way to make sure that happens probably is peer pressure.
:)
您可能需要调整 Subversion 开发人员自己使用的策略:在主干中进行大部分开发,从分支中发布。当发现错误时,首先在主干中修复它,然后将修复从主干合并到分支。
You might want to adapt the strategy Subversion developers use themselves: do most of the development in trunk, release from branches. When a bug is found it's first fixed in trunk and then the fix is merged from trunk to the branch.
SVN 中没有任何内容可以告诉您应该或不应该签入、分支、合并或删除哪些代码。那不是它的工作。它完美地完成了它的工作 - 为您提供了一个版本化工具来存储您的代码。
因此,您不需要一个工具来更好地管理您的代码,您需要一个外部系统来更好地管理您的开发人员:)
一种方法是 QA、测试和错误跟踪器 - 当代码发生更改时,对代码所做的操作会在各个阶段进行记录和跟踪。您通常不希望任何人无缘无故地对代码进行更改(除了“我觉得需要重构”),因此跟踪工具无论如何都是一个好主意。由于错误在一个版本中得到修复,因此该工具可用于确保该错误也在其他版本中得到修复(在适当的情况下 - 有时您不希望对某个版本进行特定更改)
SVN 可以与这些工具集成,例如例如,当一些魔术词添加到签入中时,我的存储库会更新我的 Mantis bugtracker(如果您在签入注释中键入“fixed mantis #1234”,mantis bug 1234 将使用更改的文件进行更新,并且其状态更改为“等待测试” ')
另外,评论板等工具也可以集成 - 当您进行更改时,可以将修订版本发布到那里供其他人签署,签署过程可以包括确保错误被合并,或者为其他人创建新的错误报告发布您也需要修复它。
因此,问题不在于 SVN,而在于您的开发流程。
There's nothing in SVN to tell you what code you should or should not checkin, branch, merge or delete. That's not its job. It does its job perfectly well - which is providing you with a versioned tool to store your code in.
So, you don't need a tool to manage your code better, you need an external system to manage your developers better :)
One way is QA, test and a bug tracker - as code changes are made, the fact that something was done to the code is recorded and tracked through the various phases. You typically do not want anyone making changes to code without some reason (other than 'I felt it needed refactoring') so a tracking tool is a good idea anyway. As bugs are fixed in one release, this tool can be used to ensure that the bug is fixed in other ones too (when appropriate - sometimes you don't want a particular change made to a release)
SVN can integrate with these tools, for example, my repo updates my Mantis bugtracker when some magic words are added to a checkin (if you type "fixed mantis #1234" in the checkin comment, mantis bug 1234 will be updated with the changed files and its status changed to 'waiting test')
Alternatively tools such as reviewboard can integrate too - as you make a change, the revision can be posted there for others to sign off, sign off process can include ensuring the bug is merged, or a new bug report is created for the other releases you require it fixing in too.
So - the problem is not with SVN here, its with your development processes.
首先,确保完成这些事情的方法是在错误跟踪系统中的错误条目中记录版本分支上修复的签入以及到主干的合并签入。如果您没有错误跟踪系统,请购买一个。除了帮助跟踪修复之外,它还解决了跟踪错误状态的许多其他问题。
其次,您可能需要考虑另一种方法。当您在已发布版本中复制错误时,请尝试将其也复制到主干的头部。大多数时候你会发现它仍然在发生。在主干中修复它并检查修复。然后将更改合并回需要修复的已发布版本的分支中(您可能需要修改修复以适应不同的环境)。如果错误只发生在发布分支中,那么它会在那里修复它(不需要合并到主干)。
First, the way to be sure these things get done is to record the checkin of the fix on the version branch and the checkin of the merge to the trunk in the bug's entry in your bug tracking system. If you don't have a bug tracking system, get one. Besides helping with tracking fixes, it solves many other issues with tracking the status of bugs.
Second, you may want to consider an alternate approach. When you duplicate a bug in a released version, try and duplicate it in the head of the trunk too. Most of the time you'll find it is still occuring. Fix it in the trunk and check that fix in. Then merge the change back into the branches for already released versions that need the fix (you may have to modify the fix to account for the different environment). If the bug only occurs in a release branch, then it fix it there (it doesn't need to be merged to the trunk).
较新版本的 subversion(我认为从 1.5 或 1.6 开始)具有合并跟踪。也就是说,颠覆会跟踪分支中的哪些更改已合并到主干。
您可以使用命令将所有更改从分支合并到主干:
请参阅 Subversion 手册了解更多详细信息。
这样,您将在分支中完成所有更改并到达主干。但是,如果您不想获取从分支到主干的所有更改,则必须使用 svn diff 来注意更改并选择要合并的更改。
Newer versions of subversion (I think, starting from 1.5 or 1.6) have a merge tracking. That is, the subversion keeps track which of the changes in branch have been merged to trunk.
You can merge all changes from the branch to the trunk using command:
See Subversion manual for more details.
This way you'll get all the changes done in branch to arrive to trunk. However if you do not want to get all changes from branch to trunk you must use svn diff to notice changes and select changes you want to merge.
这就是我们正在做的事情,我刚刚在博客上介绍了它 - 我们在我们的 CI 服务器中设置一个特殊的构建,以确保每晚不存在未合并的更改。
Here is what we're doing, I just blogged about it - we setup a special build in our CI server that makes sure, on a nightly basis, that no unmerged changes exist.
事实上,我不久前写了一个脚本来做到这一点。我正在从事的一个项目上有许多同步分支,并且很难跟踪所有提交和合并。
您可以在以下位置找到该脚本: http://github.com/ccampbell/show-missing-revs
假设您有一个 2.0 发布分支。要找出 2.0 中提交的尚未合并到主干的所有内容:
这将输出类似以下内容:
我相信这需要 subversion 1.5。希望您觉得这很有用!
I actually wrote a script a little while back to do exactly that. We had a number of simultaneous branches going on a project I was working on, and it was very difficult to keep track of all commits and merges.
You can find the script at: http://github.com/ccampbell/show-missing-revs
Let's say you have a 2.0 release branch. To find out everything committed in 2.0 that has not yet been merged to trunk:
This will output something like:
This requires subversion 1.5 I believe. Hope you find this useful!