Bug 534600 - [code mining] Provide SCSM revision codemining classes
Summary: [code mining] Provide SCSM revision codemining classes
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Team (show other bugs)
Version: 4.8   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform Team Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 534996
  Show dependency tree
 
Reported: 2018-05-12 03:19 EDT by Angelo ZERR CLA
Modified: 2020-03-21 07:09 EDT (History)
8 users (show)

See Also:


Attachments
Git mining (44.32 KB, image/png)
2018-05-12 03:19 EDT, Angelo ZERR CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Angelo ZERR CLA 2018-05-12 03:19:52 EDT
Created attachment 274010 [details]
Git mining

In JDT CodeMining, while I have implemented "Show recent change" for Git (see attached image), I have noticed that I could write generic classes which could work with:

 * any SCSM: Git, SVN
 * any language (Java)

by using Revision classes from Platform Text. It should be very cool if Platform Text could provides thoses following codemining classes https://github.com/angelozerr/jdt-codemining/tree/master/org.eclipse.jdt.codemining/src/org/eclipse/jface/text/revisions/provisionnal

If you think it's a good idea, I could create a gerrit patch.
Comment 1 Mickael Istria CLA 2018-05-12 05:17:03 EDT
As M7 is done, Platform is feature freeze until June. So in any case, no need to rush on this one.
Comment 2 Dani Megert CLA 2018-05-14 04:19:24 EDT
(In reply to Angelo ZERR from comment #0)
> Created attachment 274010 [details]
> Git mining
> 
> In JDT CodeMining, while I have implemented "Show recent change" for Git
> (see attached image), I have noticed that I could write generic classes
> which could work with:
> 
>  * any SCSM: Git, SVN
>  * any language (Java)
> 
> by using Revision classes from Platform Text. It should be very cool if
> Platform Text could provides thoses following codemining classes
> https://github.com/angelozerr/jdt-codemining/tree/master/org.eclipse.jdt.codemining/src/org/eclipse/jface/text/revisions/provisionnal
> 
> 
> If you think it's a good idea, I could create a gerrit patch.

I haven't tried it out, but as long as no dependency to Team is added, it looks OK to me.
Comment 3 Angelo ZERR CLA 2018-05-14 04:29:41 EDT
> I haven't tried it out, but as long as no dependency to Team is added, it looks OK to me.

There is none dependency to Team, but it requires to provide a new extension point to provide an instance of RevsionInformation created by Git, SVN, etc

It requires too some utilities class to manage the "ago" time and display the avatar.

@Dani, what do you mean with "it looks OK to me" ? You mean that you are OK to add this feature for Photon?
Comment 4 Dani Megert CLA 2018-05-14 04:40:40 EDT
(In reply to Angelo ZERR from comment #3)
> > I haven't tried it out, but as long as no dependency to Team is added, it looks OK to me.
> 
> There is none dependency to Team, but it requires to provide a new extension
> point to provide an instance of RevsionInformation created by Git, SVN, etc

That's find, but make sure it is not added in JFace Text.


> @Dani, what do you mean with "it looks OK to me" ? You mean that you are OK
> to add this feature for Photon?

See target milestone ;-)
Comment 5 Thomas Wolf CLA 2018-05-25 03:48:16 EDT
(In reply to Angelo ZERR from comment #3)
> It requires too some utilities class to manage the "ago" time

Why not leave time formatting to the SCM provider? EGit for instance already has different date/time formats, including relative ("ago" time). EGit also has a preference where the user can globally define the format he or she wants to use, and views update when that preference is changed. So there would need to be a way for an EGit code mining provider to request a redraw of its code minings currently being displayed.
Comment 6 Angelo ZERR CLA 2018-05-25 04:03:57 EDT
> Why not leave time formatting to the SCM provider? EGit for instance already has different date/time formats, including relative ("ago" time).

Totally agree with you! For the moment I'm using https://github.com/angelozerr/jdt-codemining/tree/master/org.eclipse.jdt.codemining/src/com/github/marlonlom/utilities/timeago, could you tell me which code of EGit I must call to do that?

@Thomas, my work it's just a POC and I'm totally aware to change anything. I think the best idea is that I do a gerrit patch and we change anything. As it is a POC and I have some feedback, my code is not very mature.
Comment 7 Thomas Wolf CLA 2018-05-25 04:17:30 EDT
(In reply to Angelo ZERR from comment #6)
> > Why not leave time formatting to the SCM provider?
> could you tell me which code of EGit I must call to do that?

org.eclipse.egit.ui.internal.PreferenceBasedDateFormatter is the class that formats date/time values according to the user's preferences as set under Preferences->Team->Git->Date Format.
Comment 8 Angelo ZERR CLA 2018-05-25 04:37:56 EDT
PreferenceBasedDateFormatter is used to format date, but IMHO I think it should be better to draw "ago time". Do you know where I could find this code which does that?
Comment 9 Thomas Wolf CLA 2018-05-25 04:46:03 EDT
(In reply to Angelo ZERR from comment #8)
> PreferenceBasedDateFormatter is used to format date, but IMHO I think it
> should be better to draw "ago time". Do you know where I could find this
> code which does that?

Well, I think the timestamp should be shown in whatever format the user chooses in the preferences. Not always as an "ago" time. If the user chooses "relative dates", PreferenceBasedDateFormatter uses org.eclipse.jgit.util.GitDateFormatter.RELATIVE, which uses org.eclipse.jgit.util.RelativeDateFormatter.
Comment 10 Angelo ZERR CLA 2018-05-25 06:41:54 EDT
Thank a lot @Thomas for your helpfull information. Now date is formatted with EGit RelativeDateFormatter https://github.com/angelozerr/jdt-codemining/blob/master/org.eclipse.egit.codemining/src/org/eclipse/egit/codemining/ui/internal/blame/ExtendedBlameRevision.java by implementing my JFace text IRevisionRangeExtension#getFormmatedTime().

For the moment I prefer hard coding that, because for mining "time ago" is better I find that a date pattern : date pattern can be helpfull for other thing, but not for mining. But it's just my opinion. We will see with user feedback.
Comment 11 Lars Vogel CLA 2018-06-22 03:38:08 EDT
Angelo, can you please upload a Gerrit for the proposed change.

Thomas, as EGit will be main/only consumer of the new API, I hope that you will be available as reviewer.
Comment 12 Angelo ZERR CLA 2018-07-01 17:24:18 EDT
> Angelo, can you please upload a Gerrit for the proposed change.

> Thomas, as EGit will be main/only consumer of the new API, I hope that you will be available as reviewer.

@Lars I would like to create a gerrit patch with  https:https://github.com/angelozerr/jdt-codemining/tree/master/org.eclipse.jdt.codemining/src/org/eclipse/jface/text/revisions/provisional but I think review will take time because there are a lot of changes. So I would like to be sure that someone like Thomas will have time to review my future gerrit patch.

More my current code mining with revision is able to display avatar icon. Do you think Platform Text will be ok to support avatar like I have done https://github.com/angelozerr/jdt-codemining/tree/master/org.eclipse.jdt.codemining/src/org/eclipse/jface/text/revisions/provisional/avatar ? My work with avatar was inspired by https://github.com/eclipse/egit-github/blob/master/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/AvatarStore.java
Comment 13 Lars Vogel CLA 2018-07-02 02:16:44 EDT
I think having avatar support in text is fine. As for the other changes I'm sure we will find a reviewer.
Comment 14 Angelo ZERR CLA 2018-07-25 04:10:14 EDT
> I think having avatar support in text is fine. As for the other changes I'm sure we will find a reviewer.

Cool:)

Before creating a gerrit patch, we need to fix https://github.com/angelozerr/jdt-codemining/issues/51 

If EGit guys can help me to fix this issue, it should be really fantastic. I have spent a lot of time to try to fix it without success -( Any help are welcome!
Comment 15 Mickael Istria CLA 2018-11-19 16:12:46 EST
I think having this in 4.10 is going to be too hard and we should focus the codemining effort of JDT references at the moment to consolidate the integration and start shipping something good using codemining.
Other codemining use-cases can target 4.11.
Comment 16 Lars Vogel CLA 2019-02-19 03:32:16 EST
Mass change, please reset target if you still planning to fix this for 4.11.