4

My current project asks us to follow a certain format for our commit messages. (The project uses SVN.)

In Mylyn format, it would translate to something like this:

${USER_INITIALS}: ${task.key} [(${connector.task.prefix}) "${task.description}"] -

The ${USER_INITIALS} variable is "pseudo-code", while the rest are working Mylyn commit variables.

It would be slick if I could use an environment variable, and save the template down to .settings/org.eclipse.mylyn.team.ui.prefs. Then, everyone on the project could use it.

I have tried the actual pseudo-code above (and also the already-existing PATH and USER environment variables). None of these resolves, apparently, because upon commit, they are replaced with an empty string.

Is there a solution?


P.S. Why not just rely on the SVN username, which is already a property of every SVN commit? Because we have integrated SVN with our LDAP server, and it returns our (numeric) EMPLID, which nobody could attribute without manual lookup. Therefore, it's not terribly useful for at-a-glance attribution (which is what is desired).

Jamie Jackson
  • 1,158
  • 3
  • 19
  • 34
  • 2
    RE Bounty: I'm interested in an answer to the general "environment variables in commit messages" question; not one to the specific "user initials commit messages" question of the the OP – Sam Hasler Apr 09 '13 at 15:00
  • Just to clarify, injecting of environment variables as a SVN commit hook is not what you're looking for, right? – slm Apr 14 '13 at 00:41
  • Correct, @slm. I'm looking for something to integrate into the Mylyn client's commit message mechanism. (I *think* you're talking about a SVN server-side solution.) – Jamie Jackson Apr 17 '13 at 14:11
  • 2
    I looked at the Mylyn source and docs and couldn't figure out a way to accomplish it within Mylyn directly, I think you're only option is to create a SVN hook/trigger that would either expand the environment variables for you or inject them at specific location within all commit log messages. – slm Apr 17 '13 at 14:16
  • @slm A SCM server-side solution (like a hook) isn't quite the right spot. It should really be client-side. However, the fact that you rooted around in the source, and couldn't find native support for this means that "this is not possible" is a valid answer to my question, so I'd accept it. FWIW, I've just added a Mylyn enhancement request: https://bugs.eclipse.org/bugs/show_bug.cgi?id=405999 – Jamie Jackson Apr 18 '13 at 15:30

2 Answers2

1

Could you use ${task.assignee}? For me that returns the initials of the relevant user.

Mikkel
  • 3,284
  • 2
  • 18
  • 20
  • might work for OP, but if you're bounty hunting I'm after a solution that uses environment variables. – Sam Hasler Apr 09 '13 at 15:00
  • Thanks, but no; it won't work for me. Our servers all tie to LDAP, which provides EMPLID for everything. I'm really looking for a variable that can be defined externally (on the system or in Eclipse), so something environment-variable-like, if not an actual environment variable. – Jamie Jackson Apr 12 '13 at 17:09
1

I agree that Mylyn should be able to pull environment variables into a commit message but I don't think it's currently possible.

I looked at the Mylyn source and docs and couldn't figure out a way to accomplish this within Mylyn directly, I think you're only option is to create a SVN hook/trigger that would either expand the environment variables for you or inject them at specific location within all commit log messages.

For reference I checked out a copy of the code base from here: http://wiki.eclipse.org/index.php/Mylyn/Contributor_Reference#Active_branches

slm
  • 15,396
  • 12
  • 109
  • 124