Search code examples
gerrit

gerrit query - get latest commit hash for repo


I am using automation to pull always ref/master from the project Is there an option to query gerrit to have information about last merged commit (getting only HASG also acceptable) ?

Using git log is not an option


Solution

  • The way I found is to query gerrit, the query is :

    [gerritURL]/a/projects/[gerritProject]/branches/[gerritBranch]
    

    Using python:

    query =[gerritURL]/a/projects/[gerritProject]/branches/[gerritBranch]
    changes = rest.get(query)