git-codereview: allow changing to a CL
Now 'git change NNNN/PP' can be used to checkout (detached) the git
commit corresponding to the patchset PP of the change NNNN. If the
patchset is omitted, the current (latest) will be used.
Branch names that are only numbers or numbers separated by a slash will
always be understood as refering to CL. This break workflows that were
using numbers as branch names, but this is expected to be uncommon. The
workaround in this case is to use checkout directly.
It gets the commit fetching the specific reference inside origin's
refs/changes/ and check it out. It uses the gerrit API only if
querying the current patchset is needed.
Given that it's easy to mistype the number, change to a CL will show the
subject of the commit it just checked out.
Reviewed-by: Andrew Gerrand <firstname.lastname@example.org>
Run-TryBot: Andrew Gerrand <email@example.com>
TryBot-Result: Gobot Gobot <firstname.lastname@example.org>
3 files changed