在 Perforce 中合并/解析时如何集成每个变更列表?

发布于 2024-11-06 07:26:34 字数 288 浏览 0 评论 0原文

我对 Perforce 相当陌生,但我已经有使用 Git 和 Mercurial 等 DVCS 的经验,并且熟悉 Perforce 的基本原理。

今天我玩了一下 p4v,并使用 Integrate... 函数创建了一些播放代码的分支。后来我修改了源分支,并希望将这些更改也集成到新分支中。然而,所有单个变更列表都被合并为一个大变更列表。这对我来说似乎不是最佳实践。如果您开发一个功能或修复错误,您自然会有多个提交,因为每个提交都应该是原子的。

合并或解析时如何保留整个变更列表?

I'm fairly new to Perforce but I already have experience with DVCS like Git and Mercurial and I'm familiar with the basic principles of Perforce.

I played a bit with p4v today and made a branch of some play code by using the Integrate... function. I later modified the source branch and wanted to integrate those changes to the new branch as well. However, all single changelists were consolidated to one big changelist. That doesn't seem best practice to me. If you develop a feature or a bug fix you will naturally have multiple submits because each submit should be atomic.

How can I preserve the whole changelist when I merge or resolve?

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

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

发布评论

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

评论(2

静待花开 2024-11-13 07:26:34

“最佳实践”取决于您的工作流程以及分支机构的设置方式。确实有适当的时机让单个变更列表包含所有集成的变更列表 - 当创建“功能”分支时,我们在工作室中经常这样做,并且分支需要最新的主线代码。另一方面,当您需要将特定修复或功能分支到发布分支时,每个变更列表集成在产品周期结束时非常有用。

通过变更列表进行集成很简单:

  1. 在“已提交的变更列表”窗格中找到要提交的变更列表 (ctrl-2)
  2. 右键单击​​该变更列表并选择“使用提交的变更列表 NNN 进行集成”
  3. 在后续对话框中设置您需要的任何选项。

从那里您可以预览和/或运行集成。作为提示,我总是先预览集成。这将记录您在进行实际集成之前可能想要处理的潜在错误或警告情况。

这种一次集成变更列表的方法称为“樱桃采摘”。 Perforce 在此处有一篇关于挑选变更列表的精彩知识库文章。

"Best practice" depends on your workflow and how your branches are set up. There are indeed proper times to have a single changelist contain all of the integrated changelists - we do this quite a bit at our studio when creating "feature" branches and the branch needs the latest and up to date mainline code. On the other hand, per changelist integration can be very useful at the end of a product cycle when you need to branch specific fixes or features to a release branch.

Integration by changelist is easy:

  1. Find the changelist you want to submit in the "submitted changelist" pane (ctrl-2)
  2. Right click the changelist and choose "integrate using submitted changelist NNN"
  3. Set any options that you need in the subsequent dialog.

From there you can either then preview and/or run the integrate. As a tip, I always preview the integration first. That will note potential errors or warning conditions that you might want to deal with before doing the actual integrate.

This method of integrating a changelist at a time is called "cherry picking". Perforce has a great knowledge base article about cherry picking changelists here.

思念绕指尖 2024-11-13 07:26:34

这是好事还是坏事,取决于你的发展方式。有时你想要选择性地做出改变,有时你想要一切。

如果您只想合并 1 个更改列表,请在集成屏幕上展开显示“限制集成范围”的箭头,然后您可以选择集成哪些文件。如果您只需要 1 个变更列表,请选择“仅集成修订版本”,然后仅选择两个变更列表。正如您所看到的,您还可以通过修订、日期、标签和工作区来完成此操作。这样就非常灵活了。

Depending on how you develop, that is a good thing or a bad thing. Sometimes you want to cherry pick changes, othertimes you want everything.

If you only want 1 changelist to be merged, on the integrate screen, expand the arrow that says "Limit the range of the integration" Then you can choose which files get integrated. If you only want 1 changelist, select the "Integrate only revisions between" and select just your changelist for both. As you can see, you can also do it by revision, date, label, and workspace. It's very flexible that way.

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