[infra][tact-sig] Extracting commits data for the first and the last code review revisions

Chouchen, Moataz moataz.chouchen.1 at ens.etsmtl.ca
Mon Mar 22 15:57:13 UTC 2021


Hi Jermey,

Thank you for your quick answer!
That's what I am looking for and I am very grateful to you and to all the community.

Best regards,
Moataz.



________________________________
From: Jeremy Stanley
Sent: Monday, March 22, 2021 8:41 AM
To: openstack-discuss at lists.openstack.org
Cc: Chouchen, Moataz
Subject: Re: [infra][tact-sig] Extracting commits data for the first and the last code review revisions

[I'm keeping you in Cc since you don't appear to be subscribed to
this mailing list.]

On 2021-03-22 15:00:03 +0000 (+0000), Chouchen, Moataz wrote:
[...]
> I extracted the revision IDs for the first and the last revisions
> (supposed to be first and last commit hashes) for each code review
> in puppet projects. However, when we have more than one revision,
> we were unable to find the commits for the first revision in the
> git for all the projects and we only have commits data for the
> last revision. I would like to know if the commit of the first
> revision does exist in the CVS, and it's possible to extract?
[...]

Conveniently, Gerrit stores all of this in the repository and we
replicate it to our Git server farm. The complication is that,
because of the amend/rebase-oriented nature of Gerrit's code review
workflow, those earlier revisions don't appear in the branch
history. Instead, they are tracked with named references which look
like changes/XX/YYYY/Z where YYYY is the numeric index identifier
for the change, XX is the last two digits of YYYY (for sharding
purposes), and Z is the revision number starting from 1. Let's take
this puppet-nova change as an example:

    https://opendev.org/openstack/puppet-nova/commit/d385ca8

There you can see Gitea is displaying an indicator that there is a
named ref of changes/63/764763/5 associated with the commit. That
means it was revision 5 of change 764763 in Gerrit. You can fetch
that ref like so:

    git fetch origin changes/63/764763/5

That will fill FETCH_HEAD which you can then use with checkout,
show, or any other relevant subcommands. Conveniently, if you
instead want the first revision of 764763, all you have to do
differently is adjust the revision number:

    git fetch origin changes/63/764763/1

Hopefully that's what you're looking for?
--
Jeremy Stanley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20210322/2ac1ac36/attachment.html>


More information about the openstack-discuss mailing list