Commit Graph

1222 Commits (78753da20ee812116f2cec5daed8a22b20e66352)

Author SHA1 Message Date
Paweł Hajdan, Jr c93643954d gclient: add cwd support for hooks
This makes it possible to run hooks properly
in flattened DEPS.

Bug: 570091
Change-Id: If8175a57ebe8f607bd4ac83d4a26dcc4cc18165c
Reviewed-on: https://chromium-review.googlesource.com/535476
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
8 years ago
Paweł Hajdan, Jr c10a4d88a4 gclient: extract Hook class
This will be useful e.g. to add cwd support for flatten.

No intended behavior change.

Bug: 570091
Change-Id: I014f97739676d55f6d5b37c10afd9221b1d0978d
Reviewed-on: https://chromium-review.googlesource.com/534193
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
8 years ago
Paweł Hajdan, Jr c9603f5735 gclient flatten: add support for deps_os
Bug: 570091
Change-Id: I3b9fc0560bf744efed9e7f6d9a6595477cffbf8d
Reviewed-on: https://chromium-review.googlesource.com/534393
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@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
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
Dan Jacques 59a74ed558 Add cleanup dir, use with bot_update.
Currently, "bot_update" relies on a BuildBot cleanup mechanism and, to a
lesser extent, the standard BuildBot directory layout. Both of these are
problematic when projecting it into other circumstances, notably
"remote_run" and LUCI.

Have "bot_update" handle its own cleanup. It will now choose a cleanup
directory within the hierarchy of its checkout, and explicitly purge it
prior to execution if it exists. This enforces its expected behavior in
all circumstances and removes its expectations of the greater checkout
layout.

Export "cleanup_dir" via "infra_paths" to point to "build.dead" when
running on BuildBot builds. Otherwise, it is a default directory which,
on Kitchen, is ephemeral by design.

BUG=chromium:725631
TEST=expectations

Change-Id: I664434c542a25aaa7ff3eac216208a2425730fde
Reviewed-on: https://chromium-review.googlesource.com/528057
Commit-Queue: Daniel Jacques <dnj@chromium.org>
Reviewed-by: Ryan Tseng <hinoka@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@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 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
Paweł Hajdan, Jr 3c2aa83894 gclient flatten: handle GN settings
Bug: 570091
Change-Id: I5c7cf00722c47a2063a8635822c0bb270a26b524
Reviewed-on: https://chromium-review.googlesource.com/527632
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
8 years ago
Paweł Hajdan, Jr 572537307e gclient: implement exporting variables to .gni files
Bug: 570091
Change-Id: Ib2b966b5bc967de11a295b1636c1901faabea55f
Reviewed-on: https://chromium-review.googlesource.com/525540
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
8 years ago
Paweł Hajdan, Jr f69860bdbf gclient: evaluate conditions for deps
Bug: 570091
Change-Id: Id95be31767d302c5eb9f7de96d31e32cc4dec1a4
Reviewed-on: https://chromium-review.googlesource.com/524492
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@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
Paweł Hajdan, Jr 76c6ea28e5 gclient_eval: implement boolean expressions
Bug: 570091
Change-Id: I72326ee6ddd907a97b5c497a8b2cc7fb744cf422
Reviewed-on: https://chromium-review.googlesource.com/523142
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
8 years ago
Paweł Hajdan, Jr c485d5a5d9 gclient: use new exec logic when validation is enabled
This way we can get e.g. ordered dict as needed for conditions.
Only the new logic does it, not the regular python exec logic.

Bug: 570091
Change-Id: Ia5554e5b018085b3b9bd876b7f28a9f8e54a7984
Reviewed-on: https://chromium-review.googlesource.com/522564
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
8 years ago
Paweł Hajdan, Jr 7cf96a4b4b gclient_eval: use ordered dict
This is a step towards implementing conditions.

Bug: 570091
Change-Id: I99467033082d96021854c23dcff3fc2b56f995b4
Reviewed-on: https://chromium-review.googlesource.com/517107
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
8 years ago
Pierre-Antoine Manzagol fc1c6f4c1f Correct Git show's path format on Windows
_CalculateAddedDeps calls into depot tools' scm.py GetOldContents to
compare previous and current versions of the DEPS file. GetOldContents
attempts to 'git show <sha>:<path>'. The problem on Windows is that path
uses '\' but git show seems to want a posix path. Git show therefore
doesn't find the file and returns an empty output, leading presubmit to
think all the deps are new.

Bug:725933
Change-Id: Ifbbfbcba4be466d9be623826818fd191bd2ca525
Reviewed-on: https://chromium-review.googlesource.com/514142
Commit-Queue: Nodir Turakulov <nodir@chromium.org>
Reviewed-by: Nodir Turakulov <nodir@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
Paweł Hajdan, Jr c515a8bc46 bot_update: expose --disable-syntax-validation to recipes
Some recipes interacting with older revisions (e.g. bisect)
will need this.

Bug: 570091
Change-Id: I38e5ffa2db1a9bfae3667f015f00977c32ebe51e
Reviewed-on: https://chromium-review.googlesource.com/519407
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
8 years ago
Paweł Hajdan, Jr 05fec0394f gclient: fix recursedeps tuple/list validation for chromeos
Bug: 727685, 570091
Change-Id: I97a99d15930c1662c0ecfacd3755af27b282f686
Reviewed-on: https://chromium-review.googlesource.com/517800
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Paul Hobbs <phobbs@google.com>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
8 years ago
Paweł Hajdan, Jr b7e533360c gclient validate: schema fixes (patch #1)
- allow None in deps_os values (for chromeos buildspecs)
- allow string formatting (%) in expressions (for dart)
- allow empty lists/dicts (for build slaves)
- allow target_os (for internal android)

Bug: 570091, 722206, 725422
Change-Id: I7f3d822a1c4aac16fddd96ef2f9f365e05b2d0e8
Reviewed-on: https://chromium-review.googlesource.com/512724
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
8 years ago
Paweł Hajdan, Jr 7e9303ba19 gclient: remove support for From() (reland #1)
Original CL: https://chromium-review.googlesource.com/509693

This feature appears unused, and removing it will simplify the codebase.

Bug: 661382
Change-Id: I0d83b537b57d0b9ca65c7101d13e0ad6c1642a29
Reviewed-on: https://chromium-review.googlesource.com/512842
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
8 years ago
Andrii Shyshkalov b4f9d90473 Revert "gclient: remove support for From()"
This reverts commit bf72b593a2.

Reason for revert: maybe caused outage.

Original change's description:
> gclient: remove support for From()
> 
> This feature appears unused, and removing it will simplify the codebase.
> 
> Bug: 661382
> Change-Id: I545befb2c592eea53c54552018ce2d3dda7670f5
> Reviewed-on: https://chromium-review.googlesource.com/509693
> Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
> Reviewed-by: Dirk Pranke <dpranke@chromium.org>
> 

TBR=phajdan.jr@chromium.org,dpranke@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Bug: 661382

Change-Id: I4db9554a0a3a64a3a69908560b6da2a9963518f2
Reviewed-on: https://chromium-review.googlesource.com/512343
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Paweł Hajdan, Jr bf72b593a2 gclient: remove support for From()
This feature appears unused, and removing it will simplify the codebase.

Bug: 661382
Change-Id: I545befb2c592eea53c54552018ce2d3dda7670f5
Reviewed-on: https://chromium-review.googlesource.com/509693
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@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 12ef501b02 Parse Bug, R, and Tbr git-footers in PRESUBMIT
This gives PRESUBMIT equal support for all the
gerrit-style footers that we're migrating to.

R=iannucci@chromium.org, tandrii@chromium.org

Bug: 710327,710803
Change-Id: I64b8f39ef923d90ebda7dd191b83d1a7cc87c776
Reviewed-on: https://chromium-review.googlesource.com/506551
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Paweł Hajdan, Jr 064f6f4a9d gclient flatten: first pass
This is based on https://codereview.chromium.org/2474543002/

Bug: 661382
Change-Id: I191ec16e0ce69a782979ae7d59b108747429ab78
Reviewed-on: https://chromium-review.googlesource.com/505067
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Michael Moss <mmoss@chromium.org>
8 years ago
Aaron Gable fc03e67e9a Refactor PRESUBMIT support for tags
We want PRESUBMIT to be able to equally support
BUG= tags (old style) and Git-Footer: footers
(new style). This change refactors the way that
the presubmit api gives access to those properties
so that it is easier to add support for equivalent
footers.

It also limits the scope of tags/footers that it
exposes, as code search shows no PRESUBMIT files
that take advantage of any of the more esoteric
ones.

Bug: 710327, 710803
Change-Id: I86f1d6cb2e1f0aff9653ef3fb455e0a6f47acf5d
Reviewed-on: https://chromium-review.googlesource.com/506450
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Michael Achenbach 7f8c775571 Revert "gclient: return non-zero exit code on unknown command"
This reverts commit 2c199e1ec4.

Reason for revert: This makes calls to gclient that have the only intention of updating gclient fail, like:
https://cs.chromium.org/chromium/src/v8/tools/try_perf.py?l=93

Reverting for now to give time to clean up such scripts before reland.

Original change's description:
> gclient: return non-zero exit code on unknown command
> 
> Bug: none
> Change-Id: I447f66765679b7b66b5748af1cf1f501610603bf
> Reviewed-on: https://chromium-review.googlesource.com/504408
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
> Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
> 

TBR=iannucci@chromium.org,phajdan.jr@chromium.org,dpranke@chromium.org,tandrii@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Bug: none

Change-Id: I9496f7192dfde1e38c186a94ac985190b76b2438
Reviewed-on: https://chromium-review.googlesource.com/506563
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
8 years ago
Aaron Gable 93248c5ccb owners: handle CLs which only have partial OWNERS
If every file in a change has OWNERS, then the code would find
them fine. Similarly, if no files has OWNERS, then this code would
return an empty set just fine.

But if some files had OWNERS while others didn't, it would crash
when it tried to find an OWNER for file 'foo' while all the possible
OWNERS only provided coverage for file 'bar'.

This code purges the list of possible OWNERS as they become useless
for providing additional coverage, and returns whatever set we have
accumulated so far when the set of possible OWNERS becomes empty.

R=iannucci@chromium.org

Bug: 715062
Change-Id: I408601bd89379381db1cc7df56beed97ab3c27e6
Reviewed-on: https://chromium-review.googlesource.com/506239
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
8 years ago
Scott Graham c482674289 Add support for hooks_os in .gclient
This adds support for 'hooks_os' in .gclient which runs the given hooks
only when the associated os is specifed in target_os.

Bug: 706592
Change-Id: If70e51e0e784f8a8c6e45b33f59605b883a16f6e
Reviewed-on: https://chromium-review.googlesource.com/503534
Reviewed-by: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
8 years ago
Paweł Hajdan, Jr 2c199e1ec4 gclient: return non-zero exit code on unknown command
Bug: none
Change-Id: I447f66765679b7b66b5748af1cf1f501610603bf
Reviewed-on: https://chromium-review.googlesource.com/504408
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
8 years ago
Andrii Shyshkalov 04b51d6de0 Reland of Relax git_footers parsing to match that of Gerrit (JGit).
Previously landed as:
> Change-Id: Ieb6415d55e85b91f11f9052b0fd08cf982b64d51
> Reviewed-on: https://chromium-review.googlesource.com/501849

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

Bug: 717504
Change-Id: Iede5c29ff4c317b68d8c2bca319edec140a176f5
Reviewed-on: https://chromium-review.googlesource.com/502908
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
8 years ago
Andrii Shyshkalov 43ec62ec71 Revert "Relax git_footers parsing to match that of Gerrit (JGit)."
This reverts commit 28a5d5defd.

Reason for revert: breaks assumption in function for adding footers

Original change's description:
> Relax git_footers parsing to match that of Gerrit (JGit).
> 
> R=​agable@chromium.org
> 
> Bug: 717504
> Change-Id: Ieb6415d55e85b91f11f9052b0fd08cf982b64d51
> Reviewed-on: https://chromium-review.googlesource.com/501849
> Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
> Reviewed-by: Aaron Gable <agable@chromium.org>
> 

TBR=agable@chromium.org,machenbach@chromium.org,tandrii@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Bug: 717504

Change-Id: I9b4d619b2972be8434aff9464f1959fbcb3abd32
Reviewed-on: https://chromium-review.googlesource.com/503030
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Paweł Hajdan, Jr beec006697 gclient validate: add schema checking
Bug: 570091
Change-Id: I1297f817f2e3d791c22b256de40f12c0c23dceb5
Reviewed-on: https://chromium-review.googlesource.com/500807
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
8 years ago
Andrii Shyshkalov 28a5d5defd Relax git_footers parsing to match that of Gerrit (JGit).
R=agable@chromium.org

Bug: 717504
Change-Id: Ieb6415d55e85b91f11f9052b0fd08cf982b64d51
Reviewed-on: https://chromium-review.googlesource.com/501849
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Aaron Gable <agable@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
Paweł Hajdan, Jr e2f9feecaf Add validate command to gclient
Inspired by https://chromium-review.googlesource.com/c/411515/ .

Bug: 570091
Change-Id: I7bf9653178c06125ae8be1dee021acfc187b2bdc
Reviewed-on: https://chromium-review.googlesource.com/497848
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
8 years ago
Aaron Gable b584c4f0d1 Make CQ_INCLUDE_TRYBOTS support review-specific
This CL wholly revamps the way presubmit_support adds
CQ_INCLUDE_TRYBOTS lines in commit descriptions. In
particular, when the CL is being uploaded to Gerrit,
it uses our pre-existing support for manipulating git
footers to make the whole process much simpler.

R=tandrii@chromium.org

Bug: 710547
Change-Id: I5858282a44c590f131021fa3820f1cb3f70ef620
Reviewed-on: https://chromium-review.googlesource.com/487831
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable c7e84d0413 git-drover: TBR appropriate reviewers
When uploading to either Rietveld or Gerrit, this will
cause git-cl to add the appropriate reviewers to the
cherry-pick review, so they're aware the change is being
copied to the release branch.

When uploading to Gerrit, this will also cause git-cl to
set the Code-Review+1 bit, allowing the CL to be landed

R=tandrii@chromium.org

Bug: 714720
Change-Id: Ie04e2657a91e4345796ac2200c0115fb18e460a1
Reviewed-on: https://chromium-review.googlesource.com/486961
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Aaron Gable c06db440c9 Make git_footers.add_footer more flexible
This allows inserted footers to be specified as either before
or after other potentially-present footers.

It has one slight behavior change (reflected in the tests):
If after_keys is specified but *doesn't match* any pre-existing
footers, then the behavior does *not* switch to "insert as early
as possible". The behavior switch only happens if the after_keys
actually match a footer.

R=iannucci@chromium.org

Bug: 710547
Change-Id: If557978fe9309785285056eb557acbdc87960bb2
Reviewed-on: https://chromium-review.googlesource.com/487606
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Andrii Shyshkalov 80cae42d7f Fix git_footers to recognize footers with empty value.
R=agable@chromium.org,iannucci@chromium.org

Before, this block of footers won't be recognized by git_footers:
  Bug:
  Change-Id: xxx

because of empty value for "Bug:". This CL fixes this behavior.

Bug: 715614
Change-Id: Iabe45bfc027fda15cbe0cd5ce9b883ce3b891220
Reviewed-on: https://chromium-review.googlesource.com/487963
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
8 years ago
Kenneth Russell df6e7348b9 Fix addition of CQ_INCLUDE_TRYBOTS on Gerrit.
BUG=710547

Change-Id: I6558ba08683b8e010ac5051dabfd82d9a5b9c551
Reviewed-on: https://chromium-review.googlesource.com/486083
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
8 years ago
Andrii Shyshkalov e6e2375546 Rietveld: fix search query.
R=maruel@chromium.org,jrobbins@chromium.org
BUG=712060

Change-Id: I16651d9926fe0f3a74549a4c03896220f9a58f94
Reviewed-on: https://chromium-review.googlesource.com/482659
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
8 years ago
Jochen Eisinger b624bfe0d0 Only attribute comments to owners that are close to the comment
A comment that is preceded with an empty line (or starts at the
beginning of the file) will be attributed to owners listed directly
below the comment. Otherwise, if the comment is in the middle of
a list of owners, it will only be attributed to the next owner.

BUG=712589
R=dpranke@chromium.org

Change-Id: I19bd7809836b6ee65ef56e2ec399e5cd09eaa132
Reviewed-on: https://chromium-review.googlesource.com/481303
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@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
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