This change makes JjWrapper a no-op for secondary JJ workspaces that do not have a .git directory or worktree. It now holds an instance of GitWrapper and forwards commands to it only if a .git directory or worktree exists.
In particular, this allows gclient sync to run in secondary workspaces without fetching the git repository for the root.
Change-Id: Id89a83d7ce193304847dd75bbffa133e6a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7780501
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Matt Stark <msta@google.com>
Commit-Queue: Matt Stark <msta@google.com>
It's possible for stray submodule directories to be left around e.g. if
the target_os list was changed. These directories will be empty and
won't have a .git directory inside them.
Change-Id: If802d779f239007ebb96a30615a54dcf6a6a6964
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7781124
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Matt Stark <msta@google.com>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
A common pain point of mine is that when I rebase locally, `git cl diff`
starts showing many files unrelated to the CL. Accepting a file list
will allow me to filter for the files included in the CL. This is useful
in general, if a user is interested in the diff of a specific subset of
files.
Change-Id: Id7c328ab8cd201ecf855e45d29119672bec8d022
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7768331
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Victor Vianna <victorvianna@google.com>
Auto-Submit: Victor Vianna <victorvianna@google.com>
_GetConfig returns a string from the configuration, which means that
in case there is "False", it will be translated to bool("False") which
is true. After the fix, the configuration should be resolved correctly.
R=bryner@google.com
Change-Id: Ic23b1c4dae48bd3d2e122b4a44e8977ade20a790
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7719643
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Brian Ryner <bryner@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
- Add a 5-minute stall detector to ExecutionQueue that prints active tasks
and troubleshooting suggestions.
- Set GIT_TERMINAL_PROMPT=0 only for non-interactive shells to prevent
silent hangs on credential prompts.
Bug: none
Change-Id: I8b9eda8c4801e77dc2b6374c7bceca73f592f714
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7736347
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Alexei Svitkine <asvitkine@chromium.org>
Ensure gitlink changes are detected when the change is small by
explicitly adding AffectedSubmodules to the file list for git ls-tree.
The presubmit check missed https://crrev.com/c/7735426 because
input_api.AffectedFiles explicitly excludes gitlinks.
Bug: 502550552
Change-Id: I7151b327289857a91ddbcfa88b2981db6f009e3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7759887
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Updates the edit monitor-related metrics code to report when the edit
monitor is not running because the user explicitly opted out. Now that
the edit monitor is enabled by default for Googlers, we want to make
sure there aren't a significant number of users opting out since that
could be indicative of some issue that is being worked around.
Bug: b/479871142
Change-Id: I5c23951b91c343a595ade06f77a2b1e8e76ce2eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7760520
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Auto-Submit: Brian Sheedy <bsheedy@chromium.org>
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Corp links now work for external users, so don't block them from being
used.
Bug: 500464930
Change-Id: I1681fbec98afc990713c20789e1c2545ee978a3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7758988
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Allen Li <ayatane@chromium.org>
The siso ninja command is printed unintentionally because log collection
flags are appended. This CL also fixes the wrong expectations in the
tests.
Change-Id: I3d893234c7388e026f7888d40633620287207ebc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7742783
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Auto-Submit: Junji Watanabe <jwata@google.com>
Commit-Queue: Junji Watanabe <jwata@google.com>
add CheckSkillFiles and CheckSkillValidatorTestsOnCommit for presubmit
Change-Id: Ia5123ce92660c3b44dcc7b4083b305abde19076a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7707574
Reviewed-by: Peter Wen <wnwen@chromium.org>
Reviewed-by: Erik Staab <estaab@google.com>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Ziwen Lin <ziwlin@microsoft.com>
When the user_uuid is missing or stale during telemetry
initialization, a new UUID is generated in memory. However,
this newly generated UUID was never flushed to the telemetry
config file, causing it to be regenerated on every script
execution.
This updates `Config.__init__` to automatically flush the
configuration to disk if `TraceConfig` signals that the UUID
was generated or regenerated.
Bug:500756867
Change-Id: Iebe49ff4d7c59c2d739df1c3f7222f596c0ecf49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7739314
Reviewed-by: Struan Shrimpton <sshrimp@google.com>
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Commit-Queue: David Hinojosa <davidhinojosa@google.com>
Previously, `gclient-new-workdir.py` assumed that the source repository
was a standard Git repository where `.git` is a directory, which is only
true when the base repo is used as the source. This caused failures when
trying to create a new workdir using an existing linked worktree as the
source (where `.git` is a file).
This CL fixes these assumptions by:
1. Using `os.path.exists` to detect `.git` instead of checking if it's
in the `dirs` list from `os.walk`.
2. Handling both files and directories when deleting `.git` during
copy-on-write setup so the new workspace is its own worktree.
3. Using `os.path.realpath` when testing for copy-on-write support to
handle cases where `.gclient` is a symlink (which is the default
behavior for workspaces created by this script).
These changes enable chaining workspaces by using one active workspace
as the base for another.
Change-Id: I8776d495170e182c471b07e1cde92e7549f269aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7739623
Auto-Submit: Josiah Kiehl <kiehl@google.com>
Reviewed-by: Brian Sheedy <bsheedy@chromium.org>
Commit-Queue: Erik Staab <estaab@google.com>
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Erik Staab <estaab@google.com>
Commands like `git cl try-results -i 1234567` shouldn't need to be on a
branch, but currently fail because they try to SetPatchset.
Change-Id: Ib7ce351ed7dc0633782458c6fee35502f7c13c77
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7744644
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Daniel Rubery <drubery@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
This is a reland of commit 86e72435d8
Original change's description:
> siso: Set --namespace flag to "ninja" subcommand
>
> To distinguish builds from developers and LUCI bots, this CL adds
> "--namespace=developer" flag to "siso ninja" command. Additionally, it
> sets "--namespace=developer:ai-agent" to distinguish AI agent builds from human builds.
>
> LUCI bot builds specify "--namespace=builder:{builder}". See also
> https://crrev.com/c/7731009
>
> The namespace will be set to Cloud logging's `generic_task.namespace`,
> which will be stored to the BigQuery table, as well.
> https://docs.cloud.google.com/logging/docs/api/v2/resource-list
>
> Bug: 354589168
> Change-Id: I264d5c4ac756dec04e7b443775e1894946d9bd56
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7730256
> Commit-Queue: Junji Watanabe <jwata@google.com>
> Reviewed-by: Philipp Wollermann <philwo@google.com>
> Reviewed-by: Nicole Desrosiers <nicolede@google.com>
Bug: 354589168
Change-Id: I3146e9bfb45e9d0d0452b864e688f7bb6eaa9b70
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7735106
Reviewed-by: Philipp Wollermann <philwo@google.com>
Commit-Queue: Junji Watanabe <jwata@google.com>
Auto-Submit: Junji Watanabe <jwata@google.com>
The recipe bundle does not include the agents/ directory, which causes presubmit_canned_checks.CheckSkillFiles to fail on CQ bots.
Add the skill validator script to .gitattributes so it is included in the bundle.
Bug: 497972681
Change-Id: I2de83dc4fa4dfdc4a6ad1ac692a7a15411afe372
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7735102
Reviewed-by: Erik Staab <estaab@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Ziwen Lin <ziwlin@microsoft.com>
After the DEPS schema changed in https://crrev.com/c/7007552, there's
been a few codebases that needed similar updating.
Needeless to say, it'd be best if the parsing wasn't duplicated in so
many places. But it's unlikely anyone has the time or motivation to
de-dupe things. So this merely at least tries to document all the
duplicated codebases in the DEPS schema source of truth.
Hopefully this provides some value if/when the schema changes again.
Bug: 448699364
Change-Id: I3f354a2216901c360aea3d4785076f155001de12
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7736646
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
This reverts commit 86e72435d8.
Reason for revert: It fails when building at an old revision, where
siso didn't have --namespace flag.
Original change's description:
> siso: Set --namespace flag to "ninja" subcommand
>
> To distinguish builds from developers and LUCI bots, this CL adds
> "--namespace=developer" flag to "siso ninja" command. Additionally, it
> sets "--namespace=developer:ai-agent" to distinguish AI agent builds from human builds.
>
> LUCI bot builds specify "--namespace=builder:{builder}". See also
> https://crrev.com/c/7731009
>
> The namespace will be set to Cloud logging's `generic_task.namespace`,
> which will be stored to the BigQuery table, as well.
> https://docs.cloud.google.com/logging/docs/api/v2/resource-list
>
> Bug: 354589168
> Change-Id: I264d5c4ac756dec04e7b443775e1894946d9bd56
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7730256
> Commit-Queue: Junji Watanabe <jwata@google.com>
> Reviewed-by: Philipp Wollermann <philwo@google.com>
> Reviewed-by: Nicole Desrosiers <nicolede@google.com>
Bug: 354589168
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I330a78d40a8fb39e1921aadadf6e0488e88fe67b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7735104
Auto-Submit: Junji Watanabe <jwata@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
To distinguish builds from developers and LUCI bots, this CL adds
"--namespace=developer" flag to "siso ninja" command. Additionally, it
sets "--namespace=developer:ai-agent" to distinguish AI agent builds from human builds.
LUCI bot builds specify "--namespace=builder:{builder}". See also
https://crrev.com/c/7731009
The namespace will be set to Cloud logging's `generic_task.namespace`,
which will be stored to the BigQuery table, as well.
https://docs.cloud.google.com/logging/docs/api/v2/resource-list
Bug: 354589168
Change-Id: I264d5c4ac756dec04e7b443775e1894946d9bd56
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7730256
Commit-Queue: Junji Watanabe <jwata@google.com>
Reviewed-by: Philipp Wollermann <philwo@google.com>
Reviewed-by: Nicole Desrosiers <nicolede@google.com>
Fall back to recursive ls-tree in CheckForCommitObjects on Windows if
filenames contain shell special chars. This avoids passing unquoted
special characters to cmd.exe when subprocess2 uses shell=True.
Bug: 498957658
Change-Id: Ia8deb48e730ca7e0f99721b1132fb33da7466400
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7731838
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Use git worktrees by default instead of symlinks, and add a warning to
notify users of this change.
Change-Id: I0ece4aa911e9512c8e0d8fd8d669c0c6037c7320
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7704995
Reviewed-by: Erik Staab <estaab@google.com>
Commit-Queue: Justin Cohen <justincohen@google.com>
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>