Gerrit patch set number associated with local branch downloaded using git-review
Consider a change in Gerrit, say change 1234
, having the following patch sets
# Gerrit change 1234 (https://mygerrit.somewhere.net/#/c/1234/)
1 (original commit)
2 (some amendments)
3 (some amendments)
And that I checkout patch set 2
of the change using git-review
:
$ git review -d 1234,2
Downloading refs/changes/00/1234/2 from gerrit
Switched to branch "review/foo_bar/1234"
Question:
While on branch
review/foo_bar/1234
(no changes after thereview
command above), is it somewhat possible to query the Gerrit patch set number associated with the branch? I.e.$ ... ? 2
The only approach I've come up with myself is to make use of git ls-remote
to identify all patch set numbers (and their associated SHA hashes) for the given change, and thereafter compare the hashes against the hash of the local branch's HEAD
(git rev-parse HEAD
). Alternatively just matching the hash of local HEAD
to the git ls-remote
and extract the patch set number from there, but I was hoping for a neater approach.