用于 Web 开发和改进的 SVN 布局

发布于 2024-11-09 13:40:19 字数 1393 浏览 0 评论 0原文

我们正在开发一个 CMS,它正在大力开发中,

branches/cases/#432    (Under Development By Coder X)
branches/cases/#499    (Under Development By Coder Z)

branches/next-release  (Under QA)
  (Pending Merges by X&Z Coders)

tags/was-on-LIVE-before-v1.x

trunk/on-LIVE

当前结构如上,当我们从支持软件获得一个新案例时,我们从 branches/next-relase 切出一个分支到 cases/# CASEID 会自动为该开发人员设置 ftp 帐户和网络主机作为我们开发服务器上的工作区。
编码员通过 FTP 进行更改,完成后,他将更改提交(还添加/恢复/删除)他的 branches/cases/#CASEID 部分。
之后,我们在开发人员门户上有一个按钮,它尝试在自动合并

时自动合并:
我们更新branches/next-release(它也是团队检查所有提交的演示位置),然后尝试:

svn merge --dry-run --reintegrate \
  svn://SVN_SERVER/branches/cases/#CASEID \
  /development/workspaces/next-release | grep "C "

如果发生冲突,我们会向编码人员发出详细警告,例如“合并将导致下一个版本有冲突,因此您必须在本地检出并手动合并”,如果没有任何冲突,开发门户将在没有它的情况下重新运行合并命令,并在 /development/workspaces/next-release

我遇到的一些问题:

  • 虽然开发人员从 branches/next-release 中剪切了 #432 分支并开始编码,但做了很多更改,但仍在工作中
  • 其他一些开发人员打开 #499 并对其他文件进行了一些更改,并与 branches/next-release 合并,
  • 然后当“#432 Guy”时完成他的工作并将他的分支与 branches/on-QA-phase 合并,而不是“#499 Guy”所做的一些更改丢失/被 #432 覆盖旧文件。

我们的 SVN 布局/工作流程有何改进?
还有关于我们可以为此做些什么的问题?也许只合并文件只更改了文件或下一个版本到案例分支合并之前案例分支到下一个版本合并?

We are developing a CMS and its really heavily under development,

branches/cases/#432    (Under Development By Coder X)
branches/cases/#499    (Under Development By Coder Z)

branches/next-release  (Under QA)
  (Pending Merges by X&Z Coders)

tags/was-on-LIVE-before-v1.x

trunk/on-LIVE

Current structure like above, when we got a new case from support software we cut a branch from branches/next-relase to cases/#CASEID than automatically a ftp account and webhost gets setup for that developer as workspace on our development server.
Coder makes changes via FTP and when he is done he commits (also add/revert/delete) changes to his branches/cases/#CASEID part.
After that we got a button on developer portal which tries to auto merge

On Auto Merge:
We update the branches/next-release (its also a demo place for team check up all commits), then try:

svn merge --dry-run --reintegrate \
  svn://SVN_SERVER/branches/cases/#CASEID \
  /development/workspaces/next-release | grep "C "

If we get a conflict we verbose a warning to coder like "that merge will cause a conflict on next-release so you must checkout both on your local and merge manually", if there isn't any conflict devel portal reruns merge command without it and commit changes on /development/workspaces/next-release.

Some problems I have met:

  • While developer cuts #432 branch from branches/next-release and started coding did a lot of changes but still working on in while he is on it
  • some other developer opened #499 and made some changes with another files and merged with branches/next-release,
  • then when "#432 guy" finishes his work and merges his branch with branches/on-QA-phase than some of changes made by "#499 guy" get lost / overriden by #432 old files.

Any improvements to our SVN layout / workflow?
And also about the problem what we could do for that? maybe only merge files only changed ones or next-release to case branch merge before case branch to next-release merge?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不醒的梦 2024-11-16 13:40:19

基本上,每当 SVN 涉及重新集成工作流程时,您都需要首先将目标分支合并到本地分支,然后将所述本地分支重新集成回集成分支。
请参阅“重新集成工作流程”。

这种工作流程会遇到的问题之一是“重新集成”操作的“最终”方面,这意味着,一旦重新集成,您将无法对案例分支进行其他更改(并再次重新集成) ).
另外,管理您的mergeinfo仔细元数据

Basically, whenever there is a reintegrate workflow involved with SVN, you need to merge first the destination branch to your local branch, then reintegrate said local branch back to the integration branch.
See "reintegrate workflow".

One of the issues you will have with that kind of workflow is the "final" aspect of that "reintegrate" operation, meaning that, once reintegrated, you won't be able to make additional changes on the case branch (and reintegrate it again).
Also, manage your mergeinfo metadata carefully.

单身情人 2024-11-16 13:40:19

首先,使用 DVCS,git 解决了世界饥饿问题,是有史以来最好的事情。
好的,现在我们已经解决了这个问题,我们可以解决您的具体问题:)

重新集成应该按预期工作 - 它获取您分支的原始点和当前分支头之间的差异,并将这些差异应用回主干合并时。它还检查您是否尚未从主干合并到分支,如果已经合并,它会排除已合并的更改。

我想知道这是否是问题所在 - 开发人员从主干合并到分支,但没有合并所有修订,只将最后一个修订带到分支。在这种情况下,您会期望合并回来覆盖跳过的修订版 - 毕竟,开发人员会告诉合并跳过它们(即,r10处的分支,有人添加了版本11和12,开发人员将r12合并到分支,并且然后当他合并回来时,系统将计算差异,从而覆盖 r11 - 这就是他告诉它要做的)。

同样,如果 #432 的家伙遇到冲突,试图通过告诉系统跳过有人敢于在他之前提交的那些修订来解决它,那么是的,它会“覆盖”它们(它实际上不是覆盖它们,而是实际上删除它们 -将它们合并起来,就好像开发人员自己删除了代码一样)

我可能无法理解的另一个方面是您在下一个版本中分支,但您的问题指的是“#432 Guy”与分支/on-QA 阶段合并。这可能与问题有关吗?

有一篇 Collabnet 博客文章 描述了 Reintegrate 是什么以及它是如何实现的作品。

First, use a DVCS, git solves world hunger and is the best thig ever.
Ok, now we've got that out of the way, we can solve your specific problem :)

Reintegrate should work as expected - it takes the differences between the original point you branched and your current branch head and applies those differences back to the trunk when merging. It also checks that you havn't merged from trunk to your branch already, and if you have, it excludes the changes that have alreayd been merged.

I wonder if this is the problem - the developer merged from trunk to branch, but didn't merge all the revisions, only bringing the last revision to the branch. In such a case, you would expect merging back to overwrite the skipped revisions - after all, the dev woudl have told the merge to skip them (ie, branches at r10, someone adds revs 11 and 12, dev merges r12 to branch, and then when he merges back the system will calc the diff, thus overwriting r11 - which is what he told it to do).

Similarly, if #432 guy gets a conflict, tries to resolve it by telling the system to skip those revisions that someone dared to commit before him, then yes it woudl 'overwrite' them (its not actually overwriting them, its actually removing them - merging them out asif the dev had deleted the code himself)

The other aspect I may not get is that you branch off next-release, but your question refers to "#432 guy" merging with branches/on-QA-phase. Could this have something to do with the problem?

There is a Collabnet blog post that describes what Reintegrate is and how it works.

国产ˉ祖宗 2024-11-16 13:40:19

我们有一个非常相似的工作流程,但开发人员必须遵循几个关键步骤,以避免大部分合并的痛苦。与您的工作流程的主要区别在于,我们的每个开发人员都有一个长期存在的开发分支,这与您的案例分支类似。将修复/功能从开发分支合并到发布分支后,开发人员可以继续使用其开发分支来处理下一个修复/功能。总之,我们的工作流程如下:

注意: $SVN_REPOS 是一个环境变量,其中包含 Subversion 存储库的 URL。

从发布分支的 HEAD 为开发人员创建一个新的开发分支:

svn copy $SVN_REPOS/branches/release_branch $SVN_REPOS/branches/development_branch

开发人员检查他们的开发分支并在开发分支工作区域中实现他们的修复/功能 - 最好经常提交到存储库。

在将开发分支更改重新集成到发布分支之前,他们必须将对发布分支所做的任何新更改合并回其开发分支。这一步基本上是开发人员将其更改与创建开发分支以来所执行的工作集成的地方。我们对此有几个规则:

  • 一个干净的development_branch工作区域用于从发布分支进行合并,即所有修复/功能更改都已提交。拥有一个干净的工作区域可以避免与未提交的代码发生任何合并冲突。
  • 发布分支的合并发生在工作区目录树的根部。这避免了混合修订工作区域,并确保 svn:mergeinfo Subversion 属性记录在开发分支代码树的顶部。
  • 开发人员被教育要了解他们在这个阶段正在集成其他人的代码,因此他们需要仔细考虑冲突解决。如果以草率的方式解决冲突,那么这是失去其他开发商变更的主要国家。描述冲突解决步骤和典型场景的良好 wiki 页面也是一个好主意。
  • 从发布分支合并的更改已提交,无需进行任何其他修复/功能更改。这确保我们得到一个仅包含从发布分支合并的更改的单个修订提交,我们还有一个必须用于此提交的标准提交注释 - “从release_branch刷新开发分支”。这个单一的“仅合并更改”提交还可以在出现严重错误时轻松撤消合并,而不会丢失任何功能更改。

在进行了功能更改并刷新了开发分支后,开发人员现在要求将他们的更改合并到发布分支。我们有一个特定的人负责管理发布分支并执行开发分支的所有合并。他们将签出发布分支的新副本,并执行从开发分支到发布分支工作区域的重新集成合并。与我们所有的合并一样,这发生在代码树的根部。任何冲突都会发送回开发人员,而不会将任何内容提交到发布分支。开发人员需要从发布分支刷新其开发分支并解决冲突,然后再请求另一次合并到发布分支。 注意: 如果开发分支“过时”,svn merge --reintegrate 命令将在合并开始之前报告错误。

记录发布分支提交修订号,并将“阻塞”合并提交到开发分支。对于此示例,假设我们将development_branch更改提交到修订版112的发布分支。在开发分支的工作区域中:

svn merge --record-only -c 112 $SVN_REPOS/branches/release_branch
svn commit --depth=immediates . -m "Block development_branch to release_branch merge revision 112 from being merged back into rel_05_01_001"

这是长期存在的开发分支的关键。当开发人员下次使用新的发布分支更改更新其开发分支时,合并不会引入 rev 112,其中包含开发分支上已进行的更改。这避免了一大堆冲突。本质上,--record-only 合并让 Subversion 认为修订版 112 尚未合并到开发分支中,而事实上它只是一个标记,没有文件被合并。

总之,我们主要避免合并问题,因为我们总是合并到“干净”的工作区域并始终在代码树的顶部合并。 --record-only 技巧很方便,因为我们更愿意避免为每个修复/功能创建专用分支的开销。这是一篇很好的文章,它真正介绍了 Subversion 如何通过 mergeinfo Subversion 属性跟踪合并:

We have a very similar workflow, but there's few key steps which developers must follow to avoid most of the merging pain. The main difference to your workflow is that each of our developers has a long living development branch, which is similar to your case branches. After merging a fix/feature from the development branch to the release branch, the developer can continue using their development branch to work on the next fix/feature. In summary, our workflow is as follows:

Note: $SVN_REPOS is an environment variable containing the URL for our Subversion repository.

A new development branch is created for the developer from the HEAD of the release branch:

svn copy $SVN_REPOS/branches/release_branch $SVN_REPOS/branches/development_branch

The developer checks out their development branch and implements their fix/features in the development branch working area - preferably frequently committing to the repository.

Before reintegrating their development branch changes into the release branch, they must merge any new changes made to the release branch back to their development branch. This step is basically where the developer integrates their changes with work carried out since their development branch was created. We have a couple of rules for this:

  • A clean development_branch working area is used for merge from the release branch, i.e all fix/feature changes have been committed. Having a clean working area avoids any merge conflict with uncommitted code.
  • The merge from the release branch happens at the root of the working area directory tree. This avoids a mixed revision working area and ensures that the svn:mergeinfo Subversion property is recorded at the top of the development branch code tree.
  • Developers are educated to understand that they are integrating other peoples code at this stage, and therefore they need to consider conflict resolution carefully. This is prime country for losing other developers changes if conflict resolution is dealt with in a slap-dash manner. A good wiki page describing conflict resolution steps and typical scenarios is also a good idea.
  • The changes merged from the release branch are committed without any other fix/feature changes being made. This ensures we get a single revision commit containing just the changes merged from the release branch, we also have a standard commit comment which must be used for this commit - "Dev branch refresh from release_branch". This single "merge only changes" commit also makes it easy to undo the merge should things go badly wrong, without losing any functional changes.

Having made their functional changes and refreshed the development branch, the developer now asks for their changes to be merged to the release branch. We have a specific person who looks after the release branch and performs all merges from the development branches. They'll checkout a fresh copy of the release branch and perform the reintegration merge from the development branch into the release branch working area. As with all our merges, this happens at the root of the code tree. Any conflicts are sent back to the developer, without anything being committed to the release branch. The developer will need to refresh their development branch from the release branch and resolve the conflicts before requesting another merge to the release branch. Note: The svn merge --reintegrate command will report an error before the merge starts if the development branch is "out of date".

The release branch commit revision number is noted, and a "blocking" merge is comitted to the development branch. For this example, assume we commited the development_branch changes to the release branch at revision 112. In the working area for the development branch:

svn merge --record-only -c 112 $SVN_REPOS/branches/release_branch
svn commit --depth=immediates . -m "Block development_branch to release_branch merge revision 112 from being merged back into rel_05_01_001"

This is the key to a long living development branch. When the developer next updates their development branch with new release branch changes, the merge won't bring in rev 112, which contains changes already made on the development branch. This avoids a whole bunch of conflicts. Essentially the --record-only merge makes Subversion think revision 112 hasn't already been merged into the development branch, when in fact it's just a marker and no files have been merged.

In summary, we mostly avoid merge issues because we always merge into "clean" working areas and consistently merge at the top of the code tree. The --record-only trick is handy, as we prefer to avoid the overhead of creating a dedicate branch for each fix/feature. Here's a good article which really gets into how Subversion tracks merges via the mergeinfo Subversion property:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文