Tuesday, July 20, 2010

Thoughts on EyeQL

Today we had a small challenge at work which revolved around taking certain changes from one of our code branches and merging them into another branch. Now the keyword here is certain.

One of the conventions we use at work is to have Atlassian JIRA ticket numbers as part of the commit comments. They came in handy today because all the changes that needed to be merged had ticket numbers associated with them.

The problem? An easy way to retrieve all the SVN revision numbers associated with those tickets so that we find it easy merge said revisions to the target branch. Luckily we have Atlassian Fisheye at work and with it comes an interesting DSL (EyeQL) for querying your codebase. I had know about it for sometime but didn't know where it could be used. This was such a case.

The following EyeQL query when run will return the revision numbers I was looking for:


select revisions
from dir /svn/directory/path
where comment =~ "^.*(JIRA-1|JIRA-2|JIRA-3).*$"
group by changeset
return revision


The query goes through all revisions currently indexed by Fisheye and retrieves the revision(s) grouped by changeset that have either or all of JIRA-1, JIRA-2 and JIRA-3 in their commit comments.

Armed with this list of revisions it was easy to go through and merge them from the source branch to the target branch.

We would like to hear your thoughts on whether you have been in similar shoes and how you have gone about solving your problem.