It's all about the answers!

Ask a question

Automatic code merges when merging streams


Kris Vishwanathan (61) | asked Apr 11 '11, 4:50 p.m.
We are trying to explore if its possible to do code merges automatically between the streams. We tried changing flow targets and delivering code, but that's more of a manual intervention.

Is there a way to merge the changes automatically and only require manual intervention if there are code conflicts.

If not did someone explore writing an extension to do so.

Appreciate your inputs in advance.

Thanks
Kris Vishwanathan

11 answers



permanent link
Geoffrey Clemm (30.1k33035) | answered Apr 11 '11, 8:10 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
To do code merges, you have to have a workspace, i.e. accept changes
from both streams into the workspace, resolve those changes, and then
deliver the result (to one or both of the streams).

You can use the command line to resolve the conflict with "proposed" or
"mine", but I don't believe there is any way to invoke the automatic
merge from the command line. One approach would be to use the "scm
diff" command to determine the differences, invoke your own program to
do the auto-merge, and then use the command line to checkin the result.

Cheers,
Geoff

On 4/11/2011 4:53 PM, v2kris wrote:
We are trying to explore if its possible to do code merges
automatically between the streams. We tried changing flow targets and
delivering code, but that's more of a manual intervention.

Is there a way to merge the changes automatically and only require
manual intervention if there are code conflicts.

If not did someone explore writing an extension to do so.

Appreciate your inputs in advance.

Thanks
Kris Vishwanathan

permanent link
Kris Vishwanathan (61) | answered Apr 12 '11, 12:16 p.m.
Hi Geoff
I guess the conflict will only arise when there is a code change in the same code fragment, but if the same file changed in two different places, its not necessarily conflict right? I was hoping as long as same code is not changed the merge should happen automatically, if not may send an email notification. Is that a reasonable thing to automate, and is it possible?

Thanks
Kris
To do code merges, you have to have a workspace, i.e. accept changes
from both streams into the workspace, resolve those changes, and then
deliver the result (to one or both of the streams).

You can use the command line to resolve the conflict with "proposed" or
"mine", but I don't believe there is any way to invoke the automatic
merge from the command line. One approach would be to use the "scm
diff" command to determine the differences, invoke your own program to
do the auto-merge, and then use the command line to checkin the result.

Cheers,
Geoff

On 4/11/2011 4:53 PM, v2kris wrote:
We are trying to explore if its possible to do code merges
automatically between the streams. We tried changing flow targets and
delivering code, but that's more of a manual intervention.

Is there a way to merge the changes automatically and only require
manual intervention if there are code conflicts.

If not did someone explore writing an extension to do so.

Appreciate your inputs in advance.

Thanks
Kris Vishwanathan

permanent link
Scott Chapman (3216547) | answered Jun 07 '11, 3:59 p.m.
Hey Kris, I am also looking for this same functionality. I am a bit surprised that no one has created a script to accomplish this...

Let me know what you end up with, and if I get something working in the mean time I will let you know...

Hi Geoff
I guess the conflict will only arise when there is a code change in the same code fragment, but if the same file changed in two different places, its not necessarily conflict right? I was hoping as long as same code is not changed the merge should happen automatically, if not may send an email notification. Is that a reasonable thing to automate, and is it possible?

Thanks
Kris
To do code merges, you have to have a workspace, i.e. accept changes
from both streams into the workspace, resolve those changes, and then
deliver the result (to one or both of the streams).

You can use the command line to resolve the conflict with "proposed" or
"mine", but I don't believe there is any way to invoke the automatic
merge from the command line. One approach would be to use the "scm
diff" command to determine the differences, invoke your own program to
do the auto-merge, and then use the command line to checkin the result.

Cheers,
Geoff

On 4/11/2011 4:53 PM, v2kris wrote:
We are trying to explore if its possible to do code merges
automatically between the streams. We tried changing flow targets and
delivering code, but that's more of a manual intervention.

Is there a way to merge the changes automatically and only require
manual intervention if there are code conflicts.

If not did someone explore writing an extension to do so.

Appreciate your inputs in advance.

Thanks
Kris Vishwanathan

permanent link
Tim Mok (6.6k38) | answered Jun 07 '11, 4:42 p.m.
JAZZ DEVELOPER
Hi Geoff
I guess the conflict will only arise when there is a code change in the same code fragment, but if the same file changed in two different places, its not necessarily conflict right? I was hoping as long as same code is not changed the merge should happen automatically, if not may send an email notification. Is that a reasonable thing to automate, and is it possible?

Thanks
Kris
That kind of change can be auto-resolved in the Eclipse UI but the operation still needs user input to decide whether to auto-resolve or let the user manually resolve. So the process of accepting a potential conflict and resolving isn't automatic but the resolution can be automatic if it is the right type of conflict.

permanent link
Scott Chapman (3216547) | answered Jun 09 '11, 8:50 a.m.
That's essentially what we are looking for; the ability to have a script which will effectively do auto-resolve in the same fashion as the eclipse client, unless it cannot. The idea would be to use the script in a build definition to automate the delivery of changes from one stream to another.

I think we understand the circumstances where this will operate effectively. And in those circumstances the ability to send email, and allow human intervention to resolve is understandable and acceptable. In my case I have some maintenance streams which don't see a lot of changes, my manual merging between the streams has always been to auto-resolve in the eclipse UI.

Make sense?

Just looking to automate that,

Hi Geoff
I guess the conflict will only arise when there is a code change in the same code fragment, but if the same file changed in two different places, its not necessarily conflict right? I was hoping as long as same code is not changed the merge should happen automatically, if not may send an email notification. Is that a reasonable thing to automate, and is it possible?

Thanks
Kris
That kind of change can be auto-resolved in the Eclipse UI but the operation still needs user input to decide whether to auto-resolve or let the user manually resolve. So the process of accepting a potential conflict and resolving isn't automatic but the resolution can be automatic if it is the right type of conflict.

permanent link
Geoffrey Clemm (30.1k33035) | answered Jun 09 '11, 11:08 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I've submitted work item 168695 requesting this capability from the scm
command line.

Cheers,
Geoff

On 6/9/2011 8:53 AM, scottchapman wrote:
That's essentially what we are looking for; the ability to have a
script which will effectively do auto-resolve in the same fashion as
the eclipse client, unless it cannot. The idea would be to use the
script in a build definition to automate the delivery of changes from
one stream to another.

I think we understand the circumstances where this will operate
effectively. And in those circumstances the ability to send email,
and allow human intervention to resolve is understandable and
acceptable. In my case I have some maintenance streams which don't
see a lot of changes, my manual merging between the streams has
always been to auto-resolve in the eclipse UI.

Make sense?

Just looking to automate that,

tmokwrote:
Hi Geoff
I guess the conflict will only arise when there is a code change in
the same code fragment, but if the same file changed in two different
places, its not necessarily conflict right? I was hoping as long as
same code is not changed the merge should happen automatically, if
not may send an email notification. Is that a reasonable thing to
automate, and is it possible?

Thanks
KrisThat kind of change can be auto-resolved in the Eclipse UI but
the operation still needs user input to decide whether to
auto-resolve or let the user manually resolve. So the process of
accepting a potential conflict and resolving isn't automatic but the
resolution can be automatic if it is the right type of
conflict.


permanent link
Evan Hughes (2.4k1318) | answered Jun 13 '11, 9:46 a.m.
JAZZ DEVELOPER
'scm accept' will merge non-conflicting changes within files.

e

permanent link
Scott Chapman (3216547) | answered Jun 13 '11, 9:57 a.m.
'scm accept' will merge non-conflicting changes within files.

e


Accept is only one part of it. The steps we do in the eclipse client are:
1) change current flow target to maintenance stream.
2) accept all incoming
3) change current flow target to current dev stream
4) deliver all outgoing

The additional behavior (some of which might come from the build definition)
1) if auto-resolve can't be done STOP (to avoid partial deliveries)
2) send email when it doesn't complete sucessfully

permanent link
Tim Mok (6.6k38) | answered Jun 13 '11, 10:42 a.m.
JAZZ DEVELOPER
'scm accept' will merge non-conflicting changes within files.

e


Accept is only one part of it. The steps we do in the eclipse client are:
1) change current flow target to maintenance stream.
2) accept all incoming
3) change current flow target to current dev stream
4) deliver all outgoing

The additional behavior (some of which might come from the build definition)
1) if auto-resolve can't be done STOP (to avoid partial deliveries)
2) send email when it doesn't complete sucessfullyIt sounds like your logic is from the perspective of the Eclipse UI. If you take a look at the command-line client, the syntax for 'scm accept' and 'scm deliver' requires source and target workspaces. So you wouldn't have to change flow targets and it sounds feasible to write that script.

permanent link
Scott Chapman (3216547) | answered Jul 06 '11, 3:17 p.m.
'scm accept' will merge non-conflicting changes within files.

e


So, our script takes a workspace, and two streams to merge. It first accepts all changes from StreamA and then attempts to deliver to StreamB.

We generated a conflict which can easily be resolved (auto-resolve in the eclipse client does the right thing).

Instead the script fails because there is a conflict.

I do not see how, by using the CLI, one can automate what the eclipse client does.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.