Perforce - 删除每个给定变更列表范围的增量
我有一个大背景的小问题。让我问一个简短的版本,然后再扩展一下。
我的问题的简短版本如下。
想象一种情况 - 您的分支 A 的变更列表为 1000 到 1004。然后您从变更列表 1004 创建分支 B 并添加更多修订(1005、1006)。之后,您需要从分支 B 中删除由变更列表 1002 引入的增量。我该怎么做?如果我在分支 A 上需要它 - 没问题,只需回滚到 1001 并重新集成 1003-1004。但我需要删除由历史记录中没有此变更列表的分支上的变更列表引入的增量。那么如何才能做到这种“选择性删除”呢?
我的问题的歌词背景如下。 早在我还是 ClearCase 工程师的时候,我有时会使用一种称为“减法合并”的功能。我调用了“merge”命令,指向两个版本来识别增量和一个表示“删除”之类的标志(这是几年前的事,我忘记了确切的标志)。它所做的是删除了指向的增量,无论该增量何时实际引入 - 1 次提交或一年前。所以这是一个减法合并,可以用作回滚而不删除任何版本,有点“删除”一些增量。
现在我使用 Perforce,我可以看到“回滚”命令,该命令允许创建一个更改列表,将增量从“现在”删除回我指定的更改列表。当您需要删除一些增量时,Perforce 知识库建议您这样做。如果您需要删除一系列变更列表,则需要将整个变更列表堆栈从“现在”回滚到前一个变更列表,然后重新集成除您想要丢弃的变更列表之外的所有内容。因此 - 删除 N 个变更列表,然后重新集成 N-1 个变更列表。我不知道......这对我来说看起来像是一个开销。
那么请问有经验的Perforce用户,你们知道如何在Perforce中进行“减法集成”吗?
先感谢您。
I got a small question with a big background. Let me ask a short version and then expand it a little bit.
Short version of my question is as follows.
Imagine a situation - you have branch A with changelists 1000 to 1004. Then you make branch B from changelist 1004 and add a couple of more revisions (1005, 1006). After that you need to remove delta introduced by changelist 1002 from branch B. How can I do it? If I needed that on branch A - no problem, just Rollback to 1001 and re-integrate 1003-1004. But I need to remove a delta that was introduced by a changelist on a branch that does not have this changelist in its history. So how can I do this "selective delete"?
The lyric background of my question is as follows.
Back in the old days when I was a ClearCase engineer, I sometimes used a feature called 'subtractive merge'. I called "merge" command, pointed 2 versions to identify a delta and a flag that said something like "remove" (this was a few years ago, I forgot the exact flag). What it did is that it removed the pointed delta regardless of when that delta was actually introduced - 1 commit away or a year ago. So it's a subtractive merge that might be used as a rollback without deleting any versions, kinda "cut away" some delta.
Now I use Perforce and I can see "Rollback" command that allows make a changelist that removes a delta from "now" back to a changelist that I specify. And that's how Perforce knowledge base advises to do when you need to remove some delta. And if you need to remove a range of changelists, you need to rollback that whole changelists' stack from "now" back to the predecessor changelist and then integrate back everything except for the changelist you wanted to throw away. So - remove N changelists, and then integrate back N-1 changelist. I don't know... That is looks like an overhead for me.
So I ask experiences Perforce users, do you know how to do "subtractive integrate" in Perforce?
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果我这样做,我会在变更列表 1001 处基于分支 A 创建一个分支 C。然后,我会将必要的额外工作从分支 A 和 B 拉到 C,当然,不会从 A 拉动变更列表 1002。
If I were doing this, I'd make a branch C based on branch A at changelist 1001. Then I'd pull the necessary additional work from branches A and B to C, without, of course, pulling changelist 1002 from A.
将 1001(使用 -i 标志忽略以前的集成历史记录)重新集成到分支 B 中,并获取 1001 中的所有更改,在分支 B 上创建 1007 更改列表。然后在此基础上重新集成 1005 和 1006。除非1005和1006触及1002-1004中的一些变化,否则你可能必须更有选择性。
Reintegrate 1001(using the -i flag to ignore previous integration history) into branch B, and take all changes from 1001, making a 1007 changelist on branch B. Then reintegrate 1005 and 1006 on top of that. Unless 1005 and 1006 touch some of the changes in 1002-1004, then you may have to be more selective.
似乎我错过了就在我眼前的关键 Perforce 功能...“Back Out Submitted Changelist #####”做了正确的事情。请参阅 “回滚.. .”和 Perforce P4V 中的“退出提交的变更列表 #####”
Seems like I missed the key Perforce feature which was right in front of my eyes... "Back Out Submitted Changelist #####" does the right thing. See What is the difference between "Rollback..." and "Back Out Submitted Changelist #####" in Perforce P4V