Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 150663

Summary: make commit comment templates repository or project specific
Product: z_Archived Reporter: Steffen Pingel <steffen.pingel>
Component: MylynAssignee: Steffen Pingel <steffen.pingel>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: bflat1, mik.kersten, pombredanne, robert.elves, stepper
Version: unspecifiedKeywords: noteworthy
Target Milestone: 2.2   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 210823    
Bug Blocks:    
Attachments:
Description Flags
patch
none
mylyn/context/zip
none
patch 2nd iteration
none
patch with test cases
none
mylyn/context/zip none

Description Steffen Pingel CLA 2006-07-14 11:35:44 EDT
It would be nice to generate Trac specific commit comments when a changeset for Trac task is committed. For instance Trac uses #[id] to reference tasks (Example: https://oss.steffenpingel.de/mylar-trac-connector/changeset/110).
Comment 1 Mik Kersten CLA 2006-07-14 19:56:45 EDT
Could you post an example of what you would want a commit comment to look like?  Also note bug 117517.
Comment 2 Steffen Pingel CLA 2006-07-16 22:15:37 EDT
Sorry for the dupe. Generic templates as requested in bug 117517 are even better although these may need to be repository / connector specific. A commit comment in Trac could look like:

<prefix>: <description> (refs <#id>)
Comment 3 Mik Kersten CLA 2006-09-03 04:35:42 EDT
Let's keep this open in case we do need the templates to be configured per-repository.  We could support that with a similar global vs. project-specific settings mechanism that Eclipse has all over the place.  
Comment 4 Mik Kersten CLA 2007-02-07 13:36:38 EST
*** Bug 157342 has been marked as a duplicate of this bug. ***
Comment 5 Eugene Kuleshov CLA 2007-03-08 14:34:51 EST
Some projects (even within the same repository) require some weird comment templates. So, it does make sense to allow project-specific templates configuration. It might be related to project linking feature, and in some cases we could use some 3rd party metadata that could give us info about used templates.
Comment 6 Mik Kersten CLA 2007-03-14 01:09:50 EDT
Agreed, so I set the milestone for 2.0.  I can't currently take this on so keeping as helpwanted.
Comment 7 Steffen Pingel CLA 2007-05-22 16:10:05 EDT
It would be great if the template was stored in the .settings/org.eclipse.mylar.tasklist.prefs file so Mylar would pick it up when checking out a project.

Mik, I'd be interested in looking into this for post 2.0.
Comment 8 Eugene Kuleshov CLA 2007-05-22 18:12:43 EDT
(In reply to comment #7)
> It would be great if the template was stored in the
> .settings/org.eclipse.mylar.tasklist.prefs file so Mylar would pick it up when
> checking out a project.

If we do that, I'd suggest to abstract this stuff trough extension point similar to projectLinkProviders. So, we could, for example, store those templates within svn properties...
Comment 9 Mik Kersten CLA 2007-06-26 19:44:55 EDT
Need to defer post 2.0.
Comment 10 Steffen Pingel CLA 2007-10-19 03:47:01 EDT
Created attachment 80749 [details]
patch

The patch adds a new properties page "Mylyn Team" that allows a per project configuration of the commit comment template.
Comment 11 Steffen Pingel CLA 2007-10-19 03:48:34 EDT
Created attachment 80750 [details]
mylyn/context/zip
Comment 12 Eugene Kuleshov CLA 2007-10-23 11:51:01 EDT
Steffen, this is really cool! Rob, Mik, would you review this?
Comment 13 Steffen Pingel CLA 2007-10-23 16:02:22 EDT
I will attach a new patch shortly that optimizes the lookup for the repository template: Instead of checking the project of the first resource in the changeset it iterates through all resources until a resource is found that has a customized template. 

Also the UI could be improved. Currently the patch adds a "Mylyn Team" top-level page to the project properties dialog which seems a bit too visible considering that I wouldn't expect many people to use this feature.
Comment 14 Steffen Pingel CLA 2007-10-23 16:04:14 EDT
Created attachment 80990 [details]
patch 2nd iteration
Comment 15 Eugene Kuleshov CLA 2007-10-23 17:18:09 EDT
Maybe it should be a subpage under Task Repository node. Bit weird, but show that is is also related.
Comment 16 Steffen Pingel CLA 2007-10-25 15:47:45 EDT
 (In reply to comment #15)
> Maybe it should be a subpage under Task Repository node. Bit weird, but show
> that is is also related.

Yes, I rejected that idea for the same reason.

Rob and I discussed ways to present it:

1) Make the current Task Repository page the top-level node and rename it to Mylyn. The new page would be a sub-node named Team.

2) Make the new page a top-level page named Mylyn and make Task Repositories a sub-node of that.

3) Have two separate top-level nodes.

Preferences? I am leaning towards (1).
Comment 17 Eugene Kuleshov CLA 2007-10-25 16:15:53 EDT
Personally I really don't like empty top level pages. "Mylyn" and "Team" are too generic. I think it is better to call the latter one "Commit Template". For the 3rd option, "Mylyn Task Repository" and "Mylyn Commit Template" are too long.

On the other hand those are pretty much cosmetic issues not worth to discuss because Mik will outrule the UI anyways. If it helps to get this patch in faster, I can live with option 1. :-)
Comment 18 Mik Kersten CLA 2007-10-25 20:48:45 EDT
Great stuff Steffen.  Before applying we need a test of the core functionality.  You could mock up a new project (see mylyn.java or mylyn.resources tests for code for programatically creating and deleting projects), set the template, then programatically generate the commit message to make sure that the content is used.  

In terms of preference pages, the points above make sense.  The Java Editor page has a similar problem.  For now I suggest going with (1).  A reason for this is that it addresses the "Task Tags" being confusing and right below Task Repository.  I'm not sure it's the right solution long-term so let's review before 2.2 goes out.
Comment 19 Steffen Pingel CLA 2007-10-31 21:33:41 EDT
Created attachment 81806 [details]
patch with test cases
Comment 20 Steffen Pingel CLA 2007-10-31 21:33:44 EDT
Created attachment 81807 [details]
mylyn/context/zip
Comment 21 Robert Elves CLA 2007-11-01 18:39:12 EDT
Nice. Patch applied.
Comment 22 Mik Kersten CLA 2007-11-01 20:37:28 EDT
Added to Weekly New & Noteworthy.
Comment 23 Eugene Kuleshov CLA 2007-11-23 18:28:53 EST
Steffen, can you please confirm that per-repository template will be used when parsing commit comments for task ids in Synchronize and History views?
Comment 24 Steffen Pingel CLA 2007-11-23 18:57:09 EST
I did not add any specific support for that.
Comment 25 Eike Stepper CLA 2014-07-09 07:40:02 EDT
Is it possible that the project-specific commit templates are not considered anymore by Mylyn? I found that I had to change the workspace-global preference in order to see the change in the Git staging view.
Comment 26 Steffen Pingel CLA 2014-07-09 09:08:03 EDT
That is tracked here: bug 348744: Staging view does not respect project-specific commit message template.
Comment 27 Eike Stepper CLA 2014-07-09 13:12:12 EDT
Thanks!