Bug 378101 - [activity] add activity provider for related tasks such as Gerrit reviews
Summary: [activity] add activity provider for related tasks such as Gerrit reviews
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P2 enhancement (vote)
Target Milestone: 3.9   Edit
Assignee: Timur Achmetow CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks: 378002
  Show dependency tree
 
Reported: 2012-04-30 13:54 EDT by Timur Achmetow CLA
Modified: 2012-09-15 23:55 EDT (History)
1 user (show)

See Also:


Attachments
mylyn/context/zip (1.65 KB, application/octet-stream)
2012-05-03 17:04 EDT, Timur Achmetow CLA
no flags Details
mylyn/context/zip (55.96 KB, application/octet-stream)
2012-06-08 08:25 EDT, Timur Achmetow CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Timur Achmetow CLA 2012-04-30 13:54:24 EDT
Parsing the task id from the subject id. This functionality is at the moment not existing.
Comment 1 Steffen Pingel CLA 2012-05-02 19:06:36 EDT
The Task List Index in /org.eclipse.mylyn.tasks.index.core/src/org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex.java could provide a quick and convenient API for finding related reviews.
Comment 2 Timur Achmetow CLA 2012-05-03 17:04:27 EDT
Created attachment 215030 [details]
mylyn/context/zip
Comment 3 Timur Achmetow CLA 2012-05-30 17:05:37 EDT
(In reply to comment #0)
> Parsing the task id from the subject id. This functionality is at the moment not
> existing.

It is possible to access the Gerrit server for his history like SCMs (GIT, SVN)?
I have to parse the history data for the task id (similar bug 378097). 

It is possible? If yes, which classes are relevant for this problem?
Comment 4 Timur Achmetow CLA 2012-05-30 17:09:29 EDT
(In reply to comment #1)
> The Task List Index in
> /org.eclipse.mylyn.tasks.index.core/src/org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex.java
> could provide a quick and convenient API for finding related reviews.

Could TaskListIndex.java really help here? With TaskListIndex I can search for tasks, but not by Reviews, right?
Comment 5 Steffen Pingel CLA 2012-06-04 18:58:29 EDT
(Gerrit) code reviews are treated like tasks. They are stored in the Task List and persisted in the offline store and their details are indexed. If you add a query to your task list for reviews from git.eclipse.org/r you should be able to search their content using the "content:..." syntax in the task list find box. 

It didn't work as expected for me but we should investigate why not. I believe the task list index would be the fastest and easiest way to find reviews related to a task at least as a first pass.
Comment 6 Timur Achmetow CLA 2012-06-08 08:25:14 EDT
(In reply to comment #5)
> (Gerrit) code reviews are treated like tasks. They are stored in the Task List
> and persisted in the offline store and their details are indexed. If you add a
> query to your task list for reviews from git.eclipse.org/r you should be able to
> search their content using the "content:..." syntax in the task list find box.

Okay, I have tested it and it works fine. Here is my code:
				
				TestTaskCollector collector = new TestTaskCollector();
				TaskList taskList = TasksUiPlugin.getTaskList();
				TaskDataManager taskDataManager = TasksUiPlugin.getTaskDataManager();
				TaskRepositoryManager repositoryManager = TasksUiPlugin.getRepositoryManager();
				File file = new File(TasksUiPlugin.getDefault().getDataDirectory(), ".taskListIndex");

				TaskListIndex taskListIndex = new TaskListIndex(taskList, taskDataManager, repositoryManager, file);
				taskListIndex.find(model.getTask().getTaskId(), collector, 100);
				System.out.println("Match: " + matches);

				if (collector.getTasks().isEmpty()) {
					System.out.println("No Tasks found.");
				} else {
					System.out.println("Collected Tasks:");
					for (ITask task : collector.getTasks()) {
						System.out.println(task.getTaskId());
					}

With this code I can find the corresponding review to a task.
Comment 7 Timur Achmetow CLA 2012-06-08 08:25:20 EDT
Created attachment 217072 [details]
mylyn/context/zip
Comment 8 Timur Achmetow CLA 2012-06-12 17:11:23 EDT
With the above code I get the appropriate review task; but I get "only" an ITask object. It is possible to get more than an ITask object from the TaskListIndex? 

For example: I want to see the patch sets, reviewers and something else from the review tasks.
Comment 9 Steffen Pingel CLA 2012-06-16 07:31:36 EDT
(In reply to comment #8)
> With the above code I get the appropriate review task; but I get "only" an ITask
> object. It is possible to get more than an ITask object from the TaskListIndex?

That is correct, the task list (index) will on give you access to the information on ITask. We would need to load TaskData to get additional details.

> For example: I want to see the patch sets, reviewers and something else from the
> review tasks.

For now it's sufficient if we show the task and use the information available on ITask. We expand that in the future to show when patch sets were uploaded etc. but let's keep it simple for now.
Comment 10 Timur Achmetow CLA 2012-06-17 17:59:04 EDT
Okay .. I have found a solution for the additional Gerrit Data. 

With the this code I get the whole information:
GerritChange change = GerritUtil.getChange(getTaskData());

That's fine and now we are ready to push this data in the viewer.
Comment 11 Steffen Pingel CLA 2012-06-30 07:45:05 EDT
I still don't quite understand why we need the details for the review? I would like to avoid coupling to internals of the Gerrit connector. We can potentially later implement an activity contribution extension in the Gerrit connector that would provide details for tasks but for now it should be sufficient just to track that a review was created in relation to a particular task. Does that make sense?
Comment 12 Timur Achmetow CLA 2012-06-30 07:54:51 EDT
Okay, that makes definitely sense! 

I have thought we want to show here more details, but you are right, for the first step is this enough. Later we can extend it for additional informations. 

Thanks for the fast reply!!
Comment 13 David Green CLA 2012-08-01 18:58:13 EDT
Looking at @TaskActivityProvider@ the query matches any task that contains the task id of the scope task.  A couple of thoughts on this:
* should the query be attempting a word match to reduce false-positives (eg: 123 would also match 1234)?
* should the query be matching against the task key instead of the task id?
Comment 14 Timur Achmetow CLA 2012-08-02 18:05:55 EDT
@David: Thank you very much for your feedback!

(In reply to comment #13)
> Looking at @TaskActivityProvider@ the query matches any task that contains the
> task id of the scope task.  A couple of thoughts on this:
> * should the query be attempting a word match to reduce false-positives (eg: 123
> would also match 1234)?

Yes, I think this makes sense!

> * should the query be matching against the task key instead of the task id?

I have replaced the task id through task key.
Comment 15 Steffen Pingel CLA 2012-09-15 23:55:57 EDT
The review at https://git.eclipse.org/r/#/c/7008/ was merged. Thanks a lot for your contribution Tim!