Handle an event from VCS (Git)

Answered

Hello.
I am currently developing IntelliJ plugin. Want to know, is it possible to handle changes in VCS? I want to be notified with some kind of event, when commit or push happens and handle it.
If there is something like com.intellij.codeInsight.editorActions.TypedHandlerDelegate but for VCS changes, it would be really a charm. 

0
4 comments

As nobody responded yet, I will post my own searching results on this question.

There is CheckinHandler.checkinSuccessful() method, and it seems to be suitable for this case.

But I found this in question asked back in 2008. So if something better now exists, please, write about it.

 

 

0

Hello Sergey,


If the intension is to extend UI actions like "on successful commit and on failed commit" then you can use 

com.intellij.openapi.vcs.checkin.CheckinHandler

You can register your own implementation of 

com.intellij.openapi.vcs.checkin.VcsCheckinHandlerFactory

in the corresponding extension point e.g:

<extensions defaultExtensionNs="com.intellij">
<vcsCheckinHandlerFactory implementation="com.myplugin.MyCustomCheckinHandlerFactory"/>
</extensions>

Best Regards,
        Dmitry Zhuravlev

1

Thank you a lot!
And maybe you can help me with getting set of changes after commit? I mean, I wonder is it possible to get something like numbers of changed lines in file? e.g. line 25 was added, line 14 was modified, line 26 was removed and etc.

 

0

Please sign in to leave a comment.