Posts Tagged subclipse

Cache implementation reloaded (II)

Last week I talked about many changes in the cache implementation. Well, yesterday I made more changes.

My proposal on Summer of Code was based on using an embedded database. But I changed the algorithm that builds the graph and the queries against the database also changed. These queries now are very simple so I’ve decided to remove the database dependency and use binary files instead. Now I’m using two files to store the log messages:

LogMessages file

This file stores all log messages in a binary format. I use RandomAccessFile to read and write in it. RandomAccessFile lets me move to a certain byte position with its seek() method. Also it lets me know in which position I am, thanks to the getFilePointer() method.

Revisions file

This file indexes the previous file. It stores the offsets of each log message in the logMessages file. This is, from byte 0 to 7 it saves the offset of the first log message; from byte 8 to 15 it saves the offset of the second log message; and so on. That is, for the Nth revision the offset is stored at position (N-1)*8.

If I need to read the log message of a certain revision this is more or less what happens:*8);
long offset = revisions.readLong();;
logMessage = readNext();

Very simple, very fast 🙂

With this file it’s also very simple to know which is the latest revision number stored:

long latestRevision = revisions.length() / 8;

Now it takes about 3 seconds in my computer to build a graph from a repository with 4,000 revisions. The later implementation took 8 seconds. Also the database size is lesser and no initialization is required (the embedded database took about 10 seconds to initializate).

My plan now is to improve the graph output (maybe using Zest) and try to include merge information.


Leave a Comment

Integrating the graph into Eclipse

Until now the graph was shown in a sepparate window. Now I’ve integrated it as an Eclipse View.

Also, now the code runs as a background task. Thanks to Steve Elsemore 🙂

Leave a Comment

Initial import

Two days ago I got access to the subclipse repository and I have just imported my current code.

Thank you very much Mark!

Comments (3)

Setting up the environment

These are the steps I took to have my environment ready for coding.

  1. At first you need to checkout the subclipse code. Here you’ll find instructions about accesing the source code repository. Use ‘guest‘ for username and password.
  2. Make a clean installation of eclipse. Since sublicpse is a plugin for Eclipse I downloaded Eclipse Europa for RCP/Plug-in Developers.
  3. Sublicpse itself is also needed.  So install it.
  4. Import the projects under trunk/subclipse with File -> Import… -> General / Existing Projects into Workspace. Then choose the trunk/subclipse folder.
  5. The build of the project org.tigris.subversion.clientadapter.svnkit will fail, but it doesn’t matter. SVNKit is pure Java library for accessing SVN repositories. By default (at least in Windows) JavaHL is used instead. You can change this in the preferences page: Window -> Preferences -> Team / SVN.

Once I set up the environment I made some changes in the source code and I tested it. I think the easiest change is adding a component in the preferences page. The source code for the preferences page can be found in the org.tigris.subversion.subclipse.ui.preferences.SVNPreferencesPage class. I added the second line in this example code:

showCompareRevisionInDialog = createCheckBox(composite, Policy.bind("SVNPreferencePage.showCompareMergeInSync"));
createCheckBox(composite, "foo bar");

Now you need to test that this code works. To do this open the plugin descriptor file (plugin.xml) for the org.tigris.subversion.subclipse.ui project. You’ll see an editor pane with many tabs at the bottom. In the default tab (Overview) there are two options for Testing: “Launch an Eclipse application” and “Launch an Eclipse application in Debug mode”. Click one of them. A new Eclipse application will be launched with your code changes. Now open the SVN Prefrences Page to see the changes.

Leave a Comment