Propagate changes

Streams enable you to isolate stable code from work in progress, and to work concurrently on various projects without impediment. Best practice is to periodically update less stable streams from streams that are more stable (by merging), then promote changes to the more stable stream (by copying). Merging and copying are streamlined forms of integration. In general, propagate change as follows:

  • For copying and branching, use p4 copy or p4 populate.
  • For merging, use p4 merge.
  • For edge cases not addressed by p4 merge or p4 copy, use p4 integrate.

The preceding guidelines apply to classic Helix Core Server as well.

Merge changes from a more stable stream

To update a stream with changes from a more stable stream, issue the p4 merge -S source-stream command, resolve as required, and submit the resulting changelist. By default, you cannot copy changes to a more stable stream until you have merged any incoming changes from the intended target. This practice ensures that you do not inadvertently overwrite any of the contents of the more stable stream.

Assuming changes have been checked into the mainline after you started working in the development stream (and assuming your workspace is set to a development stream), you can incorporate the changes into the development stream by issuing the following commands:

p4 mergep4 resolvep4 submit -d "Merged latest changes"

Copy changes to a more stable stream

After merging, your stream is up to date with its more stable parent or child. Assuming you’ve finalized the changes you want to make in the development stream, you can now promote its new content with no danger of overwriting work in the target stream. The copy operation simply propagates a duplicate of the source to the target, with no resolve required. For example, (and assuming your workspace is set to a mainline parent stream) to promote changes from the development stream to its parent mainline, issue the following commands:

p4 copy --from //Acme/devp4 submit -d "Check my new feature in"

Compare changes between streams

Using the p4 interchanges command, you can compare changes between streams to look for outstanding merges. Suppose you have a mainline stream //Acme/main and its child, a development stream, //Acme/dev. The following command tells you which changes exist in //Acme/dev but not in its parent stream:

p4 interchanges -S //Acme/dev

The following command tells you which changes exist in the parent of //Acme/dev but not in //Acme/dev:

p4 interchanges -S -r //Acme/dev

Propagate change across the stream hierarchy

You might need to propagate a specific change between two streams that do not have a parent-child relationship in the stream hierarchyClosed The set of parent-to-child relationships between streams in a stream depot.. For example, to obtain an in-progress feature or bug fix from a peer development stream. To merge from or copy to such a stream, you can re-parent your stream by editing its specification and setting the Parent field to the desired source or target. This practice is not considered optimal but might be necessary.

Alternatively, you can use the -P option with the p4 merge command to do a one-off merge of the streams.