源代码管理和错误修复的最佳实践

时间:2021-12-26 20:07:23

If we need to issue a bug patch that does not include current development that has been committed, or any changes from their current version, what should be done to make the process safer and with lower overhead?

如果我们需要发布一个不包含已提交的当前开发的bug补丁,或者当前版本的任何更改,那么应该采取哪些措施来使流程更安全且开销更低?

We are currently using Subversion for our source control in a small (3 developers) team primarily developing in Visual Studio 2008. We anticipate that the team may group to 8 developers over the next year, and for any previous release support to become more complicated. While most customers are on the current release, some are further behind.

我们目前正在一个主要在Visual Studio 2008中开发的小型(3个开发人员)团队中使用Subversion作为源代码控制。我们预计该团队可能会在明年分组给8个开发人员,并且任何以前的版本支持都会变得更加复杂。虽然大多数客户都在当前版本中,但有些客户却落后了。

3 个解决方案

#1


6  

Source control can handle this pretty easily, and was designed for this.

源代码控制可以非常轻松地处理这个问题,并且专为此而设计。

When you reach the stabilization period of your release a branch should be done. It is important that you do not start any work on the next release before this is done.

当您达到释放的稳定期时,应该完成分支。重要的是,在完成此操作之前,您不要在下一个版本上开始任何工作。

Any bug fixes for that release should be done in that branch. This prevents new code from an upcoming release from polluting the bug fix. Once the bug fix is done then you can merge that change down to the trunk, and any other releases as necessary.

该版本的任何错误修复都应该在该分支中完成。这可以防止即将发布的新代码污染错误修复。完成错误修复后,您可以将该更改合并到主干,并根据需要将其他任何版本合并。

Don't forget to put the bug number in the comment, as this will make keeping track of commits easier.

不要忘记将错误号放在注释中,因为这样可以更轻松地跟踪提交。

#2


3  

How about: a branch per major version, with bug fixes applied to the branch(es) as needed, and also applied (or merged) back to trunk.

如何:每个主要版本的分支,根据需要将错误修复应用于分支,并且还应用(或合并)回主干。

#3


0  

Where I work, we have several projects working simultaneously. In order to avoid this issue, we have several variants of the source code. For example, the first release is Variant 1.0. We create a branch off of this release, say, Variant 2.0, for all future development. If we need to do a bug fix, we do it on the main Variant, which is currently 1.0 and can release that. When Variant 2.0 is ready to go to production, we merge it with whatever is on the main branch (in this case, 1.1) and that becomes the new main trunk. At one point, we had 4 branches running at the same time.

在我工作的地方,我们有几个同时工作的项目。为了避免这个问题,我们有几个源代码变体。例如,第一个版本是Variant 1.0。我们为这个版本创建了一个分支,比如Variant 2.0,用于所有未来的开发。如果我们需要修复错误,我们会在主要的Variant上执行此操作,该版本目前为1.0并且可以释放它。当Variant 2.0准备好投入生产时,我们将它与主分支上的任何内容合并(在本例中为1.1),这将成为新的主干线。有一次,我们有4个分支同时运行。

Merging the code can be time consuming, and you have to be careful not to introduce new bugs during the merge, but if you have a decent code comparison tool available, then it shouldn't be too bad. We did a merge a while back using Beyond Compare on a 10,000 file source directory, and it took a single morning.

合并代码可能非常耗时,并且在合并期间必须小心不要引入新的错误,但是如果你有一个不错的代码比较工具,那么它应该不会太糟糕。我们在10,000个文件源目录上使用Beyond Compare进行了一段时间的合并,并且花了一个上午。

#1


6  

Source control can handle this pretty easily, and was designed for this.

源代码控制可以非常轻松地处理这个问题,并且专为此而设计。

When you reach the stabilization period of your release a branch should be done. It is important that you do not start any work on the next release before this is done.

当您达到释放的稳定期时,应该完成分支。重要的是,在完成此操作之前,您不要在下一个版本上开始任何工作。

Any bug fixes for that release should be done in that branch. This prevents new code from an upcoming release from polluting the bug fix. Once the bug fix is done then you can merge that change down to the trunk, and any other releases as necessary.

该版本的任何错误修复都应该在该分支中完成。这可以防止即将发布的新代码污染错误修复。完成错误修复后,您可以将该更改合并到主干,并根据需要将其他任何版本合并。

Don't forget to put the bug number in the comment, as this will make keeping track of commits easier.

不要忘记将错误号放在注释中,因为这样可以更轻松地跟踪提交。

#2


3  

How about: a branch per major version, with bug fixes applied to the branch(es) as needed, and also applied (or merged) back to trunk.

如何:每个主要版本的分支,根据需要将错误修复应用于分支,并且还应用(或合并)回主干。

#3


0  

Where I work, we have several projects working simultaneously. In order to avoid this issue, we have several variants of the source code. For example, the first release is Variant 1.0. We create a branch off of this release, say, Variant 2.0, for all future development. If we need to do a bug fix, we do it on the main Variant, which is currently 1.0 and can release that. When Variant 2.0 is ready to go to production, we merge it with whatever is on the main branch (in this case, 1.1) and that becomes the new main trunk. At one point, we had 4 branches running at the same time.

在我工作的地方,我们有几个同时工作的项目。为了避免这个问题,我们有几个源代码变体。例如,第一个版本是Variant 1.0。我们为这个版本创建了一个分支,比如Variant 2.0,用于所有未来的开发。如果我们需要修复错误,我们会在主要的Variant上执行此操作,该版本目前为1.0并且可以释放它。当Variant 2.0准备好投入生产时,我们将它与主分支上的任何内容合并(在本例中为1.1),这将成为新的主干线。有一次,我们有4个分支同时运行。

Merging the code can be time consuming, and you have to be careful not to introduce new bugs during the merge, but if you have a decent code comparison tool available, then it shouldn't be too bad. We did a merge a while back using Beyond Compare on a 10,000 file source directory, and it took a single morning.

合并代码可能非常耗时,并且在合并期间必须小心不要引入新的错误,但是如果你有一个不错的代码比较工具,那么它应该不会太糟糕。我们在10,000个文件源目录上使用Beyond Compare进行了一段时间的合并,并且花了一个上午。