4

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

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

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

4

2 回答 2

8

"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.

于 2011-05-12T13:33:37.843 回答
1

这取决于你的发展方式,这是好事还是坏事。有时你想挑选变化,有时你想要一切。

如果您只想合并 1 个更改列表,请在集成屏幕上展开“限制集成范围”的箭头,然后您可以选择要集成的文件。如果您只需要 1 个更改列表,请选择“仅在两者之间集成修订”,然后只为两者选择您的更改列表。如您所见,您还可以通过修订、日期、标签和工作区来执行此操作。这种方式非常灵活。

于 2011-05-12T13:06:56.627 回答