It's all about the answers!

Ask a question

Merge in RTC API


Petr Dolezel (612) | asked Jan 29 '15, 5:57 a.m.
edited Aug 04 '16, 9:35 p.m. by David Lafreniere (4.8k7)
Hi all,

I usually work in Eclipse RTC plugin. If I accept changeset and there is a conflict I can list conflicting files and resolve them:

1) Merge manually in external application and then Resolve as merged
2) I can Resolve with mine
3) Resolve with proposed

How can I do these operations via RTC API in java? I tried save or markAsMerged operations with configurationOpFactory but without success. Can anyone tell me what operations and in which order I have to do for all three cases? Imagine please I already accepted changeset and have one unresolved conflict with file.txt. What should I do if I want merge it manually and then resolve as merged, or if I want resolve with mine or resolve with proposed?

And one another question. From IItemConflictReport I can read CommonAncestorState, ProposedContributor and then SelectedContributor and OriginalSelectedContributor. What is the difference in SelectedContributor and OriginalSelectedContributor. I understand that OriginalSelectedContributor is "mine" according to Eclipse IDE. I am right? And what is SelectedContributor???

Thanks for help...

Comments
Donald Nong commented Jan 30 '15, 5:25 a.m.

When using the API, are you going to merge automatically or manually? If manually, I suppose you need to pop up a GUI for the user to interact, right?

2 answers



permanent link
Paul Schitz (112) | answered Aug 04 '16, 5:41 a.m.
 Hi I know that this question is old but I dont wanted to open a new question. 
Can I do a automatic merge with the api but without any manual interaction?

permanent link
Petr Dolezel (612) | answered Jan 30 '15, 6:29 a.m.
edited Jan 30 '15, 6:31 a.m.
When using the API, are you going to merge automatically or manually? If manually, I suppose you need to pop up a GUI for the user to interact, right?

Hi Donald,

Thanks for response. Yes I can do it (use third party software for merging) very easily. But what to do with the result? I finally managed to make a merge; however, I don't think I did it in right way. 

1) I downloaded all four versions (ancestor, proposed, selected, originalselected) and saved it in files. (still not sure what selected and originalselected means)
2) These files are sent to merge application and the result is saved in originalselected file.
3) I change content of originalselected versionable to corespond with originalselected file - the result from merging process.
4) I call save operation with workingcopy of the originalselected file:
ISaveOp saveOp = workspace_target.configurationOpFactory().save(fileWorkingCopy);
	
5) I call markAsMerged operation with working copy of that file:
IMarkAsMergedOp markAsMergedOp = workspace_target.configurationOpFactory().markAsMerged(fileWorkingCopy, versionable_selected, versionable_proposed);
	
I have no idea what (and why) I have to provide selected and proposed versionables to that method.
6) First I commit markAsMergedOp - result from markAsMerged operation:
workspace_target.commit(newChangeSetHandle, Collections.singletonList(markAsMergedOp), monitor);
	
7) Then I commit saveOp - result of save operation:
workspace_target.commit(newChangeSetHandle, Collections.singletonList(saveOp), monitor);
	
It works as expected but I don't think it is correct procedure. What do you think? Is there a better way to do it? 
In this case I can do Resolve with mine and also Resolve with proposed, but again it seems to me ilogical - but works :)

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.