Commit Graph

799 Commits (0f58ae4d2d2bc0efb61e6b840e3ba64a828538f8)

Author SHA1 Message Date
Aaron Gable 400e989b1b 'git cl issue 0': Remove Change-Id
Although git-cl-upload warns when uploading a new patchset
to a change owned by someone else, if the uploader has run
'git cl issue 0', then git-cl believes they'll be uploading
a new change, so it doesn't bother checking. However, once
the upload begins, Gerrit notices the Change-Id in the commit
message, and instead adds a new patchset to someone else's
review (if the uploader is a committer).

This change introduces some logic to git-cl-issue to also
remove any Change-Id from the commit message when a user
tries to clear the metadata about their branch.

Bug: 741648
Change-Id: I6c7c3b24a7fc09c68220c8200b732fbdf9cf1fd3
Reviewed-on: https://chromium-review.googlesource.com/568267
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Andrii Shyshkalov c81738256b git cl creds-check: improve report and give better recommendation.
R=machenbach@chromium.org,agable@chromium.org
Bug: N/A
Change-Id: I831e9e72c8687c248022f49ea405e149538ef02a
Reviewed-on: https://chromium-review.googlesource.com/563671
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov de37c01295 Fix git-numberer swallowing of footers for Rietveld.
Due to relaxation of when last paragraph of commit message is
is consider as containing footers, `git cl land` started removing
non-canonic footer lines from last paragraph if Git Numberer is enabled
on a repo. This only manifests in manual lands of Rietveld CLs or
bypassing code review entirely.

R=agable@chromium.org
Bug: 736852
Change-Id: I3972c590c3959974157ada9de9891a3c08bd385a
Reviewed-on: https://chromium-review.googlesource.com/562278
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Anna Henningsen 4e89144a75 git-cl: fix auth error message computation
Bug:
Change-Id: Ic57563b131ff7e50985748eeb3d55e4b69b8db87
Reviewed-on: https://chromium-review.googlesource.com/562279
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable 665a4398b5 git-cl-upload: warn if no rietveld project specified
Bug: 600469
Change-Id: I4ebc7b0f28204ae4a4649e51d6aac8fc2f43ed20
Reviewed-on: https://chromium-review.googlesource.com/556152
Reviewed-by: Andrew Bonventre <andybons@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 844cf2963b git-cl: only set WIP on first upload
It seems like some folks are confused by additional patchsets
after the first putting the change back into WIP mode. This
confusion is honestly understandable. Maybe we try only setting
it on the very first upload, and just controlling the notify
parameter for future patchsets.

Bug: 721836, 737675
Change-Id: If56e5c71e0c6b3b46c2e30ac0b6d80b878218181
Reviewed-on: https://chromium-review.googlesource.com/552779
Reviewed-by: Quinten Yearsley <qyearsley@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: smut <smut@google.com>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable afd5277778 git-cl-upload: make it possible to exit WIP mode
The previous CL forgot that the lack of '%wip' doesn't
mark a change ready-to-review, you have to explicitly pass
'%ready' in the refspec to do that.

TBR=tandrii@chromium.org

Bug: 721836
Change-Id: Iea82222d64edf1b73fefa9bca3feec4188e35ab3
Reviewed-on: https://chromium-review.googlesource.com/551005
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 70f4e24d15 git-cl: upload changes in WIP unless --send-mail
Work-In-Progress is a new change flag that can be set on
Gerrit changes. While a change is in WIP mode, certain things
are different:
* It doesn't send emails except to the change owner
* The "Reply" button becomes "Start Review"
* When a change is moved out of WIP, it sends a special
  "ready for review" message to any new reviewers
This is much more similar to the Rietveld model, where users
would "Publish" their changes for the reviewers to look at.

Bug: 721836
Change-Id: I3b9697e311fa176cb679ecefbfead9bb32b6afaf
Reviewed-on: https://chromium-review.googlesource.com/549015
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Quinten Yearsley <qyearsley@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable aee6c85272 git-cl-issue: respect --gerrit/--rietveld with integer argument
Bug: 736816
Change-Id: I56d222a3aad684f51c8c47f302c8a298b7a0469a
Reviewed-on: https://chromium-review.googlesource.com/549060
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Quinten Yearsley <qyearsley@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Stefan Zager 1306bd03c9 Support dumping json to stdout.
Change-Id: I2e7243f1b9243ec98df54bd9f78b98cba8743217
Reviewed-on: https://chromium-review.googlesource.com/544792
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Stefan Zager <szager@chromium.org>
8 years ago
Aaron Gable 62619a3811 git-cl-patch: Return to cherry-pick, but hard reset with --force
This is a partial revert of https://chromium-review.googlesource.com/c/527345/
Turns out more people were confused by the new behavior than
expected, so we're returning to "cherry-pick" being the default,
but supporting the collaboration workflow is important, so we're
adding a warning message and support for "reset --hard" behind a
pre-existing flag.

Bug: 723787
Change-Id: Ib6038a42e3bdcc0db93c1f32d759e9ff0e91a065
Reviewed-on: https://chromium-review.googlesource.com/538137
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable 78753da20e Accept URLs in 'git cl issue'
There's no reason not to, since it is pretty easy, and other
commands like "git cl patch" already do so.

Bug: 733715
Change-Id: I3396153ef11bfdbbf09b8a7f54f9a5b1047e290f
Reviewed-on: https://chromium-review.googlesource.com/537113
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 75e7872acf Convert notify parameter inside gerrit_util
Bug: skia:6744
Change-Id: I0f84bd685bfacf692190f8636208122cf88d0b82
Reviewed-on: https://chromium-review.googlesource.com/529016
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Andrii Shyshkalov 354e1d23e0 git cl: improve warning.
R=agable@chromium.org

Bug: 728150
Change-Id: I3b2a843ac44bf447ce27a6d901d72a1c8035f496
Reviewed-on: https://chromium-review.googlesource.com/529112
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable bacbdb9a55 git-cl-patch: fix --is-ancestor flag
TBR=tandrii@chromium.org

Bug: 723787
Change-Id: Ie5017747f2070116774cd12ba0dd2ea531b2d0aa
Reviewed-on: https://chromium-review.googlesource.com/529547
Reviewed-by: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Andrii Shyshkalov 2c376aa21b git cl: Fix incorrect notify parameter when setting TBR.
Follow up on https://chromium-review.googlesource.com/c/527325/

R=agable@chromium.org,rmistry@chromium.org

Bug: chromium:729967
Bug: skia:6744
Change-Id: I7443298797a7c95c8ca01624e3cbf08c95e04855
Reviewed-on: https://chromium-review.googlesource.com/529246
Reviewed-by: Ravi Mistry <rmistry@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable 9387b4f0be Make gerrit 'git cl patch' use hard reset by default
This CL changes the way that "git cl patch" behaves for Gerrit changes.

Previously, git-cl-patch behaved just like it did for Rietveld:
make sure you're on a branch, download the diff, apply it on top
of your branch. However, this causes problems with Gerrit. Namely,
when you upload a change to Gerrit, git-cl has to make sure that all
parents of your local change have previously been uploaded as well,
either as other changes or as commits already landed on the target
branch. But the method for "applying a patch" from Gerrit was to
cherry-pick it, and that changes the commit hash. So the resulting
commit would *not* have been uploaded to Gerrit. Thus, the
following routine didn't work with Gerrit:
$ git checkout -t origin/master -b your-work
$ git cl patch 123456
$ git checkout -tb my-work
$ #hack and commit
$ git cl upload
This would fail during the upload with a message saying that the
contents of 'your-work' hadn't been uploaded.

This CL fixes the situation by replacing the cherry-pick with
a hard reset. This means that the contents of the 'your-work'
branch will be *exactly* what was downloaded from Gerrit. Uploads
based on top of that commit will work just fine.

Finally, in a concession to some people who want 'git cl patch'
to actually apply a patch instead of performing a hard reset, if
the current branch contains local work, then rather than leaving
that work behind with a hard reset, we fall back to the old
cherry-pick behavior with a confirmation dialog and warning that
uploading will be hard.

Bug: 723787
Change-Id: I3ad164f6d3078bff00139d446bb8ce97738a1344
Reviewed-on: https://chromium-review.googlesource.com/527345
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable 7303dcb9b3 Use whole --message argument on patchset upload
The logic for handling --title, --message, and the
commit message of the most recent commit was accidentally
doing this differently from how Rietveld had done them.

Bug: 728391
Change-Id: I70a46ccb470d790103f5d6bb745902595be28eee
Reviewed-on: https://chromium-review.googlesource.com/527339
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable fd238086f1 Use API to set TBR code-review
This prevents TBR (self code-review) permissions from blocking
the CL from being uploaded at all. Instead, it will fully
upload, and then show a better error message after upload is
complete.

Bug: 729967
Change-Id: I55e3e98e200143076afcaab858064d9f5c62f8ef
Reviewed-on: https://chromium-review.googlesource.com/527325
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 0ffdf2de15 git-cl-comments: Support Gerrit file- and line-comments
This brings the gerrit version of "git cl comments" into line
with the Rietveld implementation by including file- and line-level
comments as well as top-level review comments. It requires an
extra API call to do so, so this may result in some slow-down, but
the result is worth it.

It formats the comments to match the formatting used in the
PolyGerrit UI, with the addition of visible URLs linking to
the comment since we can't hyperlink text in the terminal.

This CL also causes it to ignore messages and comments with
the 'autogenerated' tag, which are generally less interesting
and clutter the output.

Bug: 726514
Change-Id: I1fd939d90259b43886ddc209c0e727eab36cc9c9
Reviewed-on: https://chromium-review.googlesource.com/520722
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Quinten Yearsley 0c62da9864 git_cl: Clean up spelling, docstrings and printed messages.
This mostly changes simple typos, e.g.:
strack->stack
assosiated->associated
unsettin->unsetting
diangose->diagnose
desciption->description
commment->comment

This CL also changes some docstrings and capitalizes
some printed messages.

Change-Id: I758b47f069a6de2d0d94a76ff85587bdc51c9daf
Reviewed-on: https://chromium-review.googlesource.com/519614
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Quinten Yearsley fc5fd927e2 Print CQ dry run messages/warnings consistently across commands.
For a bit of context, see the TODO in the code --
I think that the original intent of that TODO was that we to make
the way that CQ dry runs are triggered consistent, and also make
the behavior of dry runs consistent across different commands.

Change-Id: I80dfc31ade302a6af7fa84011e2871d416ea9c96
Reviewed-on: https://chromium-review.googlesource.com/518930
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Francois Doray d42c68114c Add git cl split.
`git cl split` splits a branch into smaller branches and
uploads CLs.

Change-Id: Ic41cdabdd6241008ff48766e31a8d9d07995f2b0
Reviewed-on: https://chromium-review.googlesource.com/439706
Commit-Queue: Francois Pierre Doray <fdoray@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable b02daf0bf9 git-cl: use private instead of draft
The private mode is a better fit for how we want private
(e.g. security-critical) changes to be reviewed. Draft
was simply a placeholder until private was ready for use,
which it now is.

Bug: 721880, 722627
Change-Id: Ib7b76c555437f4ddc7ab2b0e7ce5a9f9ee8be825
Reviewed-on: https://chromium-review.googlesource.com/513243
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrew Bonventre <andybons@chromium.org>
8 years ago
Aaron Gable c4c40d1b5a git-cl: Print Rietveld deprecation warning
To encourage folks to upload to Gerrit.

Bug: 685321
Change-Id: I849ed53f95a2205959237fe825ffe41e349ff8c7
Reviewed-on: https://chromium-review.googlesource.com/510963
Reviewed-by: Andrew Bonventre <andybons@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 2e559c98e6 git-cl: remove unnecessary similarity notice
This information is redundant when using Gerrit,
and is well known to anyone still using Rietveld.

Change-Id: I03119a84edb67fd20fbe5e2a8e0f0975e69558ed
Reviewed-on: https://chromium-review.googlesource.com/510923
Reviewed-by: Andrew Bonventre <andybons@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable d105249dda Don't add WATCHLIST CCs on private CLs
Many WATCHLIST and codereview.settings files contain
large public email lists, which defeats the purpose
of private reviews.

R=tandrii@chromium.org

Bug: 721880
Change-Id: Ibb3f314f735b783e628f8cc1fc22c74e0df59f1c
Reviewed-on: https://chromium-review.googlesource.com/506489
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 9b46527628 git-cl: let 'git config gerrit.host false' work
R=tandrii@chromium.org

Change-Id: I2c669303d2320d672538b363fbb15fb9e5cf37a8
Reviewed-on: https://chromium-review.googlesource.com/505267
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Andrii Shyshkalov 8e4576f385 git cl upload: fix confusing warning.
R=machenbach@chromium.org
BUG=718264

Change-Id: Id238a53dbc22b94010b0eb22263de824da300fbd
Reviewed-on: https://chromium-review.googlesource.com/501809
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov 1e250cdeb3 git cl creds-check: understand '~' in path to .gitcookies.
Before, git cl creds-check expected `http.cookiefile` of git config
to have path without '~' which git understands on Linux/Mac.

R=machenbach@chromium.org

Bug: 719728
Change-Id: Ica1308b776b62bda7a8b85113c0c0df837c7d933
Reviewed-on: https://chromium-review.googlesource.com/501828
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable 6dadfbfcf7 git-cl-upload: Set all reviewers and ccs in a single batch api call
The old system had two faults:
* It set reviewers and ccs via different mechanisms, which is confusing
* It set CCs with a single call for each, resulting in N separate emails,
  with each email going to the uploader and all reviewers and all previous
  CCs.

This new system just collects all reviewers and CCs, and sets them
in a single call. That call will fail if *any* of the individual
reviewers or ccs fail, so it also parses the response and retries with
only the ones which would have succeeded on their own. If that second
call fails, or the first fails in an unexpected way, it raises an
exception like normal

Bug: 710028
Change-Id: I1be508487a41f0b68f9c41908229b8f5342830a3
Reviewed-on: https://chromium-review.googlesource.com/479712
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable 0bbd1c28d5 git-cl: upload to merge-base with master, not tip of origin/master
Previously, if the branch structure was
origin/master
  master [ 3 commits behind origin/master ]
    my-branch [ 1 commit ahead of master ]
then git-cl would see that the upstream branch is master,
and decide to diff against origin/master instead. But that
diff would contain the contents of the three commits that
the local master branch hasn't caught up with yet. That's
not what we want.

This CL makes it so that basing on top of local master is
the same as basing on top of remote branches. Just like
when based on top of origin/master, it simply calculates
the merge-base with the parent commit (which is assumed
to be present in the remote), and uploads that diff.

Change-Id: I91caa30f6256a6e019e613dc5ff624734bca027e
Reviewed-on: https://chromium-review.googlesource.com/499307
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Steven Holte 2e664bfa92 Handle extra metrics xml files in git cl format.
This will allow git cl format to handle histograms.xml being
split into several files, and also adds support for UKM.

Bug:699328

Change-Id: I2bfbd333b78b679f69d7cb298f5adaf02f6a4dec
Reviewed-on: https://chromium-review.googlesource.com/483979
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Steven Holte <holte@chromium.org>
8 years ago
Andrii Shyshkalov 8c90d03fb9 [git-cl] refactor Change-Id manipulation in squash upload mode.
R=iannucci@chromium.org

Bug:

Change-Id: Ia1729175c9f10d7c89388bf1e227904e76cbb16c
Reviewed-on: https://chromium-review.googlesource.com/482319
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Robert Iannucci db02dd0524 [git-cl] modify change description before committing.
Otherwise if update_reviewers needs to modify the commit message it won't
show in gerrit.

Bug:

Change-Id: Id81db48b7d15bd17cb924d1d046b31f2c48defa7
Reviewed-on: https://chromium-review.googlesource.com/482062
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Robert Iannucci 100aa213c6 [git-cl] set math is done with | not +
TBR=tandrii@chromium.org

Bug:

Change-Id: I1f533344b915bc4581739f508978f837a8c90f8c
Reviewed-on: https://chromium-review.googlesource.com/481073
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
8 years ago
Aaron Gable 6f5a8d9987 Flip gerrit_util to raise exceptions on 404 by default
This makes the library behave more like what we'd expect,
while still allowing certain function to specify that
returning 204 or 404 is expected/acceptable behavior.

Change-Id: If3ce5598d1603819ee97aaeab0072a9e786ed96d
Reviewed-on: https://chromium-review.googlesource.com/481043
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 19ee16c860 Reland "Refactor ReadHttpResponse to be error-friendlier"
Gerrit sometimes returns a full response json object at
the same time as returning a non-200 status code. This
refactor makes it easier for calling code to request
access to that object and handle error cases on its own.

The original version of this commit had a bug where
ReadHttpResponse properly set the default value for
accept_statuses, but all calls which came through
ReadHttpJsonResponse were setting None instead.

Bug: 710028
Change-Id: I8cee435d8acd487fb777b3fd69b5e48e19d2e5a3
Reviewed-on: https://chromium-review.googlesource.com/481060
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Robert Iannucci a28592e50a [git-cl] fix assertion.
We want to assert that if add_owners_to is provided, change is also
provided.

Bug:

Change-Id: I0b9674dcd1cdd5e42a8ab92583570ecc02ba1dcd
Reviewed-on: https://chromium-review.googlesource.com/481040
Reviewed-by: Daniel Jacques <dnj@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
8 years ago
Aaron Gable 382674be12 Revert "Refactor ReadHttpResponse to be error-friendlier"
This reverts commit 6d7ab1bfe5.

Reason for revert: Stacktrace:
 File "/s/depot_tools/gerrit_util.py", line 816, in GetAccountDetails
   return ReadHttpJsonResponse(conn)
 File "/s/depot_tools/gerrit_util.py", line 376, in ReadHttpJsonResponse
   fh = ReadHttpResponse(conn, accept_statuses)
 File "/s/depot_tools/gerrit_util.py", line 365, in ReadHttpResponse
   if response.status not in accept_statuses:
TypeError: argument of type 'NoneType' is not iterable

Original change's description:
> Refactor ReadHttpResponse to be error-friendlier
> 
> Gerrit sometimes returns a full response json object at
> the same time as returning a non-200 status code. This
> refactor makes it easier for calling code to request
> access to that object and handle error cases on its own.
> 
> Bug: 710028
> Change-Id: Id1017d580d2fb843d5ca6287efcfed8775c52cd6
> Reviewed-on: https://chromium-review.googlesource.com/479450
> Commit-Queue: Aaron Gable <agable@chromium.org>
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
> 

TBR=agable@chromium.org,tandrii@chromium.org,chromium-reviews@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: Ia9d9ce835e207a32e7cc8ee35c0cf40c823c7b78
Reviewed-on: https://chromium-review.googlesource.com/481059
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Robert Iannucci 6c98dc69b2 [git-cl] add --tbrs flag.
Bug:

Change-Id: I6c8ffaa5d8b934e287c97b97faf6909df5d02978
Reviewed-on: https://chromium-review.googlesource.com/479781
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable 6d7ab1bfe5 Refactor ReadHttpResponse to be error-friendlier
Gerrit sometimes returns a full response json object at
the same time as returning a non-200 status code. This
refactor makes it easier for calling code to request
access to that object and handle error cases on its own.

Bug: 710028
Change-Id: Id1017d580d2fb843d5ca6287efcfed8775c52cd6
Reviewed-on: https://chromium-review.googlesource.com/479450
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Robert Iannucci f2708bd74a [git-cl] add --r-owners
This will be useful for tools like the recipe autoroller to
semi-intelligently choose a collection of reviewers.

Bug:

Change-Id: I7a238127e126340c033fc8e80523ef2408ebf970
Reviewed-on: https://chromium-review.googlesource.com/479679
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov 550e924d20 Gerrit git cl upload <diff_base>: respect diff_base argumnent.
This CL propagates <diff_base> all the way to become parent commit
of the syntentic commit generated by squashing the current branch.

BUG=649846
R=agable@chromium.org

Change-Id: Ided7ebbb5c3a1114cac18adb62b3a9c27610018c
Reviewed-on: https://chromium-review.googlesource.com/475229
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Jochen Eisinger d0573ec067 Use OldContents() for OWNERS files to do checks
BUG=141253
R=dpranke@chromium.org

Change-Id: Iacbc2f0571e725e4f2ccf5ea7878f101972289bb
Reviewed-on: https://chromium-review.googlesource.com/476610
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
8 years ago
Aaron Gable a1bab27a25 Give Rietveld git-cl-status the 'not lgtm' state
While working on fixing git-cl-status for gerrit, I realized
it would be really easy to bring the Rietveld version up to
parity and simplify it at the same time.

Bug: 706460
Change-Id: Icff32b532fa29f8869205111cd117176e0d34b8f
Reviewed-on: https://chromium-review.googlesource.com/470448
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable 9ab38c6885 Fix gerrit git-cl-status to be simpler and correct
The loop over the messages didn't early-exit when it found
a non-CQ message, so it would continue looking until it
found any message by a non-owner. So all CLs with any comments
by anyone other than the uploader would be in 'reply' state
forever.

This CL fixes that, and also makes some other tweaks to
make the gerrit status code simpler and faster.

Bug: 706460
Change-Id: I5cc06962f5121fe042a315e5e2e205e556eb85da
Reviewed-on: https://chromium-review.googlesource.com/470586
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Andrii Shyshkalov 51acef998a Shamelessly plug $ git cl creds-check into yet another place.
R=machenbach@chromium.org

Bug: 689543
Change-Id: I73607e7afe78bac3bbe509fe9c4387dfd0095011
Reviewed-on: https://chromium-review.googlesource.com/474138
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov c971239edd git cl patch <url>: better handling of URLs.
* if --rietveld or --gerrit is given, parse only using appropriate
  parser.
* if url has '$HOST-review' in the beginning, assume it's Gerrit
* if type of codereview is detected based on URL, then print this
  information for the user.
  This also applies to `git cl description` but message is logged instead,
  because in '-d|--display' option git cl is supposed to print only description,
  and some tooling likely relies on this :(

R=jochen@chromium.org
BUG=706406

Change-Id: I21c9355c5334fd71db27618cda11287f75168b59
Reviewed-on: https://chromium-review.googlesource.com/473186
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
8 years ago
Andrii Shyshkalov 90f3192799 git cl: remember codereview type when parsing issue/change URL.
R=jochen@chromium.org
BUG=706406

Change-Id: I477d1cf629bb0bccebead6e5c0189830ea76be7e
Reviewed-on: https://chromium-review.googlesource.com/472867
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
8 years ago
Andrii Shyshkalov 28d840eb31 git cl patch: when URL matches both codereview systems, choose rietveld.
This is temporary, and will be changed in subsequent CLs. For now,
it suffices to stop relying on pseudo-random dictionary order in tests
and prod.

R=jochen@chromium.org
BUG=706406

Change-Id: I26c467a28bc63b5f81d20fc222a2b6f0511c507f
Reviewed-on: https://chromium-review.googlesource.com/472750
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov 2d8a2074c5 Gerrit git cl upload: if -m is given, don't prompt for patchset title.
R=sergiyb@chromium.org
BUG=697625

Change-Id: I493bcc9212baf9030270cb71cf75ac969a67f2a0
Reviewed-on: https://chromium-review.googlesource.com/472724
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
8 years ago
Andrii Shyshkalov 70909e1ed3 git cl comment: cleanup mistakenly left TODO.
R=sergiyb@chromium.org

Change-Id: Ieea94428c7d9932242fb57b80afc1cf366b7bb54
Reviewed-on: https://chromium-review.googlesource.com/472827
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov e00a29ba9e Gerrit git cl upload -f should not ask for title.
R=sergiyb@chromium.org
BUG=697625

Change-Id: I2c3ad4e9380bd667c149be09eabeb5af0a5ab020
Reviewed-on: https://chromium-review.googlesource.com/472749
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov 9d93221fb9 git cl: suggest running git cl creds-check after git push failures.
R=sergiyb@chromium.org
BUG=708785

Change-Id: Ib29be04cda18b0b1187893e555a4c5a7ea753e6e
Reviewed-on: https://chromium-review.googlesource.com/472866
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov fbee165093 git cl: remove temporary workaround of invisible unicode char in emails.
PolyGerrit used to surround emails with invisible unicode char, which
resulted in reviewers not being found by Gerrit. It has since been
fixed (handled in Google internal bug b/34702620).

R=sergiyb@chromium.org

Change-Id: I43ade0ef23d88611081744eff57129a69b5176c8
Reviewed-on: https://chromium-review.googlesource.com/472808
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Jochen Eisinger eb7447605b Configure path to OWNERS.status file via toplevel OWNERS
BUG=694222
R=dpranke@chromium.org

Change-Id: Ie841332129dd6fa8555d2e940c919b812fc9408d
Reviewed-on: https://chromium-review.googlesource.com/467250
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
8 years ago
Andrii Shyshkalov febbae9d2e Revert "git cl upload for Gerrit: use push options instead of refspec."
This reverts commit 0267fd2c29.

Reason for revert: seems to have changed some behavior as reported by SKIA.

Original change's description:
> git cl upload for Gerrit: use push options instead of refspec.
> 
> This removes limitation of no special chars in patchset titles.
> 
> BUG=chromium:663787,chromium:707963,gerrit:5184
> R=​sergiyb@chromium.org,agable@chromium.org
> TEST=uploaded this CL using depot_tools with this patch :)
> 
> Change-Id: I5d684d0a0aa286a45ff99cca6d57aefa8436cd0f
> Reviewed-on: https://chromium-review.googlesource.com/468926
> Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
> Reviewed-by: Sergiy Byelozyorov <sergiyb@google.com>
> 

TBR=agable@chromium.org,sergiyb@google.com,tandrii@chromium.org,sergiyb@chromium.org,borenet@chromium.org,chromium-reviews@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:663787,chromium:707963,gerrit:5184

Change-Id: I3306091b14b97a200150389d0480b69120af8c61
Reviewed-on: https://chromium-review.googlesource.com/469006
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov 0267fd2c29 git cl upload for Gerrit: use push options instead of refspec.
This removes limitation of no special chars in patchset titles.

BUG=chromium:663787,chromium:707963,gerrit:5184
R=sergiyb@chromium.org,agable@chromium.org
TEST=uploaded this CL using depot_tools with this patch :)

Change-Id: I5d684d0a0aa286a45ff99cca6d57aefa8436cd0f
Reviewed-on: https://chromium-review.googlesource.com/468926
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Sergiy Byelozyorov <sergiyb@google.com>
8 years ago
Jochen Eisinger 72606f8c24 Add support for a global status files for OWNERS
This allows for having some global comments such as timezones or
long-term unavailability.

The comments go into build/OWNERS.status (that way, they should be
available in all repos that map in build/ for the gn config files).
The local can be overwritten in codereview.settings.

The format is

email: status

Comments (starting with #) are allowed in that file, but they're ignored.

BUG=694222
R=dpranke@chromium.org

Change-Id: I49f58be87497d1ccaaa74f0a2f3d373403be44e7
Reviewed-on: https://chromium-review.googlesource.com/459542
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
8 years ago
Aaron Gable f97e33d27f Gerrit git-cl: special-case branches tracking 'master'
This is a hack to support the most common git workflow: keeping
a local branch named 'master' which is a replica of 'origin/master'
with no local changes, and basing all feature branches off of
that.

Test:
* created master branch, created feature branch, uploaded CL correctly
* created master branch, landed change on master branch, created
  feature branch, uploaded CL, CL contains change on master too
* created non-master branch, created feature branch, failed to
  upload CL

Bug: 682104
Change-Id: I8481b787e6dcab162d2846c07f1ddad950f491e0
Reviewed-on: https://chromium-review.googlesource.com/464107
Reviewed-by: Andrew Bonventre <andybons@google.com>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Robert Iannucci 09f1f3ddc7 [git-cl] Add cl methods for dealing with git footers.
This is needed for making PostUploadHooks that don't have to re-invent
the git footers library.

Bug:

Change-Id: I0a0ccf3dffd25152c2c273487ddbd9b279d80678
Reviewed-on: https://chromium-review.googlesource.com/461729
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
8 years ago
Andrii Shyshkalov 4812e6180b git cl creds-check: add empty line to clearly indicate report.
R=sergiyb@chromium.org
BUG=689543

Change-Id: Ifb0bc9a03da09cb81ba94c310ae59cfee69b7de1
Reviewed-on: https://chromium-review.googlesource.com/461137
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov aa31b97b2e git cl land for not Gerrit: add autorebasing.
Bug: 682934
Tested: https://chromium.googlesource.com/infra/experimental/+log/aef8ad..0378e4
Adapted-from: https://chromium-review.googlesource.com/c/431976/
Change-Id: Ida8141bc92d7501d8e17a1b8571033180f02a7b3
Reviewed-on: https://chromium-review.googlesource.com/458353
Reviewed-by: Aaron Gable <agable@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Pierre-Antoine Manzagol d5bc73d467 Fix 'git cl format' on windows metrics files
The issue is with directory separators:
"Check that c:\src\chromium\src or 
c:\src\chromium\src\tools/metrics/histograms/pretty_print.py
exist and have execution permission."

BUG=679514

Change-Id: I88a57783ca3bf8aa5af4d83fb34901c2d2385fe9
Reviewed-on: https://chromium-review.googlesource.com/457800
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Pierre-Antoine Manzagol <manzagop@chromium.org>
8 years ago
Andrii Shyshkalov bb86fbbef1 git cl upload for Gerrit: warn if uploader is not CL owner.
R=agable@chromium.org
BUG=653172

Change-Id: I141a1422a8f526040fe80522a41d14e2cd8cfc07
Reviewed-on: https://chromium-review.googlesource.com/458421
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 3a16ed155e Use Bug: footer for Gerrit CLs
Note that because it is now a gerrit footer, it both appears in the same block
as the Change-Id footer (no blank line between them), and isn't guaranteed to be
above the Change-Id footer. This doesn't matter during "git cl upload", when
a Change-Id hasn't been allocated yet, but will show up during "git cl
description".

Bug: 681184
Change-Id: I2ab6fc13be8e992709618a666012410b1a7c02de
Reviewed-on: https://chromium-review.googlesource.com/446660
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
8 years ago
Andrii Shyshkalov 0d6b46e32b git cl comment: require explicit --codereview with -i|--issue flag.
R=agable@chromium.org,machenbach@chromium.org
BUG=698236

Change-Id: If79f938e457f176c47badd75f78ed4ecb764ec2d
Reviewed-on: https://chromium-review.googlesource.com/456700
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
8 years ago
Andrii Shyshkalov 5a0cf20452 git cl comment: implement fetching comments for Gerrit.
R=agable@chromium.org,machenbach@chromium.org
BUG=698236

Change-Id: I36dcd2f10d0518a9f04a766e09c1ab00f2ce4d3b
Reviewed-on: https://chromium-review.googlesource.com/456699
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
8 years ago
Andrii Shyshkalov d8aa49f35b git cl comment: refactor fetching comments for Rietveld and add tests.
R=agable@chromium.org,machenbach@chromium.org
BUG=698236

Change-Id: I04e264130952e3e270540fae8381db544cf40e7c
Reviewed-on: https://chromium-review.googlesource.com/456697
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
8 years ago
Andrii Shyshkalov 680253d315 git cl description: don't bother if description diff is trailing whitespace.
BUG=700239
R=iannucci@chromium.org

Change-Id: Ica4567288c1cd83f72cce5d10c523270b69c36d4
Reviewed-on: https://chromium-review.googlesource.com/455739
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov 625986dba7 git cl comment: implement adding comment for Gerrit.
BUG=698236

Change-Id: Ia1a36af71c348be991d77083092c5043c2642c19
Reviewed-on: https://chromium-review.googlesource.com/455877
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov 0a0b067e6b git cl creds-check: add reporting.
BUG=689543

Change-Id: I2c5dd9e1ef4a23ba805c8c057ad44c87cfb65a5b
Reviewed-on: https://chromium-review.googlesource.com/455782
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
8 years ago
Andrii Shyshkalov 9780050b24 git cl creds-check: add methods analysing .gitcookies.
These methods are used to produce report in the next CL.

BUG=689543

Change-Id: I71b2705ac8b046103b4982d47f7ec97f8ef7818b
Reviewed-on: https://chromium-review.googlesource.com/455838
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
8 years ago
Aaron Gable d343c63519 git-cl patch: set metadata before (failing to) apply patch
If the commit or cherry-pick command fails, git automatically drops
the user into a state where they can try to manually fix it. That's
great. But with the old call order, it would also leave the metadata
unset. This sets the issue and patchset number before doing the
potentially-failing heavy lifting, so that the branch will be in a
consistent state after the user finishes fixing up the failed command.

BUG=701130

Change-Id: I792b9fb9e61ba62626c19aa1837d21f8cd8f594e
Reviewed-on: https://chromium-review.googlesource.com/456039
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Andrii Shyshkalov 34924cd4f0 git cl creds-check: add pretty printing of existing creds.
BUG=689543

Change-Id: I085f3e086059ecf3b57a8e0cd0d716adc54f8644
Reviewed-on: https://chromium-review.googlesource.com/454816
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
8 years ago
Andrii Shyshkalov 517948b6d1 git cl creds-check: refactor gitcookies methods into a class.
There will be many other methods that will need to share state.

BUG=689543
R=machenbach@chromium.org

Change-Id: I4ce6fe173ff7c92e57737417c65125156606a664
Reviewed-on: https://chromium-review.googlesource.com/455780
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
8 years ago
Andrii Shyshkalov 353637c534 Add `git cl creds-check` to clean Git/Gerrit creds interactively.
BUG=689543

Change-Id: I0ba24c46f36c505fae03aaeab3b277e80bca8f8b
Reviewed-on: https://chromium-review.googlesource.com/454696
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov abc26ac029 git cl: refactor common user interactions.
R=machenbach@chromium.org
BUG=

Change-Id: Id3e3fe6223a875d997ac5569137db270818a08f4
Reviewed-on: https://chromium-review.googlesource.com/453439
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
8 years ago
Mark Mentovai 57c4721d81 git-cl: Make BUG_LINE_FORMAT configurable in codereview.settings
The default BUG_LINE_FORMAT is the existing BUG=%s. Projects that wish
to begin using Gerrit-style footers like Bug: %s can now set this in
codereview.settings.

BUG=616753

Change-Id: I4470311a86db228eab2a1655ae884736cce8c380
Reviewed-on: https://chromium-review.googlesource.com/451565
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Mark Mentovai 600d309d6c git-cl: Recognize Bug: when reading change descriptions
When git-cl doesn’t see a BUG= line, it introduces a new one. The
eventual goal is to switch away from THIS=TYPE of metadata to the footer
field style that’s more natural to git and, most importantly, Gerrit.
With this change, git-cl will treat an existing Bug: line identically to
a BUG= line, and not introduce a new BUG= line if either are present.
This stops short of switching the default format to Bug:, but it allows
projects that wish to switch to the new format now to not be pestered by
git-cl introducing BUG= every time it edits a change description.

This is similar to the bug line parsing done by Bugdroid, which already
undersatnds the Bug: format. See
https://chromium.googlesource.com/infra/infra/+/ba095768d776/infra/services/bugdroid/log_parser.py.

BUG=616753

Change-Id: I23faa55c8275de44b71b031e603f2f55778d7f25
Reviewed-on: https://chromium-review.googlesource.com/451123
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov 3e631421d2 Gerrit git cl upload: abort early if change is submitted or abandoned.
BUG=689652
R=agable@chromium.org,martiniss@chromium.org

Change-Id: Ib9f5b08f5b31a1519a5f5916042885967a263d88
Reviewed-on: https://chromium-review.googlesource.com/443325
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Alexei Svitkine f3cac41546 Integrate metrics XML file pretty print into git cl format.
Depends on: https://codereview.chromium.org/2674283002/

BUG=679514

Change-Id: I61611fc19724028bb8cdefefc50b4d5d3bb77a46
Reviewed-on: https://chromium-review.googlesource.com/437919
Commit-Queue: Alexei Svitkine <asvitkine@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
8 years ago
Kenneth Russell 61e2ed43fb Moved EnsureCQIncludeTrybotsAreAdded to OutputApi.
This makes them accessible to presubmit scripts' PostUploadHook.

Fixed bugs where caching needed to be bypassed in order for
sequential PostUploadHooks to see each others' results.

BUG=688765

Change-Id: I56c0c6b6419e2474f4b7f701be036fb2a524f8e3
Reviewed-on: https://chromium-review.googlesource.com/439877
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
8 years ago
Andrii Shyshkalov af3a9993de git cl: add temporary workaround for u200 chars in PolyGerrit.
(edited, so that next next line gets u200 char 
between R= and reviewer email)

R=​​mstarzinger@chromium.org
TBR=agable@chromium.org
BUG=b/34702620 (internal)

Change-Id: I58f2528dd28e3a43d8eb2d7d4f5c046460d8a9ee
Reviewed-on: https://chromium-review.googlesource.com/440085
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov 83051152f3 git cl: fix bugs in UpdateDescription.
R=kbr@chromium.org
BUG=633572,688765

Change-Id: I05130cfd05f89a4605c34b15cadf13a33e3565d9
Reviewed-on: https://chromium-review.googlesource.com/439445
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
8 years ago
Andrii Shyshkalov 3186301a4e git cl: allow to forcibly bypass cache and fetch CL description.
R=kbr@chromium.org
BUG=633572,688765

Change-Id: I2ce6530148bc2f00fe9f6a80aaccc520c69a2f83
Reviewed-on: https://chromium-review.googlesource.com/439186
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
8 years ago
Andrii Shyshkalov e9c78ffc95 git cl for Gerrit: add support for local git cache checkouts.
R=machenbach@chromium.org
BUG=689035

Change-Id: Ib7a56c52501a5d0dd6638a99bde3d376bd27bfb6
Reviewed-on: https://chromium-review.googlesource.com/438347
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable eb3af71509 git-cl: don't prompt after cleaning patchset title
BUG=688099

Change-Id: Ic505ab6553b1a9f1e6ab51377bb6519d805a847e
Reviewed-on: https://chromium-review.googlesource.com/436406
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Andrew Bonventre <andybons@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Andrii Shyshkalov 7afd16467e Follow up on Gerrit git cl status: do not treat CQ comment as reviewer reply.
TBR=sergiyb@chromium.org,agable@chromium.org
BUG=

Change-Id: I37f02556f254fbdc78ab30e990a7cc6d05120038
Reviewed-on: https://chromium-review.googlesource.com/434477
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov 33e88a4e19 Gerrit git cl status: do not treat CQ comment as reviewer reply.
R=sergiyb@chromium.org,agable@chromium.org
BUG=

Change-Id: I7684923c19fe7441cdd52b7707c28f01c95a4ba4
Reviewed-on: https://chromium-review.googlesource.com/433699
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
8 years ago
Andrii Shyshkalov eadad92e4a git cl try: reduce number of RPCs to Gerrit from 3 to 1.
R=agable@chromium.org
BUG=681704

Change-Id: I3c0ab781e0357e0855d50157c5653df57f68ac9a
Reviewed-on: https://chromium-review.googlesource.com/432336
Reviewed-by: Aaron Gable <agable@chromium.org>
8 years ago
Andrii Shyshkalov 8039be7cc8 git cl: reduce number of Gerrit RPCs in status check.
Also fixes git cl description <url> by propagating codereview host information
in all cases.

BUG=681704
R=agable@chromium.org

Change-Id: Ia79c10b19d72b5a8797a1428ad8a79c8f4480901
Reviewed-on: https://chromium-review.googlesource.com/431036
Reviewed-by: Aaron Gable <agable@chromium.org>
8 years ago
Andrii Shyshkalov 1090fd5b69 Fix git cl upload --dependencies for Gerrit.
BUG=640299
R=rmistry@chromium.org,agable@chromium.org

Change-Id: Iac987758065c57a4a08ce98f838fc0c30a8c1a02
Reviewed-on: https://chromium-review.googlesource.com/432676
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
8 years ago
Andrii Shyshkalov 1897532850 Python style fixes + unused imports removal in git cl and friends.
R=sergiyb@chromium.org
BUG=

Change-Id: I9b886100557bf6efa9be07d40175f7bb919f5294
Reviewed-on: https://chromium-review.googlesource.com/432456
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov 98cef5704b git cl: _RietveldChangelistImpl should always have non-None auth_config.
TBR=phajdan.jr@chromium.org,sdefresne@chromium.org

Change-Id: I95cc6e61d044fd983c613fa7eeb21c8b77d7cee0
Reviewed-on: https://chromium-review.googlesource.com/432356
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov f3a20aed82 git cl: remove code related to pending refs and gnumbd.
Refactor _GitNumbererState to two functions and remove no longer
useful tests.

BUG=644915
R=agable@chromium.org

Change-Id: If5e3e3b141aee192211f6af130b01f20f9afdbfe
Reviewed-on: https://chromium-review.googlesource.com/431976
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov 9c3a464bf7 For Gerrit: use CURRENT_COMMIT option to get description, not gitiles.
R=sergiyb@chromium.org
BUG=681704

Change-Id: I48804955d8e5e579eae6e60fccac304aaaa9230e
Reviewed-on: https://chromium-review.googlesource.com/430625
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Christopher Lam f732cd5c70 Add cl description backup to gerrit upload.
BUG=684261

Change-Id: I2716864526fcedf44e561be8512843e12810e3a9
Reviewed-on: https://chromium-review.googlesource.com/431459
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Christopher Lam c5ba692d1e Put git cl format JS formatting behind a flag.
This CL moves JS formatting behind the --js flag for git cl format
due to issue with LayoutTests. It also adds an option to check
javascript for the presubmit canned formatting check.

BUG=567770

Change-Id: I9c080b1136f6ffef9fb1b08d3bfc97ce5b3185dc
Reviewed-on: https://chromium-review.googlesource.com/430526
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Christopher Lam <calamity@chromium.org>
8 years ago
Andrii Shyshkalov d0e1d9d9c5 git cl status: re-use existing ChangeList object.
This way we avoid extra RPC to codereview site.

R=sergiyb@chromium.org
BUG=681704

Change-Id: I81f9ac1b8fe4cfaa95458a5669735168185c47e5
Reviewed-on: https://chromium-review.googlesource.com/430639
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
8 years ago
Andrii Shyshkalov 258e0a653c Gerrit git cl: cache change detail to save on RPC calls.
R=sergiyb@chromium.org
BUG=681704

Change-Id: I5c320f7e6442a92ae0574e2ca6481a082e82568a
Reviewed-on: https://chromium-review.googlesource.com/430795
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
8 years ago
Andrii Shyshkalov 2f8e924184 git cl status: use smarter parallel processing.
Previously, 1 CL was queried first, followed by all remaining ones
in parallel. The purpose was to ensure that valid authentication
token is present. However, it still required one call to Rietveld
or Gerrit, needlessly increasing latency.

This CL first loops over all CLs and ensures that credentials are
present, refreshing refresh tokens for Rietveld if necessary. Then,
all CLs are queried in parallel.

R=sergiyb@chromium.org,clemensh@chromium.org
BUG=681704

Change-Id: Ic125ac7c2a684d6f3c34e4e8b899192abbed01bb
Reviewed-on: https://chromium-review.googlesource.com/431033
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable 856585ddec Only prompt for clean titles if manually set
We have to clean up the title, but if the user hasn't expressed any
input about the title (i.e. it's one we autogenerated), then don't
bother them by pointing it out.

BUG=684079

Change-Id: I8215e0a30f786466697fe1df178ca90e1980d9b0
Reviewed-on: https://chromium-review.googlesource.com/431162
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrew Bonventre <andybons@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov 5b04a57ab2 git cl + gerrit_util: improve diagnostic logging.
BUG=681704

Change-Id: I1a774350aea901d4e9f2468cff111cbbcd7f3388
Reviewed-on: https://chromium-review.googlesource.com/430794
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
8 years ago
Andrii Shyshkalov 351c61da20 Fix git cl on windows for git-numberer repos.
Git cl decides if git-numberer is enabled on a repository by writing
Gerrit's project.config from refs/meta/config into a tempfile, which is
then queried using `git config -f tempfile --get ...`.  The file itself
is only flushed, but not closed after writing because Python's
tempfile.NamedTemporaryFile is deleted on closing. This worked fine on
Linix/Mac, but not on Windows, where `git config` apparently doesn't see
file or its contents.

This CL rewrites the above using yet another contexmanager temp
directory into which a file is written and closed before git config is
ran.

R=machenbach@chromium.org,grt@chromium.org
BUG=683202

Change-Id: I7974d66b1b2b0478ab4b6f7ac04e547a4981c46c
Reviewed-on: https://chromium-review.googlesource.com/430719
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
8 years ago
Aaron Gable e447411c4e Remove unused FORCE_HTTPS_COMMIT_URL parameter from git-cl
BUG=

Change-Id: Ib8953a7fea4e3cd1c17ea277b5310a31821bfbe8
Reviewed-on: https://chromium-review.googlesource.com/431050
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Christopher Lam 06dba1b159 Add JS to git cl format.
This CL adds .js to the list of file extensions that get clang-formatted.

BUG=567770

Change-Id: Ieed162a84ca68877e5107da1824b1f49c71d51ed
Reviewed-on: https://chromium-review.googlesource.com/429551
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Dan Beam <dbeam@chromium.org>
8 years ago
Aaron Gable 59f4851751 Don't send email to CCs by default on initial upload
It looks like this regressed when we switched from specifying CCs
via the refspec arguments to using the API.

BUG=680605

Change-Id: Iabd397b639989f050932188b1a1aa488639ffbbe
Reviewed-on: https://chromium-review.googlesource.com/427344
Reviewed-by: Andrew Bonventre <andybons@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable b56ad33d00 Respect -t/--title in initial cl uploads to Gerrit
BUG=674254

Change-Id: Icdc572648dfffeca7e28f327e085f64985221ce9
Reviewed-on: https://chromium-review.googlesource.com/425823
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable 4874665738 Make upstream reupload error message clearer
BUG=643466

Change-Id: I6e27334401d541fc4b7b3196465497cab1a78029
Reviewed-on: https://chromium-review.googlesource.com/424968
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Daniel Cheng c55eecf76b Make git cl format work with relative paths arguments.
BUG=none

Change-Id: I6864a8ac16393410280f8cdd38719b02a81f6ce1
Reviewed-on: https://chromium-review.googlesource.com/424147
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
8 years ago
Asanka Herath 7c61dcb36e [git-cl] Preserve line breaks when pretty printing CL description.
Also set the line wrap limit to 72 + indent from 70 columns total. The
latter was limiting the CL description to 68 columns total before
wrapping kicked in.

BUG=none

Change-Id: I93c984c7b121d4bb042d0dc81a662352f77df4d1
Reviewed-on: https://chromium-review.googlesource.com/420243
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
8 years ago
Aaron Gable 1bc7bfe5d9 Remove SVN (and dcommit) support from git-cl
BUG=638750

Change-Id: I9ebe4ff861a37433209b66f4050370b49f17cdc7
Reviewed-on: https://chromium-review.googlesource.com/419661
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov 7d51883926 Gerrit git cl upload: don't print stacktrace on failed git push.
R=agable@chromium.org,hinoka@chromium.org
BUG=674291

Change-Id: Ie71747fd40c171c18687e299032fe826d4d3ae32
Reviewed-on: https://chromium-review.googlesource.com/420723
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Daniel Jacques <dnj@chromium.org>
8 years ago
Quinten Yearsley b2cc4a94da depot_tools: Replace pylint error numbers with symbolic names.
This affects a bunch of files, but only changes comments,
and shouldn't make any difference to behavior.

The purpose is to slightly improve readability of pylint
disable comments.

Change-Id: Ic6cd0f8de792b31d91c6125f6da2616450b30f11
Reviewed-on: https://chromium-review.googlesource.com/420412
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
8 years ago
Quinten Yearsley 442fb64cab depot_tools: Run automatic spell-checker.
Specifically, this CL was made by running codespell
(https://github.com/lucasdemarchi/codespell), manually filtering
for changes in non-third-party files that appear correct.

Change-Id: Ia16c1b29483d777744450d7bea45a178cf877a25
Reviewed-on: https://chromium-review.googlesource.com/420871
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 9b713dd18b Generate patchset name from commit subject
This is a reland of 947f2ee808,
which was reverted in a5a1eea537

BUG=672332

Change-Id: If33c54e500fbeac11f60d81a19549880506c63d8
Reviewed-on: https://chromium-review.googlesource.com/419737
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 02cdbb45a7 Fix gerrit/gitiles typo in git_cl
This is a fix to 32978d969c,
which introduced a "Landed as <gerrit link>" feature to git-cl, but
which at the last minute introduced a typo causing the whole feature
to not actually work.

BUG=661187

Change-Id: Ifef3379a51f035973bc5f3842862528f90bfdf84
Reviewed-on: https://chromium-review.googlesource.com/419782
Reviewed-by: Stephen Martinis <martiniss@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Andrii Shyshkalov b5effa1f24 git cl + git numberer: fix 3+ lineage ordering.
In other words, end 2 end test was a really awesome idea.

R=machenbach@chromium.org,sergiyb@chromium.org
BUG=642493
TEST=git cl land of https://codereview.chromium.org/2575043003 succeeded

Change-Id: I568ce79baf109b2aa556e4343527b63f39c10d00
Reviewed-on: https://chromium-review.googlesource.com/419478
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
8 years ago
Andrii Shyshkalov 8f15f3ec1d git cl refactor: s/should_git_number/should_add_git_number
R=sergiyb@google.com
BUG=chromium:642493

Change-Id: Id7b732d82c25ce88a3295ff54c79cf2a66e0d5b9
Reviewed-on: https://chromium-review.googlesource.com/419437
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov a5a1eea537 Revert "Generate patchset name from commit subject"
This reverts commit 947f2ee808.

Reason for revert: unnecessarily sets the title for the first upload,
which isn't done for Rietveld.

Original change's description:
> Generate patchset name from commit subject
> 
> BUG=672332
> 
> Change-Id: If9c662f11b217a52cac7c9c47ad9f3d978148c2e
> Reviewed-on: https://chromium-review.googlesource.com/419330
> Commit-Queue: Aaron Gable <agable@chromium.org>
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
> 

TBR=agable@chromium.org,tandrii@chromium.org,chromium-reviews@chromium.org
BUG=672332
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: I9dcec1b02c8f16ceca8338acef4a1fc174aef35c
Reviewed-on: https://chromium-review.googlesource.com/419517
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable 947f2ee808 Generate patchset name from commit subject
BUG=672332

Change-Id: If9c662f11b217a52cac7c9c47ad9f3d978148c2e
Reviewed-on: https://chromium-review.googlesource.com/419330
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov 828701bdf3 Gerrit: git cl set-commit -d: don't spam reviwers/owner.
R=sergiyb@chromium.org,machenbach@chromium.org
BUG=

Change-Id: Ia89e91479c22adeebc85a4432cd9f7b8d95a8fde
Reviewed-on: https://chromium-review.googlesource.com/418655
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov f01be229a7 git cl: insert "Review-Url" instead "Review URL" footer like CQ.
R=sergiyb@chromium.org

Change-Id: I2df867e381ceb1035add84563d3b444b0ee0ea94
Reviewed-on: https://chromium-review.googlesource.com/417267
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov 768f1d88a0 git cl: use gnumbd config instead of PENDING_REF_PREFIX of codereview.settings.
BUG=chromium:642493,672043
R=machenbach@chromium.org,iannucci@chromium.org

Change-Id: I0abc31b95b1766fd5fd24c1379b538d0c5291011
Reviewed-on: https://chromium-review.googlesource.com/417259
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
8 years ago
Andrii Shyshkalov cd6a9363ef git_cl: add GitNumbererState in preparation to stop gnumbd service.
The new class is unused and doesn't change any existing functionality.

BUG=chromium:642493
R=machenbach@chromium.org,iannucci@chromium.org

Change-Id: Id3fe71b07b694339f0a620b427816e52560069d8
Reviewed-on: https://chromium-review.googlesource.com/416430
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Andrii Shyshkalov a6695810bb git cl replacing gnumbd: set correct committer timestamp.
BUG=642493
R=sergiyb@chromium.org

Change-Id: I5d8588f2b6f30368188aecab2d2c462a11aa6883
Reviewed-on: https://chromium-review.googlesource.com/414369
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
8 years ago
Andrii Shyshkalov 15e50cc5c4 git cl: implement git number footer generation.
BUG=642493

Change-Id: Ic8eb121b0ad7adcc7a3f3f1967ef2261f415e731
Reviewed-on: https://chromium-review.googlesource.com/414466
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
8 years ago
Andrii Shyshkalov ea4fc839ce Gerrit git cl desc: don't notify reviwers.
R=agable@chromium.org
BUG=644101
TEST=manual

Change-Id: I82b7209981a834c8f26d65d2701d665a4eb2ba51
Reviewed-on: https://chromium-review.googlesource.com/415829
Reviewed-by: Aaron Gable <agable@chromium.org>
9 years ago
Sergiy Byelozyorov 935b93fb9b Only add master. prefix unless one is already specified
BUG=668162

Change-Id: Ie38542eb4627aa8c07adf9d2665b80cdcee2758f
Reviewed-on: https://chromium-review.googlesource.com/414355
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Sergiy Byelozyorov <sergiyb@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
9 years ago
Aaron Gable a45ee11d6e Use 'change' instead of 'issue' when talking about Gerrit CLs
Change-Id: I17884d9ef7efdaf75ed575e66aca1034db0672b5
Reviewed-on: https://chromium-review.googlesource.com/413289
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
9 years ago
Andrii Shyshkalov b8c535f696 Use codereview.settings style for GENERATE_GIT_NUMBER_FOOTERS.
R=sergiyb@chromium.org
BUG=642493

Change-Id: Ic4acf4076fdf27c1ed5e75f0ed1dda4b16d675fc
Reviewed-on: https://chromium-review.googlesource.com/414469
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
9 years ago
Andrii Shyshkalov 5fb4774810 git cl: rework setting to auto-generate git number footers.
BUG=642493

Change-Id: I1c83c54f7ad938cf4abeadb42f8d9414521d6dc5
Reviewed-on: https://chromium-review.googlesource.com/414465
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
9 years ago
Andrii Shyshkalov 813ec3c322 git cl land + gnumbd: add asserts.
BUG=642493

Change-Id: Ib1234922e4bcd4ee286fffb8f7c637e4d2442a42
Reviewed-on: https://chromium-review.googlesource.com/414504
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
9 years ago
Andrii Shyshkalov 06a2502fc9 git cl land: add test expectations for Rietveld.
This is preperatory work for Cr- footers generation in git cl instead
of gnumbd.

BUG=642493

Change-Id: I4cfdd882fe6caa7972e51ffa81d335104ddb56dd
Reviewed-on: https://chromium-review.googlesource.com/414464
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
9 years ago
Aaron Gable 5db8209d92 Don't return 1 when failing to add Gerrit CCs
This causes other automated tooling to think that the entire
upload has failed, when really only a small part of it has.

BUG=666160

Change-Id: I0d646e77c54330d642097aebe70ec145ae291267
Reviewed-on: https://chromium-review.googlesource.com/412281
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
9 years ago
Andrii Shyshkalov 3aac775665 Gerrit git cl land: tell user how to abort.
R=friedman@chromium.org,andybons@chromium.org
BUG=665623

Change-Id: I419c6c01839fd761b1941fdf002fe39769cc1e17
Reviewed-on: https://chromium-review.googlesource.com/411761
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
9 years ago
Ravi Mistry fda50ca02d Skip checking local vs remote patchset for Gerrit
BUG=chromium:664520

Change-Id: Idd5855e14f6237577b351ff51582335996522417
Reviewed-on: https://chromium-review.googlesource.com/399118
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
9 years ago
scottmg b84b5e3a13 Don't --find-copies-harder when printing informational diff, either
We're doing the diff twice afaict, once to print stats to the user, and
once to actually do the upload. Definitely no need to
--find-copies-harder in the print.

Previously: https://codereview.chromium.org/2488823002.

R=dpranke@chromium.org
BUG=544889

Review-Url: https://codereview.chromium.org/2489963003
9 years ago
Andrii Shyshkalov c6c8b4c99b presubmit_support for Gerrit: don't ignore 404.
Before, presubmit_support would fail with not very useful stacktrace if
Gerrit returns 404, which is usually due to missing/invalid credentials.

This CL fixes that and improves the exception message, and also improves
logic in git_cl.

R=agable@chromium.org
BUG=

Change-Id: Iae8f0c24422c46af70929c7d5d71993164887511
Reviewed-on: https://chromium-review.googlesource.com/409650
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
9 years ago
Aaron Gable df86e30194 Clean up gerrit_util's handling of unknown reviewer/cc
This is still important, but at least now it won't result
in a stacktrace.

Change-Id: If6e7e15a98b0a03df7e978201762fea670312ede
Reviewed-on: https://chromium-review.googlesource.com/408660
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
9 years ago
nodir e4f0fe02a9 fix git-cl-try without parameters
Master names were confused with bucket names

R=tandrii@chromium.org, qyearsley@chromium.org
BUG=661580

Review-Url: https://codereview.chromium.org/2482523002
9 years ago
tandrii 8c5a353e63 Implement and test git cl try for Gerrit.
R=borenet@chromium.org,qyearsley@chromium.org
BUG=599931

Review-Url: https://codereview.chromium.org/2468263005
9 years ago
agable 32978d969c git-cl-land: print url of final commit location
BUG=661187

Review-Url: https://codereview.chromium.org/2466953003
9 years ago
qyearsley 136b49ff7e depot_tools: Remove DoGetTrySlaves, GetTrySlavesExecuter, GetPreferredTrySlaves
Note: This CL originally just removed a deprecated use of Remove use of DoGetTrySlaves, suggested in http://crrev.com/2442153002, then was expanded to remove DoGetTrySlaves, GetPreferredTrySlaves and GetTrySlavesExecuter since these are all deprecated and unused.

BUG=660453

Review-Url: https://codereview.chromium.org/2453823002
9 years ago
qyearsley dd49f94cc5 git cl try: Simplify _get_bucket_map.
Assuming that assuming bots are always just builder names, and they're never specified along with tests in git cl --bot options, then some logic used for git cl try can be removed.

Review-Url: https://codereview.chromium.org/2448193006
9 years ago
qyearsley 123a468d14 git cl try: support multiple bots from different masters without specifying master.
It might be good to make this change after the refactoring CL http://crrev.com/2442153002.

BUG=640740

Review-Url: https://codereview.chromium.org/2439293002
9 years ago
qyearsley 5eb0519b4c git cl try: Remove --name option, stop sending "reason" property.
When triggering the build, there's a field called "reason",
which is currently populated by default with the user's
branch name.

I have a feeling that this is optional and could be completely
omitted.

Andrii notes that if users want to send a "reason" string,
they could send invoke git cl try with the argument -p reason="<reason>".

PSA on infra-dev:
https://groups.google.com/a/chromium.org/d/msg/infra-announce/PXkM1WinTYY/w2IvN5B4AwAJ

BUG=659552

Review-Url: https://codereview.chromium.org/2428383010
9 years ago
qyearsley 1fdfcb6316 Refactoring: Extract helper functions from CMDtry in git_cl.py.
The purpose of this change is to prepare for modifying git cl try
so that builders on multiple masters can be triggered in one invocation
(http://crbug.com/640740).

This should not affect behavior; this CL makes several non-essential
changes to formatting and comments.

Review-Url: https://codereview.chromium.org/2442153002
9 years ago
nodir 70d11c3759 git_cl: fix GetPreferredTryMasters() feature
It was broken in https://chromiumcodereview.appspot.com/2419113002

R=borenet@chromium.org
BUG=658317

Review-Url: https://codereview.chromium.org/2442393002
9 years ago
skobes 6468b9068b Make git cl patch work with binary files.
BUG=557512

Review-Url: https://codereview.chromium.org/2445543002
9 years ago
qyearsley 99e2cdf47a Print failure reason when git cl try can't trigger jobs on a CL.
This is a very little fix.

Review-Url: https://codereview.chromium.org/2441213002
9 years ago
bradnelson d975b30c20 Automatically CC folks listed in CC= lines.
Detect CC=<users> lines the way we detect R= and TBR=.
Add these as CC'ed users for rietveld and gerrit.

R=iannucci@chromium.org,hinoka@chromium.org,dnj@chromium.org

Review-Url: https://codereview.chromium.org/2433323004
9 years ago
borenet 6c0efe6050 Add -B/--bucket flag to git-cl try
BUG=

Review-Url: https://chromiumcodereview.appspot.com/2419113002
9 years ago
tandrii 2a16b95eb1 git cl: refactor direct usage of time.sleep and time.time.
R=machenbach@chromium.org

Review-Url: https://chromiumcodereview.appspot.com/2433813004
9 years ago
Dan Jacques 78de30e1bb Revert "git_cl: Allow server overriding."
This reverts commit a8fb3a2892.
9 years ago
Dan Jacques a8fb3a2892 git_cl: Allow server overriding.
BUG=chromium:657064
TEST=local
  - Ran "git cl status" during outage with override, works.

R=tandrii@chromium.org

Review URL: https://chromiumcodereview-hr.appspot.com/2425673005 .
9 years ago
tandrii 48df58136d Gerrit git cl: make it work with minimal file.
BUG=656555
R=emso@chromium.org,andybons@chromium.org

Review-Url: https://codereview.chromium.org/2421253002
9 years ago
rmistry c9ebbd2463 Fix logic to detect Gerrit CL in CQ
BUG=chromium:656042

Review-Url: https://codereview.chromium.org/2419123002
9 years ago
tandrii de281aee41 git cl try: make code less Rietveld-specific.
This also adds first test to cover case of custom properties.

R=machenbach@chromium.org,sergiyb@chromium.org
BUG=599931

Review-Url: https://codereview.chromium.org/2409223002
9 years ago
tandrii e113dfd7a1 git cl try: refactor to add Gerrit support in the future.
R=nodir@chromium.org,sergiyb@chromium.org
BUG=599931

Review-Url: https://codereview.chromium.org/2400713003
9 years ago
tandrii 568043bdd9 git cl try: remove --use-rietveld and related code.
R=nodir@chromium.org,sergiyb@chromium.org
BUG=599931

Review-Url: https://codereview.chromium.org/2401943002
9 years ago
tandrii 45b2a5891a git cl try-results regression tests for Gerrit.
The flow looks like this:

  $ git cl status
  Branches associated with reviews:
    gerrit-4483 : https://chromium-review.googlesource.com/381231 (waiting)

  $ git cl try-results
  Warning: Codereview server has newer patchsets (2) than most recent
  upload from local checkout (None). Did a previous upload fail?
  By default, git cl try uses latest patchset from codereview,
  continuing using such patchset 2.

  Warning: Some results might be missing because You are not logged in.
  Please login first by running:
    depot-tools-auth login chromium-review.googlesource.com
  Started:
    Infra Linux Precise 32 Tester https://luci-milo.appspot.com/swarming/...
    Infra Linux Trusty 64 Tester  https://luci-milo.appspot.com/swarming/...
  Total: 2 try jobs

  $ depot-tools-auth login chromium-review.googlesource.com
   <<<auth in my browser>>>

  Logged in to chromium-review.googlesource.com as <some@email.com>

	To login with a different email run:
		depot-tools-auth login chromium-review.googlesource.com
	To logout and purge the authentication token run:
		depot-tools-auth logout chromium-review.googlesource.com

  $ git config branch.gerrit-4483.gerritpatchset 2
  $ git cl try-results
  Started:
    Infra Linux Precise 32 Tester https://luci-milo.appspot.com/swarming/...
    Infra Linux Trusty 64 Tester  https://luci-milo.appspot.com/swarming/...
    Infra Mac Tester              https://luci-milo.appspot.com/swarming/...
  Total: 3 try jobs

R=sergiyb@chromium.org,emso@chromium.org
BUG=599931
TEST=new unittests + end-to-end local.

Review-Url: https://codereview.chromium.org/2392463009
9 years ago
tandrii c2405f5545 git cl patch: handle missing/wrong Gerrit issue better.
No stacktrace is printed, instead just a user-friendly string is shown.
Add test + some tests refactoring.

This CL also improve missing Gerrit issue exception elsewhere by raising
user-friendly exception.

BUG=654360
R=sergiyb@chromium.org
TEST=manual

Review-Url: https://codereview.chromium.org/2403793002
9 years ago
tandrii 8e22954683 git cl try: --use-rietveld no longer supported.
R=nodir@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2399993004
9 years ago
tandrii f7b29d4a6d Refactor git cl try.
R=phajdan.jr@chromium.org,sergiyb@chromium.org
BUG=599931

Review-Url: https://codereview.chromium.org/2400793004
9 years ago
tandrii 221ab25f46 git cl try-results: refactor Rietveld + add tests.
R=emso@chromium.org,phajdan.jr@chromium.org
BUG=599931
TEST=new teste + local end-to-end

Review-Url: https://codereview.chromium.org/2395113002
9 years ago
tandrii 1838bade43 git cl: style cleanup.
R=emso@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2393253002
9 years ago
tandrii 8818977467 Reland of Add CC_LIST and --cc to Gerrit issues via API to be similar to CCs in Rietveld
Originally landed as issue 2378703002 at patchset 60001
(http://crrev.com/2378703002#ps60001).

BUG=chromium:649660
TBR=rmistry@chromium.org

Review-Url: https://codereview.chromium.org/2376323002
9 years ago
tandrii 31d165a5c1 Revert of Add CC_LIST and --cc to Gerrit issues via API to be similar to CCs in Rietveld (patchset #4 id:60001 of https://codereview.chromium.org/2378703002/ )
Reason for revert:
Actually, it doesn't break uploads, add cc-ed emails post-upload fails with exception and confuses users, and I couldn't find workaround.

Original issue's description:
> Add CC_LIST and --cc to Gerrit issues via API to be similar to CCs in Rietveld
>
> BUG=chromium:649660
>
> Committed: 3574740929

TBR=rmistry@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:649660

Review-Url: https://codereview.chromium.org/2375393002
9 years ago
rmistry 3574740929 Add CC_LIST and --cc to Gerrit issues via API to be similar to CCs in Rietveld
BUG=chromium:649660

Review-Url: https://codereview.chromium.org/2378703002
9 years ago
stip 7a3dd3570e Change usage of deprecated flag.
BUG=Every time I run 'git cl upstream' I get "The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to."

Review-Url: https://codereview.chromium.org/2352393003
9 years ago
agable 3b9a5bb84f Delete git-auto-svn and its docs
We no longer support git-svn as a workflow.

R=iannucci@chromium.org
BUG=475320

Review-Url: https://codereview.chromium.org/2360143002
9 years ago
rmistry 9eadede7df Add ability to set topic during "git cl upload"
BUG=chromium:628237

Review-Url: https://codereview.chromium.org/2343363003
9 years ago
tandrii bf42940536 git cl land to refs/pending: remove unused arg.
R=iannucci@chromium.org
BUG=642493

Review-Url: https://codereview.chromium.org/2322783002
9 years ago
tandrii 73449b0bd4 Gerrit git cl land: abort if not uploaded.
R=agable@chromium.org
BUG=642759,609225

Review-Url: https://codereview.chromium.org/2317253003
9 years ago
tandrii 5d0a0421ce git_cl: update outdated TODOs.
R=machenbach@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2339903002
9 years ago
tandrii f46c20fcee codereview.settings: add GIT_NUMBER_FOOTER setting.
This will be used in repositories that use Cr-Commit-Position footers
to generate them at the time of git cl land instead of gnumbd.

R=iannucci@chromium.org
BUG=642493

Review-Url: https://codereview.chromium.org/2324583002
9 years ago
agable c6787971b5 Use 'draft' status to restrict access to private Gerrit reviews
R=andybons@chromium.org, tandrii@chromium.org

Review-Url: https://codereview.chromium.org/2324283002
9 years ago
dsansome e2d6fd987e Prompt to delete pending edits before changing the Gerrit CL description.
BUG=641838

Review-Url: https://codereview.chromium.org/2318903002
9 years ago
dnj ba1b0f3795 git_cl: Enable updating description from local.
Currently, if one edits one's local CL description (e.g., `git commit
--amend`), there is no path for that update to get pushed to Rietveld.
This adds a "+" sentinel to the "-n" flag for `git cl description` that
tells it to load description content from the local commit.

The description should match what would be generated by "git cl upload".

BUG=None
TEST=local

Review-Url: https://codereview.chromium.org/2307463002
9 years ago
qyearsley 53f48a1c52 Add a --json option to git cl try-results.
For use in scripts that check try job results, this is
currently practically the same as making requests to
https://codereview.chromium.org/api/<cl-number>/<patchset-number>.

However, I think that this might be more future-proof, since
it fetches try job information from Buildbucket, and I expect
to still work after migration from Rietveld to Gerrit.

BUG=640354

Review-Url: https://codereview.chromium.org/2274743003
9 years ago
thomasanderson 074beb2e46 Add --stat option to git-cl diff
Review-Url: https://codereview.chromium.org/2285393002
9 years ago
tandrii c4344b5958 Fix Gerrit git cl land and add test.
R=andybons@chromium.org
BUG=641127

Review-Url: https://codereview.chromium.org/2280563003
9 years ago
agable f14eaff814 Remove --base_url from git cl and upload.py
R=tandrii@chromium.org
BUG=638750

Review-Url: https://codereview.chromium.org/2271873003
9 years ago
agable 92bec4f56f Delete gcl, drover, and trychange
These tools are relatively standalone, and only ever worked for SVN.
Removing these is a good start to removing other SVN support code.

R=maruel@chromium.org
BUG=475321

Review-Url: https://codereview.chromium.org/2269413002
9 years ago
qyearsley 12fa6ff69b Run auto-spell-checker (codespell) on files in depot_tools.
This should only change spelling in:
 - messages that are printed
 - comments
 - docstrings

Review-Url: https://codereview.chromium.org/2277513002
9 years ago
qyearsley eab3c04311 Change "tryjob" -> "try job" in git_cl.py and trychange.py.
I know this is an unimportant change, and that across Chromium,
"try job" and "tryjob", and "try bot" and "trybot" are basically
interchangeable, still I think it's nice to have the spelling
consistent within one module.

I prefer the version with a space just because that's what's used
in the documentation:
https://www.chromium.org/developers/testing/try-server-usage

Review-Url: https://codereview.chromium.org/2269283002
9 years ago
kmarshall 9249e01b70 git cl archive: Add "--dry-run" and "--notags" flags.
This CL adds a couple flags to "git cl archive".
dry-run: Lists the cleanup tasks, but exits before any changes are
made to Git.
notags: Deletes branches only; does not create archival tags.

R=tandrii@chromium.org,groby@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2276663002
9 years ago
tandrii 33a46ffb3f git cl: workaround against integer overflows of git config.
R=maruel@chromium.org,phajdan.jr@chromium.org
BUG=640115

Review-Url: https://codereview.chromium.org/2272613002
9 years ago
phajdan.jr e328cf9c78 git cl issue: add --json switch for machine-readable output
This was requested in https://chromium-review.googlesource.com/c/373499

BUG=none

Review-Url: https://codereview.chromium.org/2263103002
9 years ago
tandrii df09a46d7c git cl patch: bail out quickly if there is no branch.
This is because later calls to SetIssue() would fail.

R=michaelpg@chromium.org
BUG=611020

Review-Url: https://codereview.chromium.org/2259993002
9 years ago
tandrii 5d48c32f3d git cl: cleanup branch config get/set/unset.
Previously there was a soup with add-hoc formatting with
current branch name, which wasn't always set (see bug 611020).
This CL makes sure all such operations now:
 * properly use types --int and --bool
 * go through the *only* appropriate get/set/unset function.

Furthermore, tests were a mess wrt to raising exceptions when
git processes terminated with an exception. This CL cleaned up,
though I didn't go through all expectations, so some returns of
empty stdout instead of raising CalledProcess error are likely
remaining.

Disclaimer: this CL is not necessarily fixing the referenced bug
below, but it should at least provide better stacktrace when
the bug manifestst itself.

BUG=611020
R=agable@chromium.org

Review-Url: https://codereview.chromium.org/2259043002
9 years ago
tandrii 4d8955052f git cl: avoid infinite recursion during debug/development.
R=andybons@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2260453002
9 years ago
iannucci e53c935fe7 Add --issue to set-commit and set-close too.
R=phajdan.jr@chromium.org, tandrii@chromium.org, vadimsh@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2245263007
9 years ago
tandrii 99a72f2514 Gerrit git cl upload: self-lgtm on TBR.
BUG=626364
R=andybons@chromium.org
TEST=manual: https://chromium-review.googlesource.com/#/c/372138

Review-Url: https://codereview.chromium.org/2259583002
9 years ago
iannucci 3c972b9039 Add --issue flag to git cl status.
R=phajdan.jr@chromium.org, vadimsh@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2250323003
9 years ago
tandrii ea9514aa20 Fix bug in git cl status and add logging.
BUG=629863
R=seanmccullough@chromium.org,andybons@chromium.org

Review-Url: https://codereview.chromium.org/2249303003
9 years ago
tandrii eefe83265b Gerrit git cl upload: auto-filter patchset titles.
Without it, upload fails because ref is invalid.

BUG=622062
R=andybons@chromium.org

Review-Url: https://codereview.chromium.org/2252043002
9 years ago