New issue
Advanced search Search tips

Issue 792611 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

`git cl status --field=patch` no longer works

Project Member Reported by robertma@chromium.org, Dec 6 2017

Issue description

What steps will reproduce the problem?
(1) `git cl upload` in a feature branch
(2) `git cl status --field=patch`

What is the expected result?
The patch set number is returned.

What happens instead?
Empty output.


Looking at the code, there is supposed to be a "gerritpatchset" key in git's branch config:
https://cs.chromium.org/chromium/tools/depot_tools/git_cl.py?l=2407&rcl=7d47eb5495a0e5991dfc77171aaa799004431f35
but I'm not seeing this key on any branch locally. Perhaps `git cl upload` no longer sets the key?

How can we know what is the latest patch set from command line?
 
Cc: qyears...@chromium.org
Note, when I tried this, it did output a number, but not the number I expected.

Specifically, I tried this on a branch associated with https://chromium-review.googlesource.com/c/707535/ and got the output "1", but I expected "15".
I dug a bit deeper. Seems like when Gerrit is used as the codereview, we only set patchset number when using the `git cl patch` command. Quinten, did you happen to create your local branch from an existing CL that way?

As for uploading a patch, here is where we set the issue number:
https://cs.chromium.org/chromium/tools/depot_tools/git_cl.py?type=cs&q=PatchsetConfigKey&sq=package:chromium&l=3111

The issue number is parsed from the output of `git push`, in particular this line:
  remote:   https://chromium-review.googlesource.com/#/c/chromium/src/+/812117 Check in google-api-client and its dependencies to webkitpy [WIP]
Unfortunately, the URL does not have patch number. So we might have to get it from somewhere else.
Owner: aga...@chromium.org
Status: Started (was: Untriaged)
Yeah, I just finished the same line of research.

I think the only option here is to make an http call when the user asks for the patchset, and cache it in gerritpatchset then. I'm not going to do that in "git cl upload" since it's already slow enough as it is.
#2: Yep, you're right, I had created that branch via git cl patch.

#3, 4: Thanks Aaron!
Project Member

Comment 6 by bugdroid1@chromium.org, Dec 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/tools/depot_tools/+/e8856eea42cf284071511107e818ce9980b30636

commit e8856eea42cf284071511107e818ce9980b30636
Author: Aaron Gable <agable@chromium.org>
Date: Thu Dec 07 23:38:59 2017

git-cl: fix 'status --field=patch' for Gerrit

We don't set the branch.<name>.gerritpatchset git config value
during "git cl upload" because it isn't returned from the
server either during push or during any of our subsequent RPCs,
and adding another RPC just for that metadata would be slower
that we would like.

But calling "git cl status" already makes an RPC per branch, so
take advantage of that to cache the gerritpatchset value during
that operation.

R=robertma

Bug:  792611 
Change-Id: I37b09f3c4cfced86668b457eff82f2424012b14b
Reviewed-on: https://chromium-review.googlesource.com/815137
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>

[modify] https://crrev.com/e8856eea42cf284071511107e818ce9980b30636/git_cl.py

Status: Fixed (was: Started)

Sign in to add a comment