version-controlperforceperforce-integrateperforce-stream

How to solve a specific situation in Perforce involving changes which I do not want to be propagated to other branches?


So, here's the situation. I have 2 streams, "Development.Main" and "Development.A" (child of Development.Main). I will focus only on the "path" that one file took through my "versioning" steps that I executed.

  1. The file starts out in Main.
  2. I merge it down to A with no changes.
  3. I delete it in Main.
  4. When I go to merge the changes in Main down to A, I choose to "Keep Target", so that the file remains undeleted in A, because I want the file deleted in Main, but not in A.
  5. But then the Perforce stream diagram tells me that I have files to copy from A to Main (see the green arrow). And when I go to do the Copy operation (from A to Main) it wants to copy the file back into Main, thereby regenerating it. But I want it to stay deleted. Note that, when I try to force a merge (instead of a copy) from A to Main, Perforce thinks that there is nothing to merge and it decides to respond with an error. See image #3 below

1 - Stream Diagram

Stream Diagram

2 - Revision Graph

Revision Graph

3 - Trying to force the merge from A to Main

Error when trying to force merge

How do I solve this situation, so that I can delete the file in Main but not in A?

Conditions for the solution:

  1. I want all green arrows to go away on the stream diagram.
  2. From now on, I don't want this file to show up in the Copy (from A to Main) operation. (Because I don't want this file to show up in Main again. It's supposed to be deleted there.)
  3. I don't want to change anything about the stream spec or workspace spec just for this specific file.

Solution

  • There are two ways to do this:

    Option one (general solution):

    Don't ever do the copy operation between these two streams. The merge/copy workflow is not compatible with the idea of "ignoring" changes, because as soon as you copy you force the two streams to be identical regardless of what has previously been ignored.

    Fortunately, streams have a mergeany option that allows you to opt out of the merge/copy workflow, so you can instead merge/merge without having to use the -F (force) flag each time -- this was the standard Perforce workflow before streams existed. When you merge, previously "ignored" revisions will not be merged, nor will revisions that were themselves the product of an "ignore" in the reverse direction (i.e. your ignored delete will not re-propagate as an add if you're doing a merge).

    The ability to "ignore" branch/delete operations in this way is described in more detail here (again, note that this only works with merge/integrate, not copy): https://web.archive.org/web/20141020052100/http://www.perforce.com:80/blog/110620/ignoring-branches-deletes

    Option two (for entire files only):

    Since this is an entire file that you don't want to propagate, rather than a specific revision, you can isolate it in Development.A's Paths. This will remove it from the integration view so that no changes made to that file will propagate (in either direction, regardless of whether you're merging or copying). From the point of view of the copy, this file is simply no longer part of your stream.