It's all about the answers!

Ask a question

RTC API to compare the Outgoing items in local repository and Delivered Items


Suresh P (1166) | asked Nov 28 '13, 12:29 a.m.
retagged Dec 16 '13, 11:50 a.m. by David Lafreniere (4.3k7)

Hi,

I am using RTC Client 3.0.1.

I'm writing a eclipse plugin, where we need to find the differences between the files in Outgoing list (checked in files) and the delivered files in remote repository (stream).

What are the RTC APIs need to be used to compare the files in Outgoing list and in Delivered list? Can you provide the code snippet to capture this comparison.

Thanks

Suresh

One answer



permanent link
Ralph Schoon (55.5k23642) | answered Nov 28 '13, 3:31 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Nov 28 '13, 3:32 a.m.
You can find some of the API with examples in http://rsjazz.wordpress.com/2013/10/15/extracting-an-archive-into-jazz-scm-using-the-plain-java-client-libraries/ and in related and referenced posts.

Please note, if you refer to local files that might have changed, you would likely have to scan the local file system and do the compare, instead of reading a zip file, to detect the unresolved changes. You can try to search the forums for more API.

Comments
Suresh P commented Nov 28 '13, 8:28 a.m.

HI Ralph,

Thanks for your response. I did referred the links suggested by you.

Most of those links point to using localRepo.CompareTo(targetStream, ...) method  which returns the IChangeHistorySyncReport object. Using this we can get Outgoing change sets, etc.

But what Im looking for is code to get the Differences between the outgoing items in local repository and the corresponding items in targetStream.

Something similar to "Compare with Loca Version" menu item when we click "Team->Show History" menu.

Can you give some details on how to find the differences in the files.

Thanks

Suresh


Ralph Schoon commented Nov 28 '13, 8:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Suresh,

as I answered already:

"Please note, if you refer to local files that might have changed, you would likely have to scan the local file system and do the compare, instead of reading a zip file, to detect the unresolved changes. You can try to search the forums for more API."

This is something that you need to code up, as far as I can tell. In my example I go through a ZIP file and compare the file in the zip and the the file in the repository workspace. I use the API that tells me there is a difference, so I can upload the new version. You would have to do something similar, go through the files on disk and compare to the repo workspace, or find the API in the RTC Eclipse Client that can do it for you. I don't know where to look. It would likely be easier to use the RTC SCM CLI.


Ralph Schoon commented Nov 28 '13, 8:40 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

And how I compare the files is described in the post.


Suresh P commented Dec 02 '13, 5:36 a.m.

Hi Ralph,

Let me rephrase the  question. What I am looking for  is suitable RTC APIs to Compare (to be specific get the Line differences) the modified files in Repository workspace (ie., outgoing list) and Stream. I have to compare these files at Server-side itself, without loading them to local machine.

The same functionality can be performed using RTC SCM CLI "diff" command as below:

diff -r <repo-url> stream <streamName> workspace <workspaceRepositoryName>

The logic for this "diff" command is available  in com.ibm.team.filesystem.cli.client.internal.subcommands.DiffCmd class.

But the logc used in Diff command class, uses some Internal APIs (like CreatePatchUtil.writeDiff, etc) which I want to avoid using.Can you guide me on this.Thanks -Suresh

 


Ralph Schoon commented Dec 02 '13, 5:46 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The mechanics how to access the data on the server is, as I believe in the blog. To do the actual diff, as tar as I can tell, the diff capabilities of the Eclipse client is used. I don't know if there is anything built into the server. Apparently something is in the Web UI, but I don't know where that API is, or if it is in the SDK. You could try to find information on that in the Eclipse forums (e.g. the class name). Then search the SDK using that name.

Your answer


Register or to post your answer.