codingfreak
codingfreak

Reputation: 4595

Retrieving gerrit link from commit-id

Is it possible to retrieve gerrit-link of a particular commit from the gerrit server ?

I am able to retrieve commit-id and author using git log. I want to find a way to retrieve respective gerrit-link for the same from gerrit server so that I can track those respective commits.

Thanks

Upvotes: 2

Views: 2326

Answers (1)

ElpieKay
ElpieKay

Reputation: 30858

See Command Line Tools.

With gerrit query, you can retrieve the link. For example:

ssh -p 29418 $username@$gerrithost gerrit query commit:$hash --format=json
# and then parse the json data

or

ssh -p 29418 $username@$gerrithost gerrit query commit:$hash | grep -E '^  url:'

29418 is the default port. If it's not the case for your gerrit, replace it with the actual number.

With the options of gerrit query, you can retrieve almost everything seen on the page of a specific change, as long as it was pushed to refs/for/<branch>.

Upvotes: 4

Related Questions