Commit Graph

710 Commits (518bb6847a6e29b2bc23a2b7b3a39d9aa5adc166)

Author SHA1 Message Date
Dirk Pranke bf98088faf Add a --batch mode to `git-cl owners`.
This allows a script to generate a sufficient list of owners (and 
reviewers) for a given CL. Unlike the owners presubmit check and 
the normal, interactive mode of `git-cl owners`, we do not print 
the comments associated with an owner for each file, since 
presumably a script doesn't care about them (and the comments
aren't in a particularly machine-parsable form, anyway).

This could be used by the WPT import scripts, and presumably
by roll scripts and other such things.

I didn't add a test for this because there appears to be no good
mechanism for testing top-level CMD functions in git_cl that 
didn't end up just repeating the code mock-for-mock :(.

R: phajdan.jr@chromium.org
Change-Id: I3a9e6d117d6f4bafe938b07b028f119835c3e575
Reviewed-on: https://chromium-review.googlesource.com/648653
Reviewed-by: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
8 years ago
Ilya Sherman 235b70db85 [git cl format] Actually format metrics XML files (fix an indentation error)
I introduced an indentation error in [1] which caused "git cl format" to
typically do nothing for histograms.xml and other metrics XML files. Oops.

[1] https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/569105

R=dpranke@chromium.org

Bug: 757939
Change-Id: Iab9975588156fca29e119e889ae634c5f77cb704
Reviewed-on: https://chromium-review.googlesource.com/627590
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Ilya Sherman <isherman@chromium.org>
8 years ago
Aaron Gable 01b9106917 Support new urls in git-cl
This adds support for the new urls (which contain the project) to
git-cl [description|checkout|issue|patch] and others.

Bug: 757602
Change-Id: I6e854a85e655e14daa7e4172ca938953778bf514
Reviewed-on: https://chromium-review.googlesource.com/634518
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Ilya Sherman e081cbe5aa [git cl format] Pass --presubmit flag when formatting from presubmit.
This allows us to skip 'git cl format' for histograms.xml, which in
turn allows us to issue a presubmit error rather than a warning when
that file is malformatted, without running the formatting code twice.
The formatter is somewhat slow for this file, so it's helpful to avoid
duplicating that work.

BUG=none
TEST=none
R=iannucci@chromium.org

Change-Id: Ia86d45c7c56a9f89db34ca7175ef686589084f85
Reviewed-on: https://chromium-review.googlesource.com/569105
Commit-Queue: Ilya Sherman <isherman@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
8 years ago
Andrii Shyshkalov 0d2dea0a5f git cl creds-check: special case parsing of chromium.org emails.
R=phajdan.jr@chromium.org

Change-Id: Ia1380bc0cfff50e82f9a26d3c54e9dc34a38c7b5
Reviewed-on: https://chromium-review.googlesource.com/574528
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Reviewed-by: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
8 years ago
Aaron Gable f7543cddc3 git-cl: accept --force for -f everywhere
TBR=tandrii@chromium.org

Change-Id: I2feddebee6d667c6c60ec1a306d175adff262be5
Reviewed-on: https://chromium-review.googlesource.com/580362
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable ca01e2c8dc git cl issue 0: Remove Change-Id from message, not description
Using self.GetDescription() uses the description from the web.
Given that the user is purposefully disassociating their current
branch from the review on the web, they may have already changed
the commit message. We shouldn't set it back.

Bug: 742730
Change-Id: I0545cb6288c332fd475d1de7fb302f71ee41a415
Reviewed-on: https://chromium-review.googlesource.com/578229
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable fc62f76824 Simplify notify behavior in git-cl
Change-Id: I872658970c04cdadda2b0eaffd95e10717c09493
Reviewed-on: https://chromium-review.googlesource.com/575009
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable e5adf61266 Fix typo with --send-email [sic] flags
The actual flag is --send-mail. Also includes a fix
to publish these changes if a comment is included.

Bug: 740950
Change-Id: I38ca0a35c1364c8364eb0ef301137c04daede40b
Reviewed-on: https://chromium-review.googlesource.com/572033
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 636b13fc3d Let Changelist().AddComment() mark changes as Ready
In Rietveld, adding a comment to a change automatically
published it no matter what. In Gerrit, we need to explicitly
mark the change as Ready for Review. This CL adds a new
parameter to the wrapper methods around the SetReview
API so that they can mark changes as Ready.

Bug: 740950
Change-Id: Icb2ad7c5beb03a4760657a761841745f0d75514e
Reviewed-on: https://chromium-review.googlesource.com/572031
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 4e5207d6f0 git-cl issue 0: Don't operate on empty description
TBR=tandrii

Bug: 741648
Change-Id: If9bcab1892e30ea5fae127302da12f0d9a201cb8
Reviewed-on: https://chromium-review.googlesource.com/570181
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
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