Community
Participate
Working Groups
Parsing the task id from the subject id. This functionality is at the moment not existing.
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.
Created attachment 215030 [details] mylyn/context/zip
(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?
(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?
(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.
(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.
Created attachment 217072 [details] mylyn/context/zip
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.
(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.
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.
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?
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!!
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?
@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.
The review at https://git.eclipse.org/r/#/c/7008/ was merged. Thanks a lot for your contribution Tim!