Commit Graph

1027 Commits (ef579a1192d2dace337b752245ba1c121f12b7ea)

Author SHA1 Message Date
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
Edward Lesmes 968b1fe7d7 [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>
4 years ago
Edward Lesmes 8a791e7cf7 [git-cl][owners] Use new API to suggest batch owners.
Change-Id: I2e2b0aff583e6d9b36261acbef87221e29fe7923
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2565145
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Andrii Shyshkalov a3762a907c git cl comments: shorten long URLs if possible.
R=ehmaldonado

Before:
  https://chromium-review.googlesource.com/c/2552792/3/cv/internal/gerrit/gerritfake/fake.go#321
After:
  https://crrev.com/c/2552792/3/cv/internal/gerrit/gerritfake/fake.go#321
Change-Id: Ie6044e2743c4359bc30c98d8915edd9119d4a386
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2556837
Auto-Submit: Andrii Shyshkalov <tandrii@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@google.com>
4 years ago
Edward Lesmes eeca9c6ee7 [owners][git-cl] Use owners client to show all owners for a file.
Change-Id: I04949d95ca466452a58ea91cf2db86852c0621bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2551378
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
4 years ago
Sigurd Schneider 9abde8c3f3 Reland "Add option to git cl st to sort by committer date"
This is a reland of 9ca89ac1f4

Original change's description:
> Add option to git cl st to sort by committer date
>
> Some developers want to see the branches with recent commits first.
> This CL adds the option --dateorder to git cl st which sorts branches
> by the committer date of the most recent branch.
>
> Change-Id: Ibdf3fc35ea784521a3e99b374535f822bb83a55e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2521573
> Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
> Reviewed-by: Dirk Pranke <dpranke@google.com>

Change-Id: I974ac297fcf8652855b101f58a98b3cd122fce36
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2532835
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
5 years ago
Gavin Mak e61ccc59a2 [depot_tools] Make try-results fetch recent dry-runs
Running git cl try-results fetches the latest patchset which may be a trivial change, e.g. rebase or commit message change.
This change allows try-results to get the result of patchsets equivalent to the latest and returns their results.

Bug: 774179
Change-Id: Iec2fea102597773e24c2e887f19282f14c123e61
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2532899
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
5 years ago
Andrii Shyshkalov f0517095b8 git cl: remove check for likely wrong identities.
This was important 3+ years ago when we were migrating to Gerrit.
It is no longer important, and probably confusing to non-Googlers
and Googlers alike.

R=dpranke, maruel
TBR=ehmaldonado

Bug: 1148065
Change-Id: I79ad71b5afb9adac286780c2093b01f656491918
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2534850
Commit-Queue: Andrii Shyshkalov <tandrii@google.com>
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
5 years ago
Sigurd Schneider 8630bb119f Revert "Add option to git cl st to sort by committer date"
This reverts commit 9ca89ac1f4.

Reason for revert: Breaks git cl st

Original change's description:
> Add option to git cl st to sort by committer date
>
> Some developers want to see the branches with recent commits first.
> This CL adds the option --dateorder to git cl st which sorts branches
> by the committer date of the most recent branch.
>
> Change-Id: Ibdf3fc35ea784521a3e99b374535f822bb83a55e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2521573
> Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
> Reviewed-by: Dirk Pranke <dpranke@google.com>

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

Tbr: dpranke@google.com
Change-Id: I3ed44d42b8383691682442567e3151508126fbd5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2532834
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Auto-Submit: Sigurd Schneider <sigurds@chromium.org>
5 years ago
Sigurd Schneider 9ca89ac1f4 Add option to git cl st to sort by committer date
Some developers want to see the branches with recent commits first.
This CL adds the option --dateorder to git cl st which sorts branches
by the committer date of the most recent branch.

Change-Id: Ibdf3fc35ea784521a3e99b374535f822bb83a55e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2521573
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
5 years ago
Bruce Dawson fc48704f6b Print message when waiting for editor
Running "git cl upload" can take a while so I tend to switch to other
tasks while it runs. On a regular basis I get frustrated because it is
taking an extremely long time only to realize that it has been waiting
for me.

This change adds a message saying "Waiting for editor..." to make it
clear who is waiting for whom.

Change-Id: I8cf08c3d2be0c7a843a4c07529682bc049b30426
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2503689
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
5 years ago
Josip Sokcevic f736cabba5 Add retry on git push failure
This adds retry if target is old default branch. This may happen only if
user didn't fetch remote for extended period of time and old default
branch no longer exists.

R=ehmaldonado@chromium.org

Change-Id: I81981049ee006f68a073718180b454c230d055e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2473757
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Andrii Shyshkalov 792630c498 git cl try-results: show running jobs in YELLOW color.
R=dpranke@google.com

Change-Id: I62f198d03e8326196476c42cd7c317871894f4d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2485093
Auto-Submit: Andrii Shyshkalov <tandrii@google.com>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
5 years ago
Josip Sokcevic c39ab997ba Support main as default branch
R=apolito@google.com

Change-Id: Ic338c698b8eb8d2e04fc1ef23ae4b13cae08b80f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2404701
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Glen Robertson 7d98e228f8 Allow 'main' as a local main branch name.
Avoiding 'master' as a local branch name per naming guidelines hits this
special case and won't allow upload of child branches. Even though more
comprehensive efforts (crbug.com/1095735) have yet to decide on an
official preferred main branch name this change is small and unlikely
to break things (I hope).

This supports people using a "git pull" "merge" workflow.

Change-Id: I8aca044aeb4178c6671e3a1590617f666505b42e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2377189
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Glen Robertson <glenrob@chromium.org>
5 years ago