Make this available for testing first.
This should be functionally roughly analogous with the current auto
configuration logic, and it prints all actions it performs so it
should be pretty safe to play with, even if it hypothetically
misbehaves.
Bug: b/401338175
Change-Id: I803c7e167e355ec8cca1f5959099138c2fee305e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6334614
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
This reverts commit ce47e785fa.
Reason for revert: fatal: --local can only be used inside a git
repository.
Original change's description:
> [git_auth] Use pathless URL for cred helper
>
> The credential helper rules should not have a path, while the URL
> rewrite rules should.
>
> Bug: b/401338175
> Change-Id: I79b52ab4af62367363617b2a9afa03a67f5ea0b9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6345631
> Commit-Queue: Allen Li <ayatane@chromium.org>
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Bug: b/401338175
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: Ifa887eeb7a7049665570e865431b41ac18649b90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6357165
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
The credential helper rules should not have a path, while the URL
rewrite rules should.
Bug: b/401338175
Change-Id: I79b52ab4af62367363617b2a9afa03a67f5ea0b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6345631
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
This is a reland of commit d447f41294
This reland excludes the change to PRESUBMIT.py which originally
caused regression and because of which the original commit was
reverted.
Original change's description:
> Add AffectedFile.Extension() in presubmit_support
>
> Add convenience method AffectedFile.Extension() for extracting file
> extension in a standard way. Add a test for this new functionality.
> Add a similar test for AffectedFile.UnixLocalPath().
>
> Bug: None
> Change-Id: If591e751fb2e4fb5355ad0b6f93f310667849d68
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6273341
> Commit-Queue: Anton Bershanskyi <bershanskyi@gmail.com>
> Reviewed-by: Dirk Pranke <dpranke@google.com>
> Reviewed-by: Gavin Mak <gavinmak@google.com>
Bug: None
Change-Id: Ie5fc551b9c0818dfd9a1c571cc247cc157dbc8b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6335512
Commit-Queue: Anton Bershanskyi <bershanskyi@gmail.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
This could happen if user specifies "accepted_statuses=['404']", and the current behaviour raises a KeyError exception from "last_result['log']".
Change-Id: Icebb8ac3b656548892bbf729e5df0cd5e5223ada
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6352740
Auto-Submit: Keybo Qian <keybo@google.com>
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Keybo Qian <keybo@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Verbose logging is disabled by default in all functions except get_changes and the caller functions, since get_changes is already using verbose logging.
Bug: 402142151
Change-Id: Ifb4d62b215ded8f7be21217f2579574ea4d211f6
Recipe-Nontrivial-Roll: build
Recipe-Nontrivial-Roll: build_internal
Recipe-Nontrivial-Roll: chromiumos
Recipe-Nontrivial-Roll: infra
Recipe-Manual-Change: chrome_release
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6341791
Commit-Queue: Keybo Qian <keybo@google.com>
Reviewed-by: Adarsh Murthy <adarshmurthy@google.com>
Reviewed-by: Scott Lee <ddoman@chromium.org>
Will link to this for people who want to do manual setup (and for
general info).
Change-Id: If5b84b27b0c3b029bcb70090ac9a5821e4fbdfe6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6343955
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Read the DEPS file of a modified repository since submodules are coming
from it.
R=yiwzhang@google.com
Fixed: 402396938
Change-Id: I05c91c60b2b1ea58637242fb9970c3fabd58560e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6344911
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
This exposes the reason for the SSO detection, to be used in the auth
config wizard.
There are some minor changes to fix pyright (type checking) errors on
these lines.
Bug: b/401338175
Change-Id: Ibf63a1a078a9ae82598796e329d075f19de58ea7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6334613
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
This CL adds a new way of generating splittings, which clusters files
based on their directory structure (while respecting `set noparent` in
OWNERS files). The user provides a minimum and maximum acceptable
number of files per CL, and the algorithm attempts to create CLs in
that range with a single unique reviewer for each. I've tested it on
some example CLs, and it seems to work well -- certainly better than
the existing algorithm.
Usage of the new algorithm is triggered by passing the
`--target-range` option to `git cl split`. A second new argument,
`--expect-owners-override`, may also be used to ignore OWNERS during
the clustering algorithm.
Bug: 389069356
Change-Id: I321e6424b2bdb7624b370af23b73759fda261161
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6324373
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Devon Loehr <dloehr@google.com>
Change-Id: I39c01200208de15e5ce2101ecc273f823875bc0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6326717
Auto-Submit: Dan Le Febvre <dlf@google.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Scott Lee <ddoman@chromium.org>
User may use lowercase drive letter when entering gclient workspace.
In such case, path should be corrected to real path value.
R=wfh@chromium.org
Fixed: 401141847
Change-Id: I0b08985ec5c911a315922858d248ff53a10ed682
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6336450
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
reviewers
The check mandates approval from required reviewers during submission.
Without it, the CL author could land the CL without explicitly
approval from required reviewers.
Bug: 396736534
Change-Id: I4671f123419b8f94a969b6caccf13a2064511a0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6313625
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
As part of new findings cider extension work, we need to show
presubmit result as findings in the new panel. The extension only
has access to stdout/stderr of the process executing presubmit
checks. Therefore, we need a way to write structured data
(i.e. json) to the stdout.
Bug: 397700948
Change-Id: Ie9e51d39389613c5f93ca054102b169a99e356b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6330090
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
This reverts commit bb2a896987.
Reason for revert: Looks like this was insufficient - https://ci.chromium.org/ui/p/chromium/builders/ci/linux-presubmit/25451/overview
Will investigate more tomorrow.
Original change's description:
> [presubmit_support] Fix CheckForRecursedeps to work for submodule based gclient DEPS.
>
> R=sokcevic
>
> Bug: 401077549
> Change-Id: I51fcabad5e563a65614d4b35e6600e7e511f7ba4
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6330092
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Auto-Submit: Robbie Iannucci <iannucci@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Bug: 401077549
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I0730ea3f119b0acea7ed7a219cf723fc8116cd07
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6334078
Owners-Override: Dan Le Febvre <dlf@google.com>
Commit-Queue: Dan Le Febvre <dlf@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Robbie Iannucci <iannucci@google.com>
Reviewed-by: Dan Le Febvre <dlf@google.com>
This CL defines a trie-based datastructure for representing files based
on their path. It directly mirrors the structure of a file system,
keeping track of directories and the files inside them. It also stores
some information about OWNERS files, for use during clustering (we
won't cluster files together if there's a "break" in ownership due to
`set noparent). Optionally, the ownership information can be overridden;
this will be done via a command-line flag when the algorithm is fully
implemented.
Bug: 335797528
Change-Id: I5dcdf36695a1da5714ec021e5e18b6c36855a4f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6321290
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Devon Loehr <dloehr@google.com>
This CL adds a function which takes a set of files, and attempts to
select a single owner for all of them. If it cannot, it falls back to
the standard owner selection algorithm, which may result in more owners
being chosen than necessary, but guarantees that a valid set of owners
is always returned.
Bug: 389069356
Change-Id: I985804040f149a02bfb5b3c6b946602a81334e7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6321289
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Devon Loehr <dloehr@google.com>
This better matches the print function which they replace, and prevents
errors from passing the wrong number of arguments. We also change
printing in one function to be more user-friendly.
Bug: 389069356
Change-Id: Ia41d256b441bffa063f5d0b5ab4eb20725aaeaf4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6322690
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Devon Loehr <dloehr@google.com>
Instead of taking reviewers as input args, it computes the reviewers
from the top-level OWNERS file because otherwise, all callers will
basically do the same thing at the callsite.
Bug: 396736534
Change-Id: I3ea83b8285fab8b75cb77b40b10414c6a3dea6b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6313624
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
roll_dep_test is currently using file:///path/to/repo as git url.
Interestingly, the test is not failing in presubmit bot but
failing locally because it is trying to clone using sso protocol
(see: b/391455129#comment11). I think the presubmit bot is not
equipped with git-remote-sso so the tests are able to pass. However,
on a local workstation, git-remote-sso is available but it should
not be used as the file:// scheme should indicate using local
transport protocol. Quoted from
https://git-scm.com/docs/git-clone#_git_urls
> When Git doesn’t know how to handle a certain transport
protocol, it attempts to use the remote-<transport> remote helper,
if one exists.
Removing the file:// scheme appears to fix the issue even though
the only difference is the usage of --local flag according to the
doc.
fwiw, I did try to inject `--local` flag but it gives me a warning
`--local is ignored`. I haven't dig deep enough to figure out why
the flag is ignored.
Bug: 391455129
Change-Id: I8fab9aee5198b2eedfacdb60161197b58f7533ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6313297
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
Instead of using build/toolchain/use_reclient_value.py in
both autoninja and gn, use build/toolchain/remoteexec_defaults.gni
to set default value for use_reclient (on siso or on ninja).
Bug: 397994249
Change-Id: Ia4302fe8794218d485e52ca38f8523453814a6b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6301378
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Fumitoshi Ukai <ukai@google.com>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
This will later be used in chromium PRESUBMIT to ensure newly added DEPS
hook MUST be reviewed by a dedicated reviewer.
Bug: 396736534
Change-Id: I3859814c6316d4e576d12114277671ed5db80e33
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6284565
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
chromium[1] and cros[2] have both moved to 3.11 which is the version
depot_tools use by default right now. Therefore, we should stop running
tests using python 3.8 to ensure compatibility and start using features
introduced after python 3.8
[1]: https://issues.chromium.org/40942322
[2]: http://b/318531403
Change-Id: I2bac00421a46793717387cec1898035b10b13b9e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6306285
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
When registering the build with the build server, pass in the output
directory.
Change-Id: Ie6ed0bf5d73926fb163085067aafcd350063ee5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6249305
Auto-Submit: Mohamed Heikal <mheikal@chromium.org>
Reviewed-by: Philipp Wollermann <philwo@google.com>
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
chromium now doesn't use `use_siso` value for build graph,
so no need to use use_siso_default.py in gn context.
use_siso value is only used to determine autoninja use
siso or ninja, so put use_siso default logic in autoninja.py.
Will remove build/toolchain/use_siso_default.py in chromium
Bug: 397994249
Change-Id: Idb31c4e75f0a1c3bc4a97089494ec16be9879a49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6301272
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Auto-Submit: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Fumitoshi Ukai <ukai@google.com>