casaout
casaout

Reputation: 1849

How to access ChangeSets in Eclipse (Mylyn/Team)?

I want to access the ChangeSets of SVN, CVS and Git programatically via Java. I.e. I want the data which is shown in the "Synchronize"-view.

I tried several approaches to find the correct usage in the code, and here's the few documentation I could find (but without success):

So, how can I access ChangeSets (with Java) in Eclipse (Mylyn)? In the end, I need the number of commits and code churn (loC added/removed/edited). Or is there probably an other, better approach?

Any help is appreciated really much!

Upvotes: 4

Views: 1044

Answers (3)

JuergenKie
JuergenKie

Reputation: 109

I've looking for this for 1 month now. I tried to programm a plugin for eclipse, which is able to read the changeset of a Project ("working copy" of the repository).

What I've done now is an ugly work-around.

I used Runtime.exec() to run a cmd-command / Shell- command. If you install a svn-commandline Client, you can type svn status -v -u It gives you a list of all files of the working copy with the changeset info.

Then you can parse through the list to find all lines which start with "M" - for "modified" to get the Path of the changed file.

Upvotes: 1

minopret
minopret

Reputation: 4806

You could perhaps go around Eclipse:

  • Apply rsync to get the CVS "*,v" files from the CVS server. It works for me.
  • Apply cvs2svn's "cvs2git" command to the CVS repos. It works for me.
  • Apply "git svn clone" (documented under "git-svn") to the SVN repos. I have not tried it.
  • Finally, use JGit's API to get the changesets from all of the repos, which at this point are all git repos. I think you'll particularly need these:
    • class Git
    • class FileResolver
    • class BaseConnection
    • interface Repository
    • class CheckoutCommand
    • class LogCommand
    • class RevCommit
    • class DiffCommand
    • class DiffEntry
    • class DiffFormatter

Upvotes: 1

durron597
durron597

Reputation: 32323

I don't think Eclipse has implemented this feature as a public API yet. However, these links may help:

Internal changeset class and other API: http://www.cct.lsu.edu/~rguidry/ecl31docs/api/index.html?org/eclipse/team/internal/core/subscribers/ChangeSet.html

A feature enhancement request where they talk about why they haven't implemented it yet (but it's dated 2008, however the bug is still open?) https://bugs.eclipse.org/bugs/show_bug.cgi?id=116084

Sorry I couldn't be of more help! Maybe this will help you in the right direction...

Upvotes: 3

Related Questions