When attempting to create a Btrfs subvolume snapshot fails, the script
previously fell back to a slow file-by-file copy. This change modifies
the behavior to instead abort early if the source is detected to be a
Btrfs subvolume.
If the snapshot fails for a subvolume, the script now prints diagnostic
information to help the user troubleshoot and exits, saving the user
from an unexpectedly long copy operation. The fallback behavior is
preserved for non-subvolumes where snapshots are not supported.
This also adds unit tests for the new abort and diagnostic behaviors.
Change-Id: Ieee9fec08d9664d3bdffc255b6993fa2f6d8ad70
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7713376
Commit-Queue: Josiah Kiehl <kiehl@google.com>
Reviewed-by: Erik Staab <estaab@google.com>
Instead of forcing all version strings for cipd package deps to be
embedded in the DEPS file like the following:
{
'package': 'chromium/chrome/android/orderfiles/arm',
'version': 'q1Xa79fpCv-do8mcyvDf8wV7Whf5M7CCojmM9R06R58C',
}
This CL supports pointing the dep to another file, like the following:
{
'package': 'chromium/chrome/android/orderfiles/arm',
'version_file': 'some/version/file.txt',
}
Then "some/version/file.txt" would be a plain text file in the repo
(relative to the DEPS file), that contains just the version string:
"q1Xa79fpCv-do8mcyvDf8wV7Whf5M7CCojmM9R06R58C".
Moving the version to another file would let Chrome's build graph
incorporate the version text file into it's dep list for relevant
targets. This would otherwise be difficult/impossible to do for the
whole DEPS file since there's way more stuff in DEPS than a single
CIPD package.
Bug: 448699364
Change-Id: I38debd2a0af48d15b894c8e88a5e3f2f59534bf4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7007552
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Brian Ryner <bryner@google.com>
This fixes an issue where flaky tests were not showing up in the
reported list.
Change-Id: I2de5510c530c4ba5258681e65de514348f9a47d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7716124
Auto-Submit: Russ Hamilton <behamilton@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Russ Hamilton <behamilton@google.com>
id_token is not required and currently prevents LUCI auth one login from
working correctly with config validation presubmits. Please see bug for
more context.
Bug:b/496353787
Change-Id: I038871e2234878ed3a68bcacd187cc45cd31cc0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7707198
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Dan Le Febvre <dlf@google.com>
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
This CL adds a new git-map-branches verbose
output: when a branch is frozen, it's now visible
when running `git map-branches -vvv`.
Fixed: 379846320
Change-Id: Ie6b35b9b727893e216e681e32701b302c3e9516c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7707352
Commit-Queue: Louis Romero <lpromero@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
If a remote repo has no HEAD, running git_number.py causes
update_bootstrap to crash. Handle `(unknown)` HEAD branch better and fix
existing bug that passed re.MULTILINE to regex Pattern.search().
Bug: 492363028
Change-Id: Ie20311d50e84cfd075bf31df5da837da473a31ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7674291
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
When `checkout_path` is the root directory, we cannot move the
entire root directory into itself (i.e. into `bad_scm_dir`).
Instead, we move its contents individually, skipping the
quarantine directory.
Change-Id: Id606b42cbf2cdd909b5677744e8c842f6c11a0f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7705375
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
- A validation script (skill_validator.py) that checks required fields
(name, description), naming conventions, YAML frontmatter, and
directory name matching.
- Unit tests for the validator (skill_validator_test.py).
- A PRESUBMIT.py check (CheckSkillFiles) that automatically runs the
validator when any SKILL.md file is modified.
- A SKILL.md for the validator itself, so it can be invoked as
/skill-validator.
TODO: add agents/PRESUBMIT.py in a follow-up CL
Change-Id: Ie55ef26efddd07c5f362bb0fa82f5a6893e66edd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7693938
Reviewed-by: Erik Staab <estaab@google.com>
Reviewed-by: Peter Wen <wnwen@chromium.org>
Commit-Queue: Ziwen Lin <ziwlin@microsoft.com>
This is more human-readable for unrendered markdown
files.
Change-Id: I9c0f5419fa0174f67a07bf457103042e254fa25d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7607289
Reviewed-by: Sho Mizoe <shomizoe@google.com>
Commit-Queue: Erik Staab <estaab@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Erik Staab <estaab@google.com>
Mapping the DEPS validation dictionary to a list of paths prevents
false-positive mismatch and unexpected entry errors when duplicating
submodules (e.g. during migrations).
Bug: 496212953
Change-Id: I34c4cad56b118392007285ffaf7aff48d7f316b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7702032
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Rename the --reflink and --no-reflink flags to --copy-on-write and
--no-copy-on-write to use a more generic, cross-platform term. The old
names are retained as hidden, deprecated aliases for backward
compatibility.
Change-Id: I29a3c3326fa30171d796a1d34e877eb70d88e23f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7697452
Reviewed-by: Erik Staab <estaab@google.com>
Commit-Queue: Erik Staab <estaab@google.com>
Auto-Submit: Justin Cohen <justincohen@google.com>
Skip setting `last-upload-hash` and `gerrit-squash-hash` when no commit
is created. This prevents upload from producing incorrect diffs during
subsequent uploads.
Bug: 489740364
Change-Id: I3819fe94b18e7982b11cd669535b4d16cace9129
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7662436
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Replaces the subprocess call to cp -a -c on Darwin with a direct call to
the native macOS clonefile C API via ctypes. This provides faster,
OS-level APFS copy-on-write directory cloning.
Change-Id: I6058d19a5a9a73fff2e8cc2b0d926695bb418487
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7691305
Commit-Queue: Justin Cohen <justincohen@google.com>
Reviewed-by: Kirubel Aklilu <kaklilu@chromium.org>
Reviewed-by: Erik Staab <estaab@google.com>
If creating the branch fails for any reason, one reason being the
branch already exists, then cl patch will ignore the error and
continue to apply the cherry-pick to the current branch, which is
likely not what the user wants. This CL adds an early exit for branch
create failures.
Change-Id: Iad31bac4a19e8da0c25409d388f96cdd85c44e0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7666361
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Josiah Kiehl <kiehl@google.com>
Merge --link-root-git-repo-only and --link-all-git-sub-repos into a
single --max-depth flag.
The default is 1 if copy-on-write is supported (reflink), which links
the workspace sub-directories (like src) but skips deeper levels.
Otherwise, the default is -1 (no limit).
Also allow following symlinks when walking the directory tree so that
we can symlink nested third_party directories in the workspace and
still have them linked for git with --max-depth=1. For example with
the following directory structure:
primary/.gclient
primary/src
primary/dawn -> src/third_party/dawn
Running `gclient-new-workdir.py primary secondary --max-depth=1` will
link (with symlinks or git worktree) both src/.git and src/dawn/.git in
the secondary workspace.
Change-Id: Ia2b38a5a63cfeafc48f1e976c0fbb94d6a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7686111
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
For safety, it's good practice to detach HEAD in the workdir when its
.git directory is linked to the primary repository to avoid accidentally
mutating the same branch concurrently.
Change-Id: Id5bb522c1a1ddb98257e283cd0e482ee6a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7682535
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
The instructions for the skill were missing the project flag needed by
`resolve-build-id`, which is now set to "chrome" in the example. Also,
`list-failures` was passing an incorrect protobuf to the
`luci.resultdb.v1.ResultDB.QueryTestVariants` RPC - the predicate is of
type `TestVariantPredicate`, but it was providing a
`TestResultPredicate`. This resulted in the predicate being silently
ignored.
Change-Id: Ie273b00be37ebaf3ee0b59c407c29da48d4003ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7656545
Auto-Submit: Russ Hamilton <behamilton@google.com>
Reviewed-by: Peter Wen <wnwen@chromium.org>
Commit-Queue: Russ Hamilton <behamilton@google.com>
Allow using git worktree to link the copied (sub)-repositories back to
the original. Since we try to use copy-on-write by default, we have to
mimic some of what `git worktree add` does since it doesn't work well
when the worktree directory already exists.
This functionality is behind the `--use-git-worktree` flag which is
disabled by default and there's a `--use-git-symlinks` flag which uses
the old symlink code path instead of git worktree.
Change-Id: I1bb8bf3ec81a5d1dc923670d66944b466a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7675410
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Add ANTIGRAVITY_AGENT=1 to the list of environment variables used to
identify an AI agent in siso.py.
When an AI agent is detected, siso prepends --quiet --batch=false to
ninja commands to improve latency and reduce context pollution.
Bug: None
Change-Id: I22b2252f527a7e4ad0384ddb53c4c18e3270beb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7674579
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Junji Watanabe <jwata@google.com>
Auto-Submit: Peter Wen <wnwen@chromium.org>
rustfmt and the line length checker, at present, disagree about the proper formatting for certain files.
Since rustfmt already wraps things to an appropriate length, the additional check from this presubmit is redundant; therefore, let's except Rust files from it.
Bug: 492035293
Change-Id: Ia03e998727e8d1ade54b4510aa5317be9a20f9f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7665158
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Julia Hansbrough <flowerhack@google.com>
These URLs might get pasted into, e.g. git cl patch, so we rewrite
them so everything continues to work.
Bug: 487545425
Change-Id: I6f9ff56ad82b9b43529a31160e92e81429348de2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7644979
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Add an env var to show if the user is in a Cog workspace. This is needed
to accurately compare sync times for edit monitor control and enabled
groups. Edit monitor will never run in Cog, so we need to filter out Cog
workspaces from the control group.
Bug: b:479871142
Change-Id: I29a40c66bcfd1dea8d17cc17dfb9cb729299f1c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7668825
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Auto-Submit: James Woo <jewoo@google.com>
Siso defaults fast_nop, fast_local, fast_last_failure, fast_exit
to false when stdout is not a TTY. This makes no-op and small
builds under AI agent envs slower. Prepend --batch=false and
--quiet in siso.py.
Move --quiet from autoninja.py to siso.py. Generalise the
GEMINI_CLI detection to recognise Claude Code, Codex, Cursor
and a generic AI_AGENT env var.
Bug: 484983987
Change-Id: I32f4999e96246f3210cd209b368e283ece657f62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7580119
Auto-Submit: Stav Nir <stav.nir@island.io>
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Reviewed-by: Alex Ovsienko <ovsienko@google.com>
Commit-Queue: Fumitoshi Ukai <ukai@google.com>
Add new --link-root-git-repo-only and --link-all-git-sub-repos flags to
gclient-new-workdir to only copy/reflink the top level git repository
e.g. chromium/src since most users only care about the top level
repository and we can skip walking the directory tree or linking .git
directories for sub-repositories. This is set to default if btrfs
subvolume snapshots or reflinks are used for copying since
sub-repositories will already be in the copy. However, the .git folders
won't be linked for the sub-repositories so there's a
--link-all-git-sub-repos flag for users who don't want this behavior.
Change-Id: I786de60b864d4a98f8e6dabf5b2de62f6a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7654938
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
This script currently fails when run on Mac with the following error:
`cp: illegal option -- -`.
Mac uses `cp -c` to trigger copy-on-write rather than `cp --reflink`.
I tested this by running on my machine and verified that a new
workdir was created without copying the underlying data:
https://paste.googleplex.com/4994555217838080
Change-Id: I4c2893f1309ebd3a907a5790f892a557e3bfce9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7653739
Reviewed-by: Michal Mocny <mmocny@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Kirubel Aklilu <kaklilu@chromium.org>
Replaces the EDIT_MONITOR_STATE environment variable detection with a
robust process check for Chrome developers. depot_tools will now
dynamically invoke `pgrep` on Linux to check if the edit_monitor daemon
is actively running for the chrome target repo.
Bug: b:484022773
Change-Id: I9de9de32607aa128fc64253fe25ad0142d16fb2c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7629800
Reviewed-by: Junji Watanabe <jwata@google.com>
Reviewed-by: Brian Sheedy <bsheedy@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Auto-Submit: James Woo <jewoo@google.com>
Commit-Queue: James Woo <jewoo@google.com>
Luci auth now supports credential helpers and so any tool that uses
luci-auth for authentication can now benefit from this.
Bug:b/342261857
Change-Id: I78182ffe58062fbe4cec9e231fa8f1d7732e2faf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7629397
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Commit-Queue: Dan Le Febvre <dlf@google.com>
There shouldn't be any changes to the CLI itself however it's been a
a long time since the last roll. One notable change to dependencies is
the addition of credential helpers in luci-auth which the CLI uses
for auth.
Bug:b/342261857
Change-Id: I6a5f80cdbc54c747b098a548ebb042f665cbb147
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7629396
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Commit-Queue: Dan Le Febvre <dlf@google.com>
The Chromium Edit Monitor is a background file-watcher daemon used to
gather data on developer edit events. To ensure this daemon does not
starve system resources or silently regress compile times, it must pass
a performance Launch Review.
To conduct fleet-wide apples-to-apples latency comparisons, we need
to segment the build and sync telemetry by whether the developer is
currently running the daemon.
This CL updates the client-side wrappers:
1. metrics_utils: Checks the environment for EDIT_MONITOR_STATE.
2. ninjalog_uploader: Injects the state into the metadata payload
sent to the chromium_build_stats backend.
3. metrics: Injects the state into the env_vars repeated field
array sent to the depot_tools_metrics backend for gclient sync
operations.
Bug: b:484022773
Change-Id: I16ddc4d162b5567185b8808a5d05823f1d010895
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7610040
Auto-Submit: James Woo <jewoo@google.com>
Commit-Queue: James Woo <jewoo@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>