Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to merge two or more streams

Tags:

rtc

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?

like image 356
blue-sky Avatar asked Nov 30 '12 14:11

blue-sky


People also ask

How do I concatenate 3 streams?

With three streams we could write Stream. concat(Stream. concat(a, b), c) .

How do I concatenate two streams?

Stream. concat() method creates a concatenated stream in which the elements are all the elements of the first stream followed by all the elements of the second stream. The resulting stream is ordered if both of the input streams are ordered, and parallel if either of the input streams is parallel. The calls to Stream.

Can you merge streams?

3.1. Merging Streams. Since it is an instance method, we can easily chain it and append multiple streams. Note that we could also create a List out of the stream by using toList() if we type the resultingStream variable to the StreamEx type.

Which stream is used to merge multiple streams?

The concat() method is a static method of the Stream Interface that can be used to merge two streams into a single stream. The merged stream contains all the elements of the first stream, followed by all the elements of the second stream. If both the streams are ordered, then the merged stream will be ordered.


1 Answers

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".

like image 54
VonC Avatar answered Oct 18 '22 20:10

VonC