How to merge two or more streams

rtc
blue-sky picture blue-sky · Nov 30, 2012 · Viewed 7.2k times · Source

If I have two streams(called Stream1, Stream2) of development and I want to merge these two streams into one stream.

This is currently how I do it :

  1. Create a new Stream - Stream3. Stream 3 will contain a merge of Stream1 & Stream2
  2. Create a new repositroy workspace(called workspace1) from Stream3
  3. Set flow target of workspace1 to Stream1
  4. Within 'Pending Changes' all of the change sets which were available in Stream1 but not in Stream2 should now appear as change sets which can be delivered to Stream3

Is this best practice for merging 2 or more streams or is there more elegant method?

Answer

VonC picture VonC · Nov 30, 2012

Create a new stream??? No need.

When you open a repo workspace, you have a section called "Flow targets", which contains by your Stream (characterized as "Default").

Add to it the Stream source (the Stream from which you want to merge), set it as "current", and you will see in your "Pending changes" view an "Incoming" section with all the change sets or baselines coming from that source Stream.

The idea is for you to accept those change set, load them in your local workspace and test them (compilation and test), and then deliver them back to your default stream.

The "Accept" phase is where the merge occurs (automatically, or manually if conflicts).
As mentioned in this thread:

The merge algorithm in RTC is logically the same as is found in ClearCase, i.e., given a configuration (stream, workspace) that selects a different version of a given file, find the common ancestor of the two versions, and then do a 3-way merge.
Changing the "flow target" of a workspace is just RTC's way of letting you specify what branch (stream) you want to merge into your workspace (cleartool findmerge gives you the same flexibility).
Note that ClearCase and RTC use a different common ancestor algorithm.

The last step supposes you go back to your "Flow target" section, and set back as "current" the default Stream.

I prefer this workflow to this one:

merge

Here Brent would set as current the destination stream in order to deliver the result of the merge. That is an alternative workflow, also described in "How to keep your streams flowing smoothly in Rational Team Concert 3.0.1".