Perforce:如何跨多个分支集成?

发布于 2024-09-26 22:27:46 字数 786 浏览 2 评论 0原文

我在 Perforce 存储库中的分支情况如下:有一个主线“主干”和两个发布分支“1.0”和“1.1”。具有客户特定更改的分支“客户”已从 1.0 分支中分支出来。现在客户想要升级到 1.1 版本。如何将 1.1 分支合并到 customer 分支?客户特定的更改应保持在 1.1 的“之上”。

下面是一个受影响文件的图表:

1.1                      -(1)---(2)---(3)
                        /           \     \
                       /             \     \
trunk   100--(101)-(102)--103---104---105---106---107
           \
            \
1.0          ---1-----2--...
                 \
                  \
customer           ---1-----2----*3*

我正在查看的文件的当前版本是客户分支上的修订版 3。

如果我选择将分支“1.1”与目标“客户”集成,我会期望找到两者的共同祖先(主线上的修订版 100),并且从那里导致 1.1 分支尖端的所有修订都会合并(括号内)。

相反,Perforce 只提供合并 1.1 分支的修订版本 1 到 3,这会失败,因为它错过了之前在主线上发生的必要更改。

我如何说服 Perforce 执行此操作,而无需手动查看每个文件并选择要合并的修订版本?也许分支策略不合适?我还应该做什么?

I have the following situation of branches in a Perforce repository: There’s a mainline “trunk” and two release branches “1.0” and “1.1”. A branch “customer” with customer specific changes has been branched off the 1.0 branch. Now the customer wants to move to version 1.1. How can I merge the 1.1 branch into the customer branch? The customer specific changes should remain “on top” of 1.1.

Here’s a diagram for one affected file:

1.1                      -(1)---(2)---(3)
                        /           \     \
                       /             \     \
trunk   100--(101)-(102)--103---104---105---106---107
           \
            \
1.0          ---1-----2--...
                 \
                  \
customer           ---1-----2----*3*

The current version of the file I’m looking at is revision 3 on the customer branch.

If I choose to integrate branch “1.1” with target “customer” I would have expected that the common ancestor of both is found (revision 100 on mainline) and all revisions from there leading to the tip of the 1.1 branch are merged (the ones in parentheses).

Instead Perforce only offers to merge revisions 1 to 3 of the 1.1 branch, which fails because it misses the necessary changes that happened on mainline before.

How can I persuade Perforce to do this without having to look at each file manually and selecting the revisions to merge? Maybe the branching strategy is unsuitable? What else should I do?

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

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

发布评论

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

评论(3

奢望 2024-10-03 22:27:46

当您尝试从 1.1 分支集成修订版 3 时,Perforce 只会告诉您它正在集成该特定分支上的更改 - 但修订版 1 已经包含主干修订版 101 和 102。合并时,Perforce 会将主干修订版 100 识别为通用版本解决冲突的祖先。

根据我的经验,您尝试进行的集成应该可以正常工作。您是否发现集成源中缺少更改(无法通过不正确的冲突解决来解释),或者您只是查看 p4 交换 的输出?

When you try to integrate revision 3 from your 1.1 branch, Perforce will only tell you that it's integrating changes on that particular branch -- but revision 1 already contains trunk revisions 101 and 102. When merging, Perforce will identify trunk revision 100 as the common ancestor for conflict resolution.

It's been my experience that the integration you're trying to do should Just Work. Are you seeing changes missing in your integrated source (that can't be explained by improper conflict resolution), or are you just looking at the output of p4 interchanges?

乖乖哒 2024-10-03 22:27:46

我强烈建议尝试将客户的更改合并到主干中。当几个月后客户想要升级到 2.0 + 他们的自定义更改时,这将继续成为维护噩梦。

如果您不希望客户更改反映在您的主项目中,请花时间重组代码,以便您可以使用构建标志或构建配置文件公开客户所需的行为。让两种构建配置在 CI 中运行,以确保未来的更改不会破坏客户的构建。

I'd strongly suggest trying to merge the customer's changes into the trunk. It's going to continue to be a maintenance nightmare when a few months down the line the customer wants to upgrade to 2.0 + their custom changes.

If you don't want the customer changes reflected in your main project, take the time to restructure the code so that you can expose the customer's desired behavior with a build flag or build configuration file. Have both build configurations running in CI to ensure that future changes don't break the customer's build.

柳絮泡泡 2024-10-03 22:27:46

为了使集成变得容易,我将创建一个特定的分支 trunk_to_custer 和 1.1_to_customer,然后发出:

cd customer-workspace
p4 integ -b trunk_to_customer @change-number-at-which-1.1-was-branched
p4 resolve

也许在这里进行中间提交,然后

p4 integ -b 1.1_to_customer 
p4 resolve
p4 submit

To make integrations easy, I would create a specific branches trunk_to_custer and 1.1_to_customer and then issue:

cd customer-workspace
p4 integ -b trunk_to_customer @change-number-at-which-1.1-was-branched
p4 resolve

perhaps an in-between submit here, and then

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