Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330327 - FR: Hook into the commit process
Summary: FR: Hook into the commit process
Status: NEW
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-16 05:09 EST by staudta CLA
Modified: 2021-10-03 14:41 EDT (History)
5 users (show)

See Also:


Attachments
Implementation Proposal for the feature (19.23 KB, application/zip)
2010-12-23 04:15 EST, Maximilian Koegel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description staudta CLA 2010-11-16 05:09:21 EST
Hi EGit-Team,

I'm looking for an extension point that allows me to hook into the CommitDialog. 
An ideal interface will provide me the following information and possibilities:
- I can hook into the commit process. It would be great if I can set a predefined commit message and after the user confirms the commit dialog I am able to get the finally entered commit message.
- After the user pressed the okay button I am able to get a List of all resources that have to be committed. It would be also great if I get for each resource the status, e.g. “New”, “Modified” and “Removed”.
- After the dialog has been confirmed and the user pressed the OK button. I still want to be able to cancel the commit process. (I have additional logic - if some underlying condition does not hold, I want to tell this the user and to cancel the commit action).

An idea how this could look like is provided by Subversive. Unfortunately they not provide anything what I need but some basics. So the interface is only a rough orientation.
Subversive extension point: org.eclipse.team.svn.ui.commit
Information: http://www.eclipse.org/subversive/documentation/gettingStart ed/aboutSubversive/extensions.php
public interface ICommitActionFactory {...}

What do you think; would it be possible to provide such an extension point?

Cheers Adrian
Comment 1 Maximilian Koegel CLA 2010-12-23 04:15:47 EST
Created attachment 185752 [details]
Implementation Proposal for the feature

The classes “CommitActionHandler” and “CommitOperation” needed to be extended.  To provide a possibility to hook into that commit process we created a new extension point called “CommitObserver”. The modified CommitActionHandler takes, at execution time, a look into the Eclipse extension registry if there are some commit observer. Such a commit observer has a prepare phase and a finalize phase. Each phase can abort the commit process.
During the prepare phase are changes allowed to the CommitDialog, especially to set a predefined commit message. 
The finalize phase can change the CommitOperation. Basically the set of files that have to be committed can be modified.

This is important for us because we want to force that for some files also there “meta-data” will be committed. For our use case, sometimes the meta-data changes after the prepare phase. This can't be avoided. If the meta-data was unchanged the user cannot selected manually that the meta-data has to be committed too.

We had some problems to create a diff version of the changes that we have done. Therefore the changed files are attached. Please let us know if the changes are ok; or how we can support you in addition. Is it also possible to commit these changes in the near time to the EGit trunk? What do you think?