Commit Graph

1041 Commits (3e50cf453e79d262fed2b9ff59b8c82cb86c3e3f)

Author SHA1 Message Date
Lukasz Anforowicz b4d3954db7 [rust] [depot_tools] Minimal `rustfmt` support for `git cl format`.
This CL provides minimal `git cl format` support to enforce correct Rust
formatting in presubmit checks.  For now the files are always fully
formatted - there is no support at this point for formatting only the
changed lines.

Manual tests (after temporarily, artificially introducing a formatting
error to one of .rs files under build/rest/tests):

*) git cl presubmit
   Result: The src directory requires source formatting.
           Please run: git cl format

*) git cl format --dry-run
   Result: Pretty/colorful diff printed out.

*) git cl format
   Result: Temporary formatting errors are fixed.

Bug: chromium:1231317
Change-Id: I114ece90630476f27871ebcd170162caa92c0871
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3054980
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Adrian Taylor <adetaylor@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: danakj <danakj@chromium.org>
4 years ago
Michael Moss e371c6499b Handle 'git-cl land' gerrit reponse change.
cl/398464215 changed the weblink name from "gitiles" to "browse",

BUG=1254111
R=linxinan@chromium.org, sokcevic@google.com

Change-Id: I1aa5b47657b5c5619f7b56c53e3593d2f2e391f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3194121
Auto-Submit: Michael Moss <mmoss@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Josip Sokcevic 2269427d31 Remove branch redirect support in git_cl
Gob already supports branch redirect so we no longer need this in
depot_tools.

R=gavinmak@google.com

Change-Id: I0e697b022dc132bc5cba95e1b1746c0d72fe16aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3137816
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
4 years ago
Tomasz Śniatowski 5819446364 git-cl: add --upstream to git cl format
It is occasionally useful to be able to run git cl format against some
specific upstream without having to configure branches in git. As
CMDformat can't easily take "git-diff-like" args, add an explict
--upstream argument.

This has come up a few times in the past and hopefuly the new arg will
be discoverable enough in --help for git cl format to help people.

Bug: 832295, 1082520
Change-Id: I2f3a33d719104ffd97cfa388178e38bfe8731c0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3124674
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Tomasz Śniatowski <tsniatowski@vewd.com>
4 years ago
sokcevic 071528093f Support UTF-8 messages in git cl upload 🪟
Bug: 1240760
Change-Id: Ib64cd9c9b8c901105f6317bd74b889daa457e4de
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3101520
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
4 years ago
Peter Kasting ee08888d27 Update comment to reflect a directory's new name.
Bug: chromium:1133549
Change-Id: I7140370746acd9bfa8b5e90257a61effbb72b97e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3068888
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
4 years ago
Xinan Lin 1bd4ffa295 Remove wait-for-merge from gerrit client tool
Following comment in crrev.com/c/3039331, submit call
is fully synchronous.

BUG=1207955
TEST=e2e

Change-Id: I9146d43b4d4530ad5064709e418d34e3229e19ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3049672
Commit-Queue: Xinan Lin <linxinan@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
4 years ago
Josip Sokcevic 7e133ff177 Use main branch as the default branch
R=apolito@google.com

Change-Id: I6a2ed557b9e8d45194b2fe4ea5327ce62020733c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3000134
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
4 years ago
Andrii Shyshkalov 899785a9c6 [cv][git-cl] treat autogenerated CV comments just like CQ.
R=ehmaldonado

Change-Id: If06db13e41a07786aa5a244e95aa3911d9367d6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3010275
Auto-Submit: Andrii Shyshkalov <tandrii@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Josip Sokcevic 340edc365b Extract bug/fix from branch only on create
depot_tools supports extracting information from branch name. E.g. if
branch contains fix-\d or bug-\d, commit description will contains
appropriate git footers.

However, such behavior should happen only on initial CL upload. Should
user decide to delete such footer, we shouldn't set bug / fix on any
following PS.

R=ehmaldonado@chromium.org

Bug: 1225663
Change-Id: I66adfdca070083ab66727d132919d47feb7ddd43
Fixed: 1225663
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3010709
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Andy Perelson <ajp@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
4 years ago
Jamie Madill ac6f623a29 git cl: Ensure update before checking if "full" format.
We found that in the bot environment sometimes we'd check the
full format setting before doing a lazy config update. Adds an
explicit call to ensure the lazy update. Fixes the problem of
the bot environment not running the same format checks in some
cases.

Bug: 1219863
Change-Id: I970d97da462972300f52cbcb382f7da3929b73e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3009534
Auto-Submit: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
4 years ago
Sigurd Schneider 1bfda8eee9 Respect git config cl.date-order in `git cl st`
In the previous commit https://crrev.com/c/2532835 the option
to order branches by date was added. This CL adds a git config
variable cl.date-order than can be set to achive the same effect.

Change-Id: Iaf24c46c5f7b63b1e518c18aedc455808a2dc752
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2992887
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
4 years ago
Dirk Pranke 6f0df68e8b Add use_python3 to codereview.settings to set default for PRESUBMITs.
This CL adds a new field to the codereview.settings file used by
git_cl for project-wide defaults. If `USE_PYTHON3` is set to True,
then we will run the PRESUBMIT checks under Python3 by default
instead of Python2, unless the PRESUBMIT.py file contains
`USE_PYTHON3 = False` on a line by itself

(as opposed to now, where we'll use Python2 by default unless the
file contains `USE_PYTHON3 = True`).

This will allow us have Python3 be the default for new files
and to eventually eliminate any uses of `USE_PYTHON3` from the
individual presubmit files. Of course, you will have to go in and
explicitly add `USE_PYTHON3 = False` to any Py2-only files prior
to enabling this.

Bug: 1207012
Change-Id: Id8ec45b43940e5bcffeee196398c711c541e733e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2917747
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
4 years ago
Greg Guterman be5fccd4de [rts] Add -q flag to git cl try, upload, and set_commit
Quick run is only set when the -q flag is passed. It is not set to 0 by
other flags because only Chromium has Quick run and there are other
depot_tools users. We rely on the CQ to set the flag back to 0.

Bug: 1192827
Change-Id: I3310c9f005343f7d3eea56eaad5f19c7ba751921
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2927818
Commit-Queue: Gregory Guterman <guterman@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Josip Sokcevic 740825ecf2 Detect uploadvalidator error message
If git push refs/for/ errors out, inspect stdout message to detect
uploadvalidator rejection. If present, present user a solution.

R=ajp@google.com

Change-Id: I70aee7615f3d905127a31bd5679968ade75c234a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2888475
Reviewed-by: Andy Perelson <ajp@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
4 years ago
Edward Lesmes 9c34906c59 metrics: Don't print notice if reporting build metrics.
Change-Id: Ib7e23cd1b57c6d0497f0e0ff1fe31b38f11bfc00
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2876082
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
mlcui 3da91715d3 git cl upload: Use default patchset message when user's message is "y"
Users sometimes type in "y" to confirm the default patchset message,
resulting in a patchset being uploaded with "y" as the message.

We can make a fair assumption that no-one would willingly use a patchset
message of "y", so this CL uses the default patchset message whenever
this happens.

(I have personally done this myself and have seen at least one other
person do the same.)

Bug: None
Change-Id: Iad314d35aa830b62152ab2910eb37d876b7e450b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2861643
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Michael Cui <mlcui@google.com>
4 years ago
Anthony Polito c64e3902af fix encoding for _GetYapfIgnorePatterns so it supports utf-8
Bug: 1204441
Change-Id: I36b963d69b5dec9e609258055b800b14d398b2b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2864013
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Anthony Polito <apolito@google.com>
4 years ago
Dirk Pranke 61bf6e8d69 Add support for running PRESUBMIT.py checks under Python2 or 3.
This CL adds support for running PRESUBMIT.py under either Python2
or Python3 as specified in each PRESUBMIT.py file.

To run the checks under Python3, the PRESUBMIT.py file must contain
a line exactly matching "^USE_PYTHON3 = True$". If the file
does not contain this string, the checks will run under Python2.

Different PRESUBMIT.py files in a single CL may thus contain
a mix of 2- and 3-compatible checks, but each individual file will
only be run in one or the other (it doesn't likely make sense to run
them in both by default).

Bug: 1157663
Change-Id: Ic74977941a6519388089328b6e1dfba2e885924b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2832654
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Gregory Nisbet 48d9e1e5bc [git-cl] Add option to git-cl upload to prohibit changeid manipulation.
I recently encountered an error where I forgot to add a changeid locally to
some-but-not-all commits in a stack of commits. When attempting to upload
these commits via `git cl upload --no-squash`, I received a confusing message
instructing me to install the Gerrit commit-msg hook even after the hook was
installed. In order to debug this problem locally, I added the ability to
prevent `git cl upload ...` from attempting to change the contents of
messages. If the --no-add-changeid flag is passed, then the command will
simply fail quasi-informatively.

BUG=None
TEST=attempted to upload this CL via `git cl upload --no-squash --no-add-changeid`, confirm that it fails.

Change-Id: Id5f721c18143448db801095946f490880bb61786
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2828775
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Gregory Nisbet <gregorynisbet@google.com>
4 years ago
Josip Sokcevic 1cabb17575 Set branchref on Changelist if set by user
R=gavinmak@google.com

Bug: 1067814
Change-Id: I592407cd489ade8bffc5158a86ccb061064d3ddd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2815397
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
4 years ago
Gavin Mak b1c08f6c61 Notify if a change auto-CCs more than 100 users
When uploading a large-scale change, many users are automatically CC'ed
on a change. This adds a warning if this is the case and links to a more
appropriate approval for a large-scale change.

Bug: 1194514
Change-Id: Icd336ebdffbccbc9f30a89a33e244a788a768cfa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2798963
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
4 years ago
Josip Sokcevic f2cfd3dac0 Reland "Add --push-options in git cl upload"
This is a reland of e2c65d7b75

Original change's description:
> Add --push-options in git cl upload
>
> --push-option parameter is passed to git push as is.
>
> R=ehmaldonado@google.com
>
> Bug: 1184393
> Change-Id: Id1f7da1f0c8e8a23144b547d50d817fe8d4efeb1
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2786080
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>

R=gavinmak@google.com

Bug: 1184393
Change-Id: I9302a2e908b931a963a63ed2bb3778e21c4d6e53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2794787
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
4 years ago
Josip Sokcevic d0ba91fa49 Revert "Add --push-options in git cl upload"
This reverts commit e2c65d7b75.

Reason for revert: https://crbug.com/1192942

Original change's description:
> Add --push-options in git cl upload
>
> --push-option parameter is passed to git push as is.
>
> R=​ehmaldonado@google.com
>
> Bug: 1184393
> Change-Id: Id1f7da1f0c8e8a23144b547d50d817fe8d4efeb1
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2786080
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>

Bug: 1184393
Change-Id: Idf5d79fda3c5f917b1de5ca396837f14a401ffb7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2791749
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
4 years ago
Josip Sokcevic e2c65d7b75 Add --push-options in git cl upload
--push-option parameter is passed to git push as is.

R=ehmaldonado@google.com

Bug: 1184393
Change-Id: Id1f7da1f0c8e8a23144b547d50d817fe8d4efeb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2786080
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
4 years ago
Nodir Turakulov 2737963b46 [git-cl] Expose Gerrit host and project
Make
  git cl issue --json=-
print Gerrit host and project as well.

Change-Id: If53d681252eaa738f044a724ee45e70df4b1eef1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2766153
Commit-Queue: Nodir Turakulov <nodir@chromium.org>
Reviewed-by: Dean Berris <dberris@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 1eaaab5c1f Add upstream parameter when building an owners client.
code-owners plugins wants a git ref in Gerrit (e.g. refs/heads/master)
while Depot Tools wants a local git ref (e.g. refs/remotes/origin/main,
or a git hash).

Add an upstream parameters to be used by Depot Tools, separate from
a Gerrit ref expected by owners_client.

Change-Id: Ieed97a186e3140b3f82830efa189dbe3e4d8c806
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2730049
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Edward Lesmes eb1bd62b91 presubmit_support: Add flags for Gerrit project and target branch.
Will be used in a follow-up CL to initialize code-owners client.

Recipe-Nontrivial-Roll: build
Change-Id: Iefe9176320b4d1ae7715e88a8db132e815be76ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2717979
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
4 years ago
Stephen Martinis fb09de29ea Revert "Use GetCodeOwnersClient in presubmit_support"
This reverts commit 7a67bca65a.

Reason for revert: Probably broke chromium presubmit, see https://ci.chromium.org/ui/p/chromium/builders/try/chromium_presubmit/1152280/overview

Original change's description:
> Use GetCodeOwnersClient in presubmit_support
>
> This change also adds a target_ref flag to presubmit_support.py.
>
> Recipe-Nontrivial-Roll: build
> Change-Id: I6de6bb87fc1482b88d9fbebe5e4ad1dbd8ce9748
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2702792
> Commit-Queue: Gavin Mak <gavinmak@google.com>
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>

Change-Id: I2cca469f14194f65306baab7928ddddd48033a3b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2718691
Auto-Submit: Stephen Martinis <martiniss@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
4 years ago
Gavin Mak 7a67bca65a Use GetCodeOwnersClient in presubmit_support
This change also adds a target_ref flag to presubmit_support.py.

Recipe-Nontrivial-Roll: build
Change-Id: I6de6bb87fc1482b88d9fbebe5e4ad1dbd8ce9748
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2702792
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Edward Lesmes 5cd75478dd owners_finder: Use code-owners plugin if available.
Change-Id: I94d7b3cdc17651a6fe5dafa261c58f46f37b8439
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2693919
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Bruce Dawson f362f6f961 Robustly set issue number
When using "git cl patch -b branch_name issue_number" to resolve merge
conflicts in an uploaded CL the cherry-pick stage will probably fail due
to the expected merge conflicts. If you resolve the conflict and then
upload the now-merged CL you will actually create a new CL. This happens
because the SetIssue step is skipped when the cherry-pick fails.

This change sets the issue whenever a new branch is created. This is
safe (the new branch is not being used for anything else) and will
improve the situation in many cases.

crrev.com/c/2636593 is an example of a CL that was accidentally uploaded
as new when it was just supposed to be a resolving of merge conflicts on
an existing CL.

This change was manually tested with crrev.com/c/2107132.

Change-Id: Icb5b8e38feb6f0fa4a007d3924c4d69d2ee4937c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2638979
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
4 years ago
Edward Lesmes e157691eb4 git-cl: Use code-owners plugin if available.
Change-Id: Ic88e6cac34c3a43f477b879cf7a5caa9014dfb49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2692882
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Josip Sokcevic 7386a1e04f Add escalation instructions to git cl upload
Bug: 1117305
Change-Id: I3233b1ddcbf50ac97a888e08f692193d4d83b3e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2641044
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
4 years ago
Josip Sokcevic 9011a5b7d5 Add ref parameter when creating a try job
This fixes git cl try when revision is passed.

R=ehmaldonado@chromium.org

Bug: 1138785
Change-Id: Id5a067114426ed55409b1f200abf4d5a38fdbaa5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2691312
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
4 years ago
Edward Lesmes 10c3dd6f59 git-cl: Add support for setting Bot-Commit+1 on upload.
Some bots use git-cl to upload changes to Gerrit.
Add an option so those can set Bot-Commit+1 on upload
instead of TBR and CR+1.

Change-Id: I5e80ddadedf6c4fe277f8984c35a603da923de5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2679780
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes e342fb16f9 Don't suggest change author as reviewer.
Change-Id: Ie34fc34883b2c86fc134f10ded24b26a631886ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2676835
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Gavin Mak 68e6cf3c9f Don't open text editor when using --message-file
When using git cl upload --message-file, the text editor prompts the
user to edit the description. This change suppresses the editor when
a message file is passed in.

Change-Id: Ifa568e155e72eeb49f55ded0ddac1b5a940687af
Bug:916230
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2643781
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
4 years ago
Edward Lesmes 8c43c3f513 Reland "[git-cl] Use owners client when processing --[tb]r-owners."
This is a reland of 968b1fe7d7

Original change's description:
> [git-cl] Use owners client when processing --[tb]r-owners.
>
> Change-Id: Id094bce2aa731359cd8af16f10ce79ae7e02bd85
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2572809
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>

Change-Id: I9f93d755b10517c5296f7095f735ec2295be34e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2632840
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Andrii Shyshkalov 2517afd133 [git-cl] fix bug if user is not logged when fetching tryjob results.
<ExceptionObj>.message worked in py2, but not in py3.

R=ehmaldonado@google.com

Change-Id: I1f1302d453e9142b59de4ccab0298367bffde295
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2631495
Auto-Submit: Andrii Shyshkalov <tandrii@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 0e4e5ae594 Reland "[owners] Refactor OwnersClient."
Reland of [1].
Original CL contained some changes to --[tb]r-owners
which are not included in this CL because those changes
were reverted on [2].

- Remove GetChangeApprovalStatus and GetFilesApprovalStatus.
- Make host, project and branch part of GerritClient.
- Rename ListOwnersForFile to ListOwners.

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

Change-Id: Ife2051b8be0460d1c6bc4fbe4e3b0a571d12dafb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2616130
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Stephen Martinis 1c3c939119 Revert "[git-cl] Use owners client when processing --[tb]r-owners."
This reverts commit 968b1fe7d7.

Reason for revert: Appears to be breaking git cl upload for the recipe autoroller with https://logs.chromium.org/logs/infra-internal/buildbucket/cr-buildbucket.appspot.com/8858802226988308224/+/steps/infra/0/steps/git_cl_upload/0/stdout. 

Original change's description:
> [git-cl] Use owners client when processing --[tb]r-owners.
>
> Change-Id: Id094bce2aa731359cd8af16f10ce79ae7e02bd85
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2572809
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>

TBR=ehmaldonado@chromium.org,apolito@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Id561a059eaf1419cbda52b7c0c6a45b5c6f2bd1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2611219
Reviewed-by: Stephen Martinis <martiniss@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Stephen Martinis <martiniss@chromium.org>
4 years ago
Edward Lesmes b34cd6d8fa Revert "[owners] Refactor OwnersClient."
This reverts commit 9c7f6c25c0.

Reason for revert:
Not working
https://logs.chromium.org/logs/infra-internal/buildbucket/cr-buildbucket.appspot.com/8858807889610091152/+/steps/franky/0/steps/git_cl_upload/0/stdout

Original change's description:
> [owners] Refactor OwnersClient.
>
> - Remove GetChangeApprovalStatus and GetFilesApprovalStatus.
> - Make host, project and branch part of GerritClient.
> - Rename ListOwnersForFile to ListOwners.
>
> Change-Id: I1f610a64f0217ce54e5ce4a210026535adc1c2e5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2587268
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Gavin Mak <gavinmak@google.com>

TBR=ehmaldonado@chromium.org,gavinmak@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I4928df90856526210a4fd4d104e6cc96aa005bc2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2613925
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Stephen Martinis <martiniss@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Stephen Martinis d48aa437c9 Followup fix for https://crrev.com/c/2587268
https://crrev.com/c/2587268 changed function signatures to remove a
project argument. One function call was missed in the CL. This CL fixes
the function call.

Change-Id: Ice45072aa467ed6c56efabf405a7aac03f4b047c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2613785
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Stephen Martinis <martiniss@chromium.org>
4 years ago
Josip Sokcevic b038f724ec Update error message if unable to determine branch
git cl format can't accept branch name as argument as those are reserved
for files that need to be formatted. This CL clarifies what user needs
to do in case git cl is not able to determine upstream branch.

R=apolito@google.com, ehmaldonaldo@chromium.org

Bug: 832295
Change-Id: If6ff517d633b7e70a33dff48f3779f82df30f214
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2571838
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
4 years ago
Josip Sokcevic b631a88c6e Run git fetch with --prune on failed git cl upload
git fetch --prune removes all references that no longer exist on remote
server. This allows git cl to upload changes to correct destination
branch.

R=ehmaldonado@chromium.org

Bug: 1149640
Change-Id: I66bf8d2209242b08991c2dae0d3a7fbc892cef87
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2606613
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
4 years ago
Edward Lesmes cf06cad1be [subprocess2] Replace VOID with DEVNULL
subprocess.DEVNULL was introduced in Python3 to serve same purpose
as subprocess2.VOID, so rename VOID to DEVNULL in subprocess2.

Change-Id: I6dade3306ffc3bc2441ac6083f362b099c2427e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2587758
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 9c7f6c25c0 [owners] Refactor OwnersClient.
- Remove GetChangeApprovalStatus and GetFilesApprovalStatus.
- Make host, project and branch part of GerritClient.
- Rename ListOwnersForFile to ListOwners.

Change-Id: I1f610a64f0217ce54e5ce4a210026535adc1c2e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2587268
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
4 years ago
Gavin Mak e6a623392d [depot_tools] Use logging.warning
logging.warn is deprecated and should be replaced with logging.warning.

Bug:1097402
Change-Id: I55ce007bec47608eeafcf3cd9ac2b90f60073115
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2575621
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
4 years ago
Gavin Mak 18f45d2874 [depot_tools] Fix CMDlol
Hidden ascii art in git_cl.py needs to be decoded to utf-8 to print correctly.

Bug:1106660
Change-Id: Ie41490c789534ea6cb589bbc96aa06cd251943f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2575620
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
4 years ago