SCM Commit Hook
Hi,
Does Jazz offer some sort of "commit hook" or "delivery hook"? They want, for example, to be able to format the source code before delivering into the stream. Thanks |
4 answers
Hello
They want, for example, to be able to format the source code before Yes, for instance, we wanted to have the source code formatted in the workspace (both remote and local) before it is delivered to the repository. The format action should be triggered automatically during the deliver-action; organize imports could be done as well. Is there an extension point or something else, that would offer us that possibility? Best regards, Stefan |
You can currently participate in the deliver operation on the client and
on the server. First you have to write a deliver operation advisor, register it with the advisors extension point, then you can add this advisor to your process specification. There is an example in the following class: com.ibm.team.process.internal.definitions.ide.ui.deliver.RequireContentAdvisor Then the process spec looks like the following: <role id="contributor"> <operation id="com.ibm.team.scm.client.deliver"> <advisors> <advisor description="Remember to include the IBM Copyright on all Java files that you create.<br><br>If everyone in the team is good about this during the development cycle, we won't have a lot of cleanup to do later." enforcement="overrulable" id="com.ibm.team.process.internal.deliver.requiredContent" name="IBM Copyright"> <filePattern pattern=".*java"/> <requiredText text="Copyright IBM Corporation"/> </advisor> </advisors> </role> My 2 cents about having an advisor format/change code automatically is that either the whole team does it, or no one should. It can potentially cause merge headaches when this is enabled mi-way through a project because you'll get tons of file changes which arean't related to the actual fixes you are making. Enjoy, Jean-Michel Philippe Krief wrote: Hi, |
Jared Burns (4.5k●2●9)
| answered Apr 26 '07, 11:58 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I should mention that the contract on advisors states that they cannot
modify the data that they're inspecting. This is because if an advisor makes a modification, it could invalidate any advisors which ran before it. It's possible that we will add support for operation participants which run before advisors and are allowed to make modifications to the data (operations would have to pass a working copy to these participants), but this isn't in yet. In the meantime, you can write an advisor which *checks* for certain formatting and offer a quick fix to format any files which don't comply. Or you could write a context menu action on change sets to "format and deliver" which would format the files before calling the deliver API. - Jared Jean-Michel Lemieux wrote: You can currently participate in the deliver operation on the client and |
Hello,
It's possible that we will add support for operation participants which The idea I had in mind was to deploy the formatting rules on the server, so by connecting you can obtain them directly from the repository. The sources in the local workspace should be formatted before commited. In the meantime, you can write an advisor which *checks* for certain That's a good idea :-) I will look into this. We will rollout our formatter rules and code templates manually. But when already doing the "format and deliver" action, I can include the "organize imports", too. :-) I can make a Jazz WI as enhancement and attach the work-around code, once its done. Thanks and best regards, Stefan |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.