2

we're using JIRA with svn and looking for a way to include the revision id of the file automatically in the comment that appears in the dialog when commiting the file(s) so that JIRA catch that task.

Something like [ E-2 ] where the '2' is the id of the revision set by svn. Is there a way to create somethin similar to [ E- $id$ ] or something like that?

Thanks.

Edit : Well i've solved a part of it reading this enter link description here, i hope someone helps this.

Tony
  • 3,425
  • 10
  • 30
  • 46
  • Perhaps one of the [svn hooks](http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html) (such as pre-commit) could be used? Although that would always be lagging, I imagine... –  Nov 18 '11 at 09:24
  • i'm looking at that... but i was thinking in an easier way to do that. Thanks. – Tony Nov 18 '11 at 11:06
  • Notice that revision number are not different for each file, each revision number identifies a snapshot for the whole repository. See [svn book](http://svnbook.red-bean.com/nightly/en/svn.basic.in-action.html#svn.basic.in-action.revs) for details – Antonio Pérez Nov 18 '11 at 11:07
  • there must be an easier way... :) – Tony Nov 18 '11 at 11:36

2 Answers2

2

All the JIRA/Subversion integrations I've used (svn plugin, fisheye) handle this automatically. You add the JIRA issue key such as "TEST-123" somewhere in the svn commit message, and then the integration periodically notes all new commits and looks for JIRA issue keys in their messages. Then each JIRA issue has a tab with the list of commits associated with that issue. So there's no need to embed svn revision numbers into commit messages.

mdoar
  • 6,758
  • 1
  • 21
  • 20
  • Yes, that's right. But the problem is when you forgot or someone of your team forgot to set the id when he/she commit... then jira looses that task and when you want to export a certain task you'll not find it until you look carefully. I'm looking to automatically insert it int the comment of the commit to prevent this issue. – Tony Nov 19 '11 at 00:13
  • You can also change the commit message after the fact: http://stackoverflow.com/questions/304383/how-do-i-edit-a-log-message-that-i-already-committed-in-subversion – mdoar Nov 22 '11 at 20:15
  • yep, but i'm looking to set it before, maybe a template? – Tony Nov 24 '11 at 10:09
  • If you use Eclipse with Mylyn and JIRA connector, this would be a toolset where the template is what you like to have. Where should Subversion get the information when you commit on which JIRA issue you were working? – mliebelt Nov 24 '11 at 18:01
  • i use Mylyn but the template of Mylyn does not handle the svn revision number to set it with the template message when commit. Sometime ago i asked if mylyn support this kind of feature but did not. The info that svn must handle is the revision number that appears at the right of the file. – Tony Dec 03 '11 at 15:54
1

If you are not in the habit of doing commits in a particular way, and you don't mind doing a bit of scripting, this is what comes to mind -- I will probably do something like this myself, though I am using HG and not SVN...

Get the command line interface for Jira, rig it up so you can download 'my issues' into a list, parse the list with a script to create separate *.issue files that get dumped in a directory. Then as you work on issues, you move them from that directory, to a 'done' directory. When you are ready to commit, you run another script that creates a template for your commit message which includes all the done issues -- then you fill in the blanks for each issue.

You don't even need the CLI really, if all your *.issue files are associated with a script that will delete the file and add its ID to a commit template, then you can just create your own ID.issues files by hand. (empty files)

All that would be left is to script the commit.

Mark Robbins
  • 2,427
  • 3
  • 24
  • 33