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

I want to access SVN, CVS, and Git change sets using Java . That is, I need the data that is shown in the "Sync" -view .

I tried several approaches to find the correct use in the code, and here are some documents that I could find (but to no avail):

  • I managed to access Synchronize-View through TeamUI.getSynchronizeManager() , but not the change sets.

  • Another thing I tried is to get cangesets via FocusedTeamUiPlugin.getDefault().getContextChangeSetManagers() (got the manager and then ChangeSetProvider where I tried to get ChangeSets), but they are always empty (because they are created when I first name it).

So, how can I access ChangeSets (with Java) in Eclipse (Mylyn)? In the end, I need the number of commits and the code to crash (loC added / removed / edited) . Or is there perhaps a different, better approach?

Any help is much appreciated!

+4
source share
3 answers

I do not think that Eclipse has already implemented this function as a public API. However, these links may help:

The internal change set class and another API: http://www.cct.lsu.edu/~rguidry/ecl31docs/api/index.html?org/eclipse/team/internal/core/subscribers/ChangeSet.html

A request for improvement of the function, which says why they have not implemented it yet (but it is dated 2008, but the error is still open?) Https://bugs.eclipse.org/bugs/show_bug.cgi?id=116084

I wish I could help anymore! Perhaps this will help you in the right direction ...

+3
source

Perhaps you can get around Eclipse:

  • Apply rsync to get CVS files * *, v 'from the CVS server. This works for me.
  • Apply the cvs2svn "cvs2git" command to the CVS repositories. This works for me.
  • Apply "git svn clone" (documented under "git-svn") in the SVN repository. I have not tried.
  • Finally, use the JGit API to retrieve changes from all repositories that are currently git repositories. I think you especially need this:
    • git class
    • class FileResolver
    • class BaseConnection
    • repository interface
    • class CheckoutCommand
    • class LogCommand
    • class revcommit
    • class diffiffmand
    • class diffiff
    • class diffiffatter
+1
source

I have been looking for this for 1 month. I tried to program a plugin for eclipse that can read a set of project changes (a β€œworking copy” of the repository).

What I just did is an ugly job.

I used Runtime.exec () to run the cmd-command / Shell command. If you install the svn-commandline client, you can enter svn status -v -u It gives you a list of all working copy files with information about the changes.

You can then parse the list to find all lines starting with "M" - for "modified" to get the Path of the modified file.

+1
source

Source: https://habr.com/ru/post/1437199/


All Articles