Domanda

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.

È stato utile?

Soluzione 2

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

Altri suggerimenti

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.

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top