4

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):

  • I managed to access the Synchronize-View via TeamUI.getSynchronizeManager(), but not the changesets.

  • An other thing I tried was to get the cangesets via FocusedTeamUiPlugin.getDefault().getContextChangeSetManagers() (got the manager and then the ChangeSetProvider where I tried to get the ChangeSets) - but they always are empty (because they are created when I first call it).

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!

wandarkaf
  • 1,839
  • 20
  • 30
casaout
  • 1,819
  • 3
  • 24
  • 54

3 Answers3

3

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

durron597
  • 31,968
  • 17
  • 99
  • 158
1

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
minopret
  • 4,726
  • 21
  • 34
1

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.

JuergenKie
  • 109
  • 1
  • 10