Commit Graph

2416 Commits (781de9e7c4b3db8a4bad379d2380daf5a4d6541c)

Author SHA1 Message Date
Alexander Cooper 682a6e1194 Add git cl squash-closed behavior
Introduces a new git cl command `squash-closed`. Similar to archive,
this will operate on all closed branches. Unlike archive, rather than
removing these branches and potentially leaving their downstreams in a
wedged state, this will squash the branch and appropriately reparent the
downstream. This makes this a good function to run in preparation of a
`git rebase-update`, especially if there are chained git branches, as
this will then shrink any merged branches to a single commit which
should cleanly apply and drop off.

Bug: 40264739
Change-Id: I1836f944d43f5f3dcebbebf06437bef890da96ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6230362
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Auto-Submit: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
3 weeks ago
Alexander Cooper 380df04b62 Modify git squash-branch to perform reparenting
Bug: 40264739
Change-Id: I4ad7f4f8a670334b32c239458048e56c6af44098
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6227541
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
3 weeks ago
Scott Lee c60f8194a5 lucicfg: format star files if --lucicfg
Bug: 390409288
Change-Id: Ida238f3a903c4f1dd31c8fa007e0a8823aeaf1aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6219826
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
4 weeks ago
Gavin Mak 77a800d729 Print branch name when running presubmits
This implements the proposed solution B in https://crbug.com/380877175#comment5
and will help distinguish presubmit results when working with stacked changes.

Bug: 380877175
Change-Id: I7f0807f7ce03109288976069c57c28488d6cadfd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6196130
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
1 month ago
Devon Loehr 36427aab02 split_cl: Always ask for confirmation before uploading
`git cl split` has the potential to do a lot of operations at once,
which is problematic if it didn't end up splitting things in a way
the user approves of. This changes it to print a summary of the
splitting, and asking the user to review it briefly before proceeding
with the upload.

Bug: 389069356, 40642562, 40269201
Change-Id: I90bead0147badbaa3afcce2264d805ae498f101c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6163905
Commit-Queue: Devon Loehr <dloehr@google.com>
Reviewed-by: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: Andy Perelson <ajp@google.com>
1 month ago
Allen Li 8eff9d233f [auth] Add test for overwriting global SSO rewrite rules
Sanity check for attached bug

Bug: b/390219533
Change-Id: I788e6beaa7f838568714b98b6f7923d455e6e3a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6178580
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
1 month ago
Allen Li 877b1e3cbd [auth] Hide global SSO rewrite in local repo
If the user uses SSO (and thus has SSO rewrite rules) for their global
config, a repo which locally uses an email that doesn't use SSO needs
an override.

Bug: b/390219533
Change-Id: I639dae4c1a45bbd2c17180855c22260979b0dbc2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6177780
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
1 month ago
Scott Lee 80d1969422 presubmit_diff: add support for -U
This is a reland of https://crrev.com/c/6168707 with fixes.
The CL adds a new param, unified, to git_diff() and create_diffs()
as a required param.

The functions themselves are tested in presubmit_diffs_test.py, but
their usages in presubmit_support.py were not, and the missing param
caused a failure in CiderG (b/389876151)

This CL basically carries the same patch, but makes the params
optional with a default value and adds unit tests for the usage
in presubmit_support.py

Tested with CiderG: https://screenshot.googleplex.com/PYEDZ3NGn5cYGtV


Change-Id: Ic747c6a133c016dbcd80034e521c76a3db3a3f60
Bug: 389876151, 379902295
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6182703
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: Gary Tong <gatong@chromium.org>
1 month ago
Scott Lee 7b9ced4220 Revert "Reland "add support for -U in presubmit_diff.py""
This reverts commit 9a9142793a.

Reason for revert: failed again

Original change's description:
> Reland "add support for -U in presubmit_diff.py"
>
> This reverts commit 4c54361841.
>
> Reason for revert: Reland with a fix.
>
> Find https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6173762/1..2
> Tested by running presubmit_support.py --generate_diff
>
>
> Original change's description:
> > Revert "add support for -U in presubmit_diff.py"
> >
> > This reverts commit b576ab3b78.
> >
> > Reason for revert: http://b/389876151
> >
> > Original change's description:
> > > add support for -U in presubmit_diff.py
> > >
> > > presubmit_diff.py is going to be used to compute the changes to be
> > > formatted, and -U helps minimize the number of irrelevant lines
> > > from formatting.
> > >
> > > Bug: 379902295
> > > Change-Id: I9c0a2ee6b5ffa6b9fe4427362556020d525f1105
> > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6168707
> > > Reviewed-by: Gavin Mak <gavinmak@google.com>
> > > Commit-Queue: Scott Lee <ddoman@chromium.org>
> >
> > Bug: 379902295
> > Change-Id: I82dd707e5ae3d4b1760e632506ee0e1bc1d76e09
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6173760
> > Reviewed-by: Scott Lee <ddoman@chromium.org>
> > Commit-Queue: Gavin Mak <gavinmak@google.com>
> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
>
> Bug: 379902295
> Change-Id: Icbc4aa98bbfaa816143be064217fb2d992b48baf
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6173762
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Scott Lee <ddoman@chromium.org>

Bug: 379902295
Change-Id: I84875f6667689e1a9085876555bc6aef4ea2d7b4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6177776
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: Gary Tong <gatong@chromium.org>
1 month ago
Mike Frysinger 232ffd8df3 gerrit: addmessage: support attention set control
Sometimes I want to add a message without touching the attention set.
The default review call will automatically update it regardless.  Add
a flag to explicitly control behavior.

Test:
	# No attention set option.
	$ ./gerrit_client.py ...
	-> ignore_automatic_attention_set_rules not included in body of request
	$ ./gerrit_client.py ... --automatic-attention
	-> body has {'ignore_automatic_attention_set_rules': False}
	$ ./gerrit_client.py ... --no-automatic-attention
	-> body has {'ignore_automatic_attention_set_rules': True}

Change-Id: Idcf7975ba691942cfe385a2156ef3a3ec064a0b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6172486
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
1 month ago
Scott Lee 9a9142793a Reland "add support for -U in presubmit_diff.py"
This reverts commit 4c54361841.

Reason for revert: Reland with a fix.

Find https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6173762/1..2
Tested by running presubmit_support.py --generate_diff


Original change's description:
> Revert "add support for -U in presubmit_diff.py"
>
> This reverts commit b576ab3b78.
>
> Reason for revert: http://b/389876151
>
> Original change's description:
> > add support for -U in presubmit_diff.py
> >
> > presubmit_diff.py is going to be used to compute the changes to be
> > formatted, and -U helps minimize the number of irrelevant lines
> > from formatting.
> >
> > Bug: 379902295
> > Change-Id: I9c0a2ee6b5ffa6b9fe4427362556020d525f1105
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6168707
> > Reviewed-by: Gavin Mak <gavinmak@google.com>
> > Commit-Queue: Scott Lee <ddoman@chromium.org>
>
> Bug: 379902295
> Change-Id: I82dd707e5ae3d4b1760e632506ee0e1bc1d76e09
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6173760
> Reviewed-by: Scott Lee <ddoman@chromium.org>
> Commit-Queue: Gavin Mak <gavinmak@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Bug: 379902295
Change-Id: Icbc4aa98bbfaa816143be064217fb2d992b48baf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6173762
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
2 months ago
Devon Loehr f546ee068c Fix argument mismatch in split_cl.py
When adding tests, the LoadDescription function accidentally got called
with the wrong arguments in the main function. This fixes that; a future
CL (uploading shortly) adds more robust tests that would have caught this.

Bug: 389568463, 389069356
Change-Id: Icaf5e83cd8caa9f3975173f8c8ee7d92ef44ee56
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6170638
Commit-Queue: Andy Perelson <ajp@google.com>
Reviewed-by: Brian Ryner <bryner@google.com>
Reviewed-by: Andy Perelson <ajp@google.com>
Auto-Submit: Devon Loehr <dloehr@google.com>
2 months ago
Gavin Mak 4c54361841 Revert "add support for -U in presubmit_diff.py"
This reverts commit b576ab3b78.

Reason for revert: http://b/389876151

Original change's description:
> add support for -U in presubmit_diff.py
>
> presubmit_diff.py is going to be used to compute the changes to be
> formatted, and -U helps minimize the number of irrelevant lines
> from formatting.
>
> Bug: 379902295
> Change-Id: I9c0a2ee6b5ffa6b9fe4427362556020d525f1105
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6168707
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Scott Lee <ddoman@chromium.org>

Bug: 379902295
Change-Id: I82dd707e5ae3d4b1760e632506ee0e1bc1d76e09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6173760
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2 months ago
Scott Lee b576ab3b78 add support for -U in presubmit_diff.py
presubmit_diff.py is going to be used to compute the changes to be
formatted, and -U helps minimize the number of irrelevant lines
from formatting.

Bug: 379902295
Change-Id: I9c0a2ee6b5ffa6b9fe4427362556020d525f1105
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6168707
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
2 months ago
Devon Loehr 24d9ad69fa split_cl: Make description file optional during dry runs
I frequently find myself running `git cl split` just to see how the
files are going to be split up, without actually intending to submit the
resulting CLs immediately. Doing so requires creating a file, putting a
dummy description in it, and passing that to the command line, which is
unnecessary work. This CL simply allows dry runs to use a dummy
description if none is provided, to make checking the tool's output
easier.

Bug: None
Change-Id: I47e06c6e6da26701e07dcae81ab605edac2e2ca6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6163904
Reviewed-by: Andy Perelson <ajp@google.com>
Commit-Queue: Devon Loehr <dloehr@google.com>
Reviewed-by: Brian Ryner <bryner@google.com>
2 months ago
Dirk Pranke bf76f3d3ed Explicitly propagate terminal size to gclient hooks.
gclient normally runs hooks in a pseudo terminal which has no
sense of the terminal size. If we want hooks to be able to change
what they output based on the terminal size, we have to explicitly
propagate the terminal size info down through the subprocess
environment.

Change-Id: I08f7c48ef78ea4eb9f5b791abb2a7e5ef8870050
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6161596
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
2 months ago
Mike Frysinger 7f4762b2a1 pylintrc: version all of them
When running pylint tools in depot_tools itself, we default to the
pylintrc file all the time even though we have versioned ones we
want to use instead.  This breaks things like `./pylint-2.17 foo.py`.
Rename the existing pylintrc to 2.6 and duplicate it to 2.7 so we
clear out the 'pylintrc' file and the wrappers always default to the
versioned ones.

We've been riding on pylint being a bit compatible across versions,
but it seems to be accelerating in adding/removing diagnostics and
settings, so this is more churn to add new versions, but we don't
have much choice.

Change-Id: I5c20a41ed8aead3e90b6dda8f5f2fc3b87cfb251
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6150453
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
2 months ago
Mason Freed 58625e82c6 Remove "attempt to squash" behavior from `git rebase-update`
In common workflows, this step only succeeds ~5% of the time, and
in the other 95% of cases, simply adds ~30 seconds of wasted time
to the execution time of `rebase-update`. Therefore, this CL removes
the automated functionality, and leaves squashing as a manual option
to the user.

Fixed: 40264739
Bug: 40390274
Change-Id: Ib2a3ffe4b0e5d0b74323a2a0d34ab0e1b7fafb08
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6104282
Auto-Submit: Mason Freed <masonf@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
2 months ago
Scott Lee 88bc812650 Reland "Support formatting metrics xml(s) in the subfolders."
This reverts commit bfe1a9282d.

Reason for revert: reland with a fix.
- Find the diff between ps#1 and ps#2.
- Tested at https://paste.googleplex.com/4670451708854272

Original change's description:
> Revert "Support formatting metrics xml(s) in the subfolders."
>
> This reverts commit 597ba08be5.
>
> Reason for revert: it broke git_cl.py. Need further patch
>
> Original change's description:
> > Support formatting metrics xml(s) in the subfolders.
> >
> > https://crrev.com/c/6072565 assumed that the XMLs are located under
> > tools/metrics/{actions,ukm,structured,histograms} directly, such as
> > tools/metrics/histograms/enums.xml.
> >
> > However, its subfolders may have XML files, and it should format
> > the files. This CL fixes it.
> >
> > Bug: 384940858
> > Change-Id: I56484144e6f72f41eb5bc37a5ad462a0de1ec0e3
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6111994
> > Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> > Auto-Submit: Scott Lee <ddoman@chromium.org>
> > Commit-Queue: Scott Lee <ddoman@chromium.org>
>
> Bug: 384940858
> Change-Id: I322573ad6d2d758cd3d2de872efdbba4fd9330c2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6111996
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Scott Lee <ddoman@chromium.org>

Bug: 384940858
Change-Id: Ibe20d5e46c519d7fdbd1114565ec3856e5bf928e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6111997
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Scott Lee <ddoman@chromium.org>
2 months ago
Scott Lee bfe1a9282d Revert "Support formatting metrics xml(s) in the subfolders."
This reverts commit 597ba08be5.

Reason for revert: it broke git_cl.py. Need further patch

Original change's description:
> Support formatting metrics xml(s) in the subfolders.
>
> https://crrev.com/c/6072565 assumed that the XMLs are located under
> tools/metrics/{actions,ukm,structured,histograms} directly, such as
> tools/metrics/histograms/enums.xml.
>
> However, its subfolders may have XML files, and it should format
> the files. This CL fixes it.
>
> Bug: 384940858
> Change-Id: I56484144e6f72f41eb5bc37a5ad462a0de1ec0e3
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6111994
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Auto-Submit: Scott Lee <ddoman@chromium.org>
> Commit-Queue: Scott Lee <ddoman@chromium.org>

Bug: 384940858
Change-Id: I322573ad6d2d758cd3d2de872efdbba4fd9330c2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6111996
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
2 months ago
Scott Lee 597ba08be5 Support formatting metrics xml(s) in the subfolders.
https://crrev.com/c/6072565 assumed that the XMLs are located under
tools/metrics/{actions,ukm,structured,histograms} directly, such as
tools/metrics/histograms/enums.xml.

However, its subfolders may have XML files, and it should format
the files. This CL fixes it.

Bug: 384940858
Change-Id: I56484144e6f72f41eb5bc37a5ad462a0de1ec0e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6111994
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Scott Lee <ddoman@chromium.org>
Commit-Queue: Scott Lee <ddoman@chromium.org>
2 months ago
Scott Lee ab3bfa4f96 use realpath instead of abspath
metrics_xml_format.py has a check to ensure that the given xml
is located in the current checkout using GetPrimarySolutionPath().

The problem is that GetPrimarySolutionPath() adds "src" if the path
doesn't end with "src".
https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:gclient_paths.py;l=78-79

The workspace in Cog doesn't have "src" in the path. Instead, it creates
a workspace at /..../$workspace_name/$repo_name, which doesn't match
GetPrimarySolutionPath() because the workspace root doesn't end with
'src'.

This must be a common problem in other modules, and Cog gets around
this issue by creating a symlink, 'src', to the workspace root.

This CL replaces os.path.abspath() with os.path.realpath() so that
the check is done properly.

Bug: b/369827156
Change-Id: Iaf56de0a9ccbd168004c4c80672c9dd18211bf5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6094779
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
2 months ago
Scott Lee bf32de3167 add metrics_xml_formatter
git cl format supports formatting certain xml files under tools/metrics.
This CL adds metrics_xml_formatter so that the formatter can be run
with git cl format.

Bug: b/369827156
Change-Id: I5922cd79304aa8e06917aacc9f2d9bd3ed548c2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6072565
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Scott Lee <ddoman@chromium.org>
3 months ago
Scott Lee 562c59c76c [git_footers] add support for multiline footers
Gerrit allows multiline footers with indents.

e.g.,
Test: something
   looks great

This CL fixes the bug such that add_footer correctly inserts
a given message after multiline footers.

Bug: 379923433
Change-Id: I9b3f793095b63b0586123543a2f8d49f0503fca0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6064963
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Scott Lee <ddoman@chromium.org>
3 months ago
Scott Lee 8e30250504 [git_footers] remove param before_keys from add_footer
The param before_key used to be used in presubmit_support.py, but
it was removed in 2018, and has never been used anywhere since.
- https://crrev.com/c/1351509
- http://shortn/_YQUh4yC9Tc

This CL removes it to simplify the code before the next CL.
It hasn't been used for several years and will unlikely be used
in the future.

Bug: 379923433
Change-Id: Ib0da340235a991b6d8edca041eae811540d4aa60
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6064306
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
3 months ago
Fumitoshi Ukai db017d1ffe autoninja: use build/toolchain/use_reclient_value.py
https://crrev.com/c/6048393 provides build/toolchain/use_reclient_value.py
to get value for use_reclient.

Use it in autoninja if it exists.

Bug: 341167943
Change-Id: Ia6207ea044cc109fa156deff3c3357475368576f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6024739
Commit-Queue: Fumitoshi Ukai <ukai@google.com>
Auto-Submit: Fumitoshi Ukai <ukai@google.com>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Junji Watanabe <jwata@google.com>
3 months ago
Fumitoshi Ukai fd5161870a gn_helper: find correct directory for //
gn finds // by searching .gn in parent directories.

To support out dir is not 2 directories from root (i.e. out/Default),
search .gn in parent directory for '//' location.

tools/licenses/licenses.py runs 'gn gen' in out/Default/$tmp.
for such case, '//' should be '../../..', or fail to import '//path'

Change-Id: I6e5ccbe93cb5e51704f31d4eb558c03560286865
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6051636
Reviewed-by: Philipp Wollermann <philwo@google.com>
Commit-Queue: Fumitoshi Ukai <ukai@google.com>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
3 months ago
Anne Redulla 25f9761514 Prefer direct git installation for Windows
Bug: b/360206460
Change-Id: I7068b201b0b976ac619db16ff16d5ffbe5aea362
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5884196
Reviewed-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Anne Redulla <aredulla@google.com>
4 months ago
Yiwei Zhang dcaa6afa97 gerrit_client: introduce add message command
Bug: 378480632
Change-Id: I411b3136db27a5ca2b43481bc9b650bef93f5275
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6012758
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Scott Lee <ddoman@chromium.org>
4 months ago
Anne Redulla d6528a124b [git-sso] Read sso helper output line by line
On Windows, the subprocess running the sso helper does not
complete the `read()` in time. This CL reads the output
line by line, and stops reading once the required fields
have been specified.

Bug: b/360206460
Change-Id: Ib5f95093cd6f9bbbe5093a7e16393ecd97934cf2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5992110
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Anne Redulla <aredulla@google.com>
4 months ago
Gavin Mak a6ce588715 Use ProvidedDiffChange if diff is empty string
A ProvidedDiffChange should be able to use an diff, even if it is empty.

Bug: 372936485
Change-Id: If6bea0063e92c8942aed080e4c26b8d032b90faa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5926311
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Scott Lee <ddoman@chromium.org>
4 months ago
Josip Sokcevic e0c47c138a [scm] Handle empty .gitmodules file
R=yiwzhang@google.com

Bug: 372697507
Change-Id: I6ac59b762fedd328d23dcfb4f8ef328f96eb36a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5923135
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
5 months ago
Scott Lee 17a0d843c1 allow comment lines in inclusive_language_presubmit_exempt_dirs.txt
inclusive_language_presubmit_exempt_dirs.txt is a list of
paths to exclude from the inclusive word presubmit check.
https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:presubmit_canned_checks.py;l=2602;drc=0bc7c4832e4f2d453e4826c9a2e1197e11bd6ec7

This CL allows comment lines, starting with \#, in the file.
(Also, fixes a bug to allow an empty line)

Bug: 369701326
Change-Id: I7647459281f7921362aa4070c26671f321b7cfea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5906016
Auto-Submit: Scott Lee <ddoman@chromium.org>
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
5 months ago
Bruce Dawson 5dce57b05e Remove brucedawson@ from some depot_tools OWNERS files
I'm leaving Google and I no longer wish to be an OWNER.

Change-Id: Id5b91b72596ce0ab06dcdc80998d76899797fcdd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5907923
Reviewed-by: Gavin Mak <gavinmak@google.com>
Auto-Submit: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
5 months ago
Joanna Wang 68237d3317 Update CMDgitmodules to set `gclient-recursedeps` in .gitmodules file.
Note there's not presubmit checking that this stays in sync, but I think recursdeps is not updated often enough that it's a high priority. We will also need to run `gclient gitmodules` for all repos we care about to update the .gitmodules file after this lands.


Bug: b/368607402, b/371352079
Change-Id: Iac90f0f45a30e2c1fdccf6053f07ec34c4139df1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5903942
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
5 months ago
Bruce Dawson 9157dd872e Remove extraneous Python version from presubmit warnings
When a presubmit warning is triggered this message is printed:

    There were Python 3 presubmit warnings.

The Python version information was useful when we were transitioning
our presubmits from Python 2 to Python 3, but that transition is long
finished, and now that information is just noise.

This change deletes the excess information.

Change-Id: I4e43e1c9daf36daaaa9430d76ad557c800cf962b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5907924
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Auto-Submit: Bruce Dawson <brucedawson@chromium.org>
5 months ago
Anne Redulla 1291794f5e Check git version
On `git cl upload` and when running a command on all deps
using `gclient` in a non-Cog env, prints/logs a warning if git
should be updated. Non-blocking; command should still be
attempted as usual.

Bug: b/360206460
Change-Id: I8ebef4cb8b520124bc34ade7f0f2179874b470a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5874690
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Anne Redulla <aredulla@google.com>
5 months ago
Junji Watanabe ec715a4dac ninjalog_uploader: Add is_cloudtop, gce_machine_type, is_cog to the Ninjalog metadata
Bug: 367856712
Change-Id: Ibaa96d779cc3fc896e8203525346e3ca27d9d8b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5877849
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Junji Watanabe <jwata@google.com>
5 months ago
Helmut Januschka d1259b49c5 show-scope is only available git>=2.26
Change-Id: Ie83edb34f2e582ccca177e36010344788a090376
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5874040
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
5 months ago
Anne Redulla 795b5b6a20 Added check_git_version helper
Not yet used.

Bug: b/360206460
Change-Id: I233cdc17ec17d477ec78024edca2b87417a92258
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5869272
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Anne Redulla <aredulla@google.com>
5 months ago
Gavin Mak bba50600f8 Track origin/lkgr when using --lkgr flag in new-branch
Passing --lkgr tracks the local "lkgr" branch which may not exist.
"origin/lkgr" is a better default since that should exist for projects
that have a lkgr.

Bug: 366394191
Change-Id: I2a0ce1a4d8540ce2e3ca06ef892e288c9892cf0c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5876340
Auto-Submit: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
5 months ago
Josip Sokcevic 76021e34e5 Update roll_downstream_gcs_deps to take a list of source and destination packages.
This is needed to support rolling multiple packages at once when package
names don't match.

Change-Id: I20bb5edfee87bb3e089a2c25f597e4778e0fe60f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5867086
Reviewed-by: Stephanie Kim <kimstephanie@google.com>
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Stephanie Kim <kimstephanie@google.com>
5 months ago
Joanna Wang d43a3eb748 Add end_commit for calculating GitChange diffs.
Bug: b/365162784

Change-Id: I97b69b1ae5183bbdaa7d4de0b1f23e62f4e1d8d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5853908
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
6 months ago
Junji Watanabe 20a0cda9e9 ninjalog_uploader: Distinguish between explicit and default build configs
This CL adds `explicit_build_config_keys` to the metadata for the server
to distinguish between explicit and default configs.
This CL excludes the configs set in `//.gn` from the list, so that
the configs specified by users will be considered as explicit.

Bug: 364971744
Change-Id: I6a3d289d8ca6e054dac691051b53c92ad1ec23c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5853009
Commit-Queue: Junji Watanabe <jwata@google.com>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
6 months ago
Fumitoshi Ukai 61fad561d6 autoninja: check RBE project, not account
Account check would become too slow.
We'll check RBE project to use instead.

On corp machine, our policy to use @google.com account
and rbe-chrome-untrusted to build chromium/chrome.
We don't allow rbe-chromium-untrusted with @chromium.org
on corp machine.

On non-corp machine, user couldn't use rbe-chrome-untrusted
because it's @google.com only, and corp security policy
doesn't allow @google.com account on non-corp machine.

Bug: b/364318216
Change-Id: I0f3a19e105b050aef6a62e1b25b45b1722382a34
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5848450
Reviewed-by: Scott Lee <ddoman@chromium.org>
Reviewed-by: Michael Savigny <msavigny@google.com>
Commit-Queue: Fumitoshi Ukai <ukai@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
Reviewed-by: Philipp Wollermann <philwo@google.com>
6 months ago
Helmut Januschka eb0cb70185 Avoid silently overwriting diff.ignoreSubmodules config.
Setting this to `dirty` is generally desirable. If the user has
explicitly set it to something else on their chromium checkout,
warn rather than silently overwriting.

Rev^2: https://crrev.com/c/5832742

Change-Id: I8392c7976af0a1f8754a630bd865830ba6698051
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5836831
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Helmut Januschka <helmut@januschka.com>
6 months ago
Dan Le Febvre ab105459cb Revert "Avoid silently overwriting diff.ignoreSubmodules config."
This reverts commit acd68a9a5d.

Reason for revert: Doesn't get values for non scoped config.

Original change's description:
> Avoid silently overwriting diff.ignoreSubmodules config.
>
> Setting this to `dirty` is generally desirable. If the user has
> explicitly set it to something else on their chromium checkout,
> warn rather than silently overwriting.
>
> Bug: 362787698
> Change-Id: I56587d501aafc5de78c82bc46e29f926519d25fa
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5832742
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Commit-Queue: Helmut Januschka <helmut@januschka.com>

Bug: 362787698
Change-Id: I3e5d1e44e3707dda53dc398f83c43259868d343b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5842067
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Joey Scarr <jsca@google.com>
Owners-Override: Joey Scarr <jsca@google.com>
Commit-Queue: Dan Le Febvre <dlf@google.com>
6 months ago
Helmut Januschka acd68a9a5d Avoid silently overwriting diff.ignoreSubmodules config.
Setting this to `dirty` is generally desirable. If the user has
explicitly set it to something else on their chromium checkout,
warn rather than silently overwriting.

Bug: 362787698
Change-Id: I56587d501aafc5de78c82bc46e29f926519d25fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5832742
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Helmut Januschka <helmut@januschka.com>
6 months ago
Junji Watanabe 28edf94b2b build_telemetry: Set timeout to 'cipd auth-info' command.
When it's offline or the internet connection is unstable,
build_telemetry.enabled() may fail, which end up with
blocking autoninja command.

Bug: 364611323
Change-Id: Ie0d26e7b950e29af1392e452a0cd7e986494cdcf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5842066
Auto-Submit: Junji Watanabe <jwata@google.com>
Commit-Queue: Junji Watanabe <jwata@google.com>
Reviewed-by: Philipp Wollermann <philwo@google.com>
6 months ago
Junji Watanabe 4250face7b ninjalog_uploader: Collect all GN args except sensitive information
Bug: 364971744
Fixed: 364971744
Change-Id: Ia09ba43f3cd12638923b3add458f2f32f9a03860
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5836322
Commit-Queue: Junji Watanabe <jwata@google.com>
Auto-Submit: Junji Watanabe <jwata@google.com>
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Fumitoshi Ukai <ukai@google.com>
6 months ago