| Issue 2509: | Include Git commit in Gerrit message | |
| 4 people starred this issue and may be notified of changes. | Back to list |
If I merge a Gerrit review into the Git repository I get the following message: Change has been successfully merged into the git repository. Would it be possible to include the Git commit ID in this message? At least in the Eclipse platform project we include the link to the Git commit into the Bug report and it would be easier to do this with the commit ID included in the message. For example: -------------- Gerrit review: https://git.eclipse.org/r/#/c/22000/ Bug report: https://bugs.eclipse.org/bugs/show_bug.cgi?id=428181#c3 ----------- Maybe a good message would be: Change has been successfully merged into the git repository with the following commit ID: 4a55b0711453aafd3b5694e799af60d0429c9fe0
Mar 18, 2014
#1
Lars.Vo...@gmail.com
May 10, 2014
I am trying to find a commit from a given change-id with status marked MERGED. It would be nice if there was a field in Gerrit to hold the commit id, not just in the comment. Just put it under the Status line in the header. Then it could accessed from REST API too.
May 12, 2014
Steven, it does: Commit 2f909a22033aa2b6f839a94aa68970d4bfedf386 Author ....> May 10, 2014 4:22 PM Committer ....> May 10, 2014 4:22 PM Commit is the commit ID in the Git repo.
May 12, 2014
Lars, I definitely do not have the commit id when I go to that site. Maybe because I do not have your super powers on Gerrit?
May 12, 2014
Take https://git.eclipse.org/r/#/c/26096/ for example. It shows fb717af107b97c331e22723062f093cd12751a9d which is the commit ID https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=fb717af107b97c331e22723062f093cd12751a9d
May 12, 2014
Nope, not on my screen. Do you have to have commit permissions to see the commit ID?
May 12, 2014
http://www.vogella.com/tutorials/Gerrit/article.html#gerrit_usersetup_activatenewchangescreen
May 12, 2014
Thanks for the link, Lars. Unfortunately I am getting the page from a spider routine on my server, and it does not have an account. Google search also does not see it. For example, search for this commit id: 7222c584ddfa76d867f679d7568670cd0830b9b6. Only 3 things show up, bugzilla, git repo, and google code, not the Gerrit review. So I would still like the basic page (old version) to include this id, or still have the commit message include it as you first suggested.
May 12, 2014
Actually, google does have Gerrit review in the 'more from this site' option.
May 12, 2014
Rest API does not seem to have been updated to use this field either. Is the commit id an eclipse extension, or is it standard for Gerrit? https://git.eclipse.org/r/Documentation/rest-api-changes.html { "kind": "gerritcodereview#change", "id": "e4%2Forg.eclipse.e4.tools~master~Ia81dc96d068b46ce415eaefa33cf91f6b3c95f68", "project": "e4/org.eclipse.e4.tools", "branch": "master", "change_id": "Ia81dc96d068b46ce415eaefa33cf91f6b3c95f68", "subject": "Bug 404136 - Model editor should be able to select icons from other bundles/projects ", "status": "MERGED", "created": "2014-04-18 14:02:25.000000000", "updated": "2014-04-18 19:45:38.000000000", "_sortkey": "002c8341000062b8", "_number": 25272, "owner": "labels": "permitted_labels": {}, "removable_reviewers": [], "messages": [], "current_revision": "86219b10a48721781e74baba94e19487b01c312c", "revisions": {...} }
May 12, 2014
> "revisions": {...}
This is where the commit is contained, see
https://git.eclipse.org/r/Documentation/rest-api-changes.html#revision-info
and CommitInfo contains the commit ID
https://git.eclipse.org/r/Documentation/rest-api-changes.html#commit-info
May 12, 2014
Sorry about being off topic, but my commit object does not have a commit id. Apparently, the REVISION_ID IS THE COMMIT ID OF THE MERGE. "current_revision": "86219b10a48721781e74baba94e19487b01c312c", "revisions": { "86219b10a48721781e74baba94e19487b01c312c": { "_number": 3, "commit": { "kind": "gerritcodereview#commit", "parents": [ { "kind": "gerritcodereview#commit", "commit": "7222c584ddfa76d867f679d7568670cd0830b9b6", "subject": "Bug 426397 - Provide an eclipse editor based on OrionEditorControl" } ], "author": { "name": "Steven Spungin", "email": "steven@spungin.tv", "date": "2014-04-18 14:01:16.000000000", "tz": -240 }, "committer": { "name": "Steven Spungin", "email": "steven@spungin.tv", "date": "2014-04-18 19:39:07.000000000", "tz": -240 }, "subject": "Bug 404136 - Model editor should be able to select icons from other bundles/projects ", "message": "" } This is the review: https://git.eclipse.org/r/#/c/25272/ This is my REST URL: https://git.eclipse.org/r/changes/Ia81dc96d068b46ce415eaefa33cf91f6b3c95f68/detail/?o=CURRENT_REVISION&o=CURRENT_COMMIT This is the commit id from the merge: 86219b10a48721781e74baba94e19487b01c312c. Perhaps I am leaving an option out? I read through the API many times. The commit info is missing the commit-id, and the revision id is the commit id. We can't depend on that however, because another commit after the merge will change the revision id and we have no way to find out what revision was merged. Please try links and confirm if this is a bug in REST API. Thanks!
May 12, 2014
> This is the commit id from the merge: 86219b10a48721781e74baba94e19487b01c312c. This is not the merge commit, but the commit of the patch set that was submitted. > The commit info is missing the commit-id, and the revision id is the commit id. Yes, if a commit info is contained in the revisions map, the commit id field is not set since the commit id is already available as map key aka revision id. There is no need to transfer the commit ids twice. > We can't depend on that however, because another commit after the merge will > change the revision id and we have no way to find out what revision was merged. I don't understand this. If the change is merged, it is closed and you cannot upload another revision to it. Do you mean how to get all revisions included in the response? This is described for the revisons field in ChangeInfo https://git.eclipse.org/r/Documentation/rest-api-changes.html#change-info
May 12, 2014
>> This is the commit id from the merge: 86219b10a48721781e74baba94e19487b01c312c. >This is not the merge commit, but the commit of the patch set that was submitted. Yes, and this is the value I am seeking, as I am trying to generate a URL to the merge page.(https://git.eclipse.org/c/e4/org.eclipse.e4.tools.git/commit/?id=86219b10a48721781e74baba94e19487b01c312c). This is the commit id of the merge according to GIT. >> The commit info is missing the commit-id, and the revision id is the commit id. >Yes, if a commit info is contained in the revisions map, the commit id field is not set since the commit id is already available as map key aka revision id. There is no need to transfer the commit ids twice. It's seems the commit id is never set in CommitInfo. In the URL https://git.eclipse.org/r/changes/Ia81dc96d068b46ce415eaefa33cf91f6b3c95f68/detail/?o=ALL_COMMITS&o=ALL_REVISIONS, the field is still not set in any revision. Even if I explicitly request a CommitInfo object (https://git.eclipse.org/r/changes/Ia81dc96d068b46ce415eaefa33cf91f6b3c95f68/revisions/86219b10a48721781e74baba94e19487b01c312c/commit) the field is missing. The CommitInfo spec states -> commit The commit ID. Can I assume if the status is MERGED, the current-revision will always be the commit id used in the link to the merge https://git.eclipse.org/c/e4/org.eclipse.e4.tools.git/commit/?id=86219b10a48721781e74baba94e19487b01c312c? >> We can't depend on that however, because another commit after the merge will >> change the revision id and we have no way to find out what revision was merged. >I don't understand this. If the change is merged, it is closed and you cannot upload another revision to it. Thanks for clarifying this. I have never tried to commit another revision to a merged review; I did not know this was not an option. Do you mean how to get all revisions included in the response? This is described for the revisons field in ChangeInfo https://git.eclipse.org/r/Documentation/rest-api-changes.html#change-info |
|
| ► Sign in to add a comment |