Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350679 - support searching for reviews by abbreviated and full hash
Summary: support searching for reviews by abbreviated and full hash
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: 0.8   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: 0.9   Edit
Assignee: Steffen Pingel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-29 06:45 EDT by Alex Blewitt CLA
Modified: 2011-08-19 09:48 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Blewitt CLA 2011-06-29 06:45:30 EDT
When using the 'Find by ID' for Gerrit, the IDs seem to be limited to the 8+1-digit key such as I5fdc948c. In fact, the full ID is I5fdc948c8e64f6d530b75e70bf8d7cc09ad3a7f7 and can be selected (via the Gerrit user interface) with any unique shortening of this, including I5fdc948c8e64f6d530b75e70b and I5fdc.

Whilst the ID shown in the title might conventionally be truncated for viewing purposes, being able to only find them by this shortened ID means you can't copy and paste the Change-Id from a commit into Mylyn reviews, nor a shorter abbreviation.

The Gerrit review connector should probably use the full ID (I5fdc948c8e64f6d530b75e70bf8d7cc09ad3a7f7) and then truncate for view purposes, as well as allowing the search to be implicitly wildcarded e.g. I5fdc*
Comment 1 Alex Blewitt CLA 2011-06-29 06:51:07 EDT
In fact, it seems that it only finds it if you have previously got the task loaded. I found that if I looked for Ia659100f then it wouldn't show up, despite being in the remote repository but not previously loaded.
Comment 2 Alex Blewitt CLA 2011-06-29 06:52:17 EDT
(The error message is Invalid {{ID}}, running against Gerrit 2.1.7)
Comment 3 Matthias Sohn CLA 2011-06-30 10:44:16 EDT
Mylyn Reviews is another product
Comment 4 Steffen Pingel CLA 2011-06-30 11:19:14 EDT
Thanks for the bug report Alex. The connector only supports searching by numeric ID. I agree that it should also allow searching by shortened and full hash.
Comment 5 Alex Blewitt CLA 2011-06-30 13:22:16 EDT
Ah, so the concept of numeric ID in Gerrit doesn't really make sense. The command lines deal with a numeric value, but that's a sequence number which is related to the changes as they were appended rather than an identifer per se. It exposes itself in the 'git fetch' e.g. "git fetch http://localhost:8080/p/test refs/changes/19/19/1 && git checkout FETCH_HEAD" but otherwise isn't really known about.

So this should be an enhancement for finding by other means, including the (abbreviated) hash. Note that if the string was passed as is to Gerrit, then Gerrit could figure it out, rather than having a task ID finder in Mylyn which uses the (internal) reference.

It may make sense to key the change by its full Change-Id, rather than numeric id, for its references in Mylyn. As we move from a post-SQL world, I'm not even sure that unique numeric ID will stay around - but you could probably find out from Shawn if there are any plans in that direction.
Comment 6 Steffen Pingel CLA 2011-07-26 13:53:04 EDT
Yes, we may end up having to abandon the numeric ID altogether since it has been deprecated and may go away entirely at some point. In Gerrit 2.1.x, the API still uses it to identify changes but that is bound to change. Sascha, do you happen to know in which Gerrit release hashes will entirely replace numeric IDs?
Comment 7 Sascha Scholz CLA 2011-07-27 05:55:55 EDT
I don't know when (and if at all) the deprecated numeric id in Gerrit will be removed. I think we should support both numeric id and the I-key in the search.
Comment 8 Steffen Pingel CLA 2011-08-19 08:38:01 EDT
I have added support for looking up the id from the hash in GerritClient.getChange() in ba465ea4caca4f5479eb8d8085af0319d4394f20. It is now possible to open reviews by full change-id. 

Unfortunately Gerrit does not support searching by abbreviated change-id so we are not able to support this on the client until that's fixed: http://code.google.com/p/gerrit/issues/detail?id=1101
Comment 9 Alex Blewitt CLA 2011-08-19 08:48:49 EDT
(In reply to comment #8)
> Unfortunately Gerrit does not support searching by abbreviated change-id so we
> are not able to support this on the client until that's fixed:
> http://code.google.com/p/gerrit/issues/detail?id=1101

This is not true.

Go into Eclipse EGit (http://egit.eclipse.org) and put 32d6035 in the search field. You will be taken to commit 32d6035f091040c1f0b96ccba369eb755eb8c7c5

Alex
Comment 10 Alex Blewitt CLA 2011-08-19 08:51:18 EDT
(In reply to comment #9)
> (In reply to comment #8)
> > Unfortunately Gerrit does not support searching by abbreviated change-id so we

My mistake, I thought this was for abbreviated commit, not just the change ID. I agree that for the change ID it does not support partial strings.
Comment 11 Matthias Sohn CLA 2011-08-19 09:03:27 EDT
(In reply to comment #8)
...
> Unfortunately Gerrit does not support searching by abbreviated change-id so we
> are not able to support this on the client until that's fixed:
> http://code.google.com/p/gerrit/issues/detail?id=1101

AFAIK this depends on the underlying database platform, I just tried and found it works on postgres and doesn't work on MySQL
Comment 12 Steffen Pingel CLA 2011-08-19 09:48:07 EDT
Interesting. I have added a note to the Gerrit issue.

Alex, as a side effect of the change you should be able to open Gerrit reviews by commit ids now as well (it works for any query string that returns a single result).