For some types of changes, git cl split generates too many small CLs.
--max-depth provides one way of generating larger CLs when the author
judges that the larger CLs do not adversely affect reviewability (e.g.
20x 1 line CLs packed into 1x 20 line CL is generally fine).
Fixed: 777781
Change-Id: I64426ff4723fbc412fbc47f3cc12767433aeb8ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3933974
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
When CIPD removes a package, it removes the files. However, it's
possible that those files were checked in beforehand (for example,
https://crrev.com/c/3858186).
bot_update/gclient sync will first run git operations followed by cipd
ensure.
This patch restores any files that may have been deleted after cipd
ensure.
Bug: 1369452
Change-Id: I43ff9553118a20ed250bddc15153f02828847ed3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3928237
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Freeze command creates a commit, which then could be uploaded with git
cl upload.
R=gavinmak@google.com
Bug: 630822
Change-Id: I2fdc7bd8579f17680454b046ae80a473c6d420aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3923515
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Currently, the --revision flag to git cl try will cause a gitiles commit
to be set that uses the provided revision, the gerrit host and project
of the CL to test and the target ref of the CL to test. Since the flag
is intended to control the version of source to check out and have the
patch applied to, using the gerrit host instead of the gitiles host will
result in gitiles commits that won't match the repo_path_map in gclient
configs.
Change-Id: Ie391cc9c636f3a9c87116dbb781267031569e67b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3907186
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Garrett Beaty <gbeaty@google.com>
Before this commit, the following switches exist:
- --nohooks
- --no-history
They are not consistent. This commit makes the following switches
available:
- --nohooks, --no-hooks
- --nohistory, --no-history
Bug: None
Change-Id: Iaea2357c05e3dc69e3fac0fb9d823db903d811bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3904446
Auto-Submit: Thiago Perrotta <tperrotta@chromium.org>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
When a presubmit message, warning, or error strikes it is sometimes due
to a bug or weakness in the presubmit. Examining the presubmit or fixing
it can be important. However it can be hard to find the relevant code
(hint: many presubmits are in depot_tools/presubmit_canned_checks.py).
With this change you can just run the presubmits with -v -v (double
verbose) and a call stack will be recorded when each presubmit result
object is created. For instance:
>git cl presubmit --force --files ash/public/cpp/app_list/vector_icons/google_black.icon -v -v
** Presubmit Messages: 1 **
Trademarked images should not be added to the public repo. See crbug.com/944754
ash/public/cpp/app_list/vector_icons/google_black.icon
***************
Presubmit result call stack is:
File "depot_tools/presubmit_support.py", line 2098, in <module>
sys.exit(main())
File "depot_tools/presubmit_support.py", line 2074, in main
return DoPresubmitChecks(
File "depot_tools/presubmit_support.py", line 1771, in DoPresubmitChecks
results += executer.ExecPresubmitScript(presubmit_script, filename)
File "depot_tools/presubmit_support.py", line 1612, in ExecPresubmitScript
self._run_check_function(function_name, context, sink,
File "depot_tools/presubmit_support.py", line 1653, in _run_check_function
result = eval(function_name + '(*__args)', context)
File "<string>", line 1, in <module>
File "chromium/src/PRESUBMIT.py", line 2225, in CheckNoProductIconsAddedToPublicRepo
message_type(
File "depot_tools/presubmit_support.py", line 352, in __init__
self._long_text += ' '.join(traceback.format_stack(None, 8))
This changes tracking down presubmits from a dark art to a trivial operation.
Bug: 1309977
Change-Id: Ia0a6adfbbab04041f97c56cd2064a1627e252561
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3896076
Reviewed-by: Dmitrii Kuragin <kuragin@chromium.org>
Commit-Queue: Dmitrii Kuragin <kuragin@chromium.org>
Long lines in source files are bad, but sometimes unavoidable. Since
ignoring warnings is even worse than long lines it is wise to have a way
to disable the warning. This change adds support for a multi-language
tag that can be put in unavoidably long lines.
Bug: 1309977
Change-Id: I205086050b5aa5b4a02a651c06615c82ec0e1a38
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3896084
Reviewed-by: Dmitrii Kuragin <kuragin@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
This change also makes CheckVPythonSpec() look for .vpython3 files.
Bug: 1336295
Change-Id: I4bbec48debe42748811a8cfcef6da9602017d4bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3891974
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Fabrice de Gans <fdegans@chromium.org>
The FilterSourceFile comment block said that the filter lists use
regular expressions, but that is not specific enough because .search and
.match have different semantics. crrev.com/c/3679163 added a filter that
only matched on PRESUBMIT.py instead of all of them because of this
difference - better documentation might have avoided this.
The new documentation also makes it clear that Linux-style path
separators in the regex expressions are fine (they have been supported
since crrev.com/c/3609117).
Bug: 1309977
Change-Id: I49d37fbb93ef4a85f143d928a56af8ce22850c76
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3889880
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Jesse McKenna <jessemckenna@google.com>
We have long had a presubmit that warns when a file lacks a suitable
license, but because this is a warning it can be ignored by the author
and is not visible to reviewers. Every failure that is not prevented
will occur, and indeed newly added files from this year (seen in
crrev.com/c/3706888 and crrev.com/c/3437860, and possibly others) are
missing valid licenses.
This change turns the warning into an error on newly added files.
Bug: 1361031
Change-Id: Ie17bd6e591918affd9d865a3bf2be6c2bf62d1ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3887721
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
The python module is deprecated in favor of using the step module with
an explicit python binary. Switching the code to use the step module and
remove DEPS on recipe_engine/python removes warnings when running recipe
tests in the repo.
Change-Id: If3c9d5d6aff5aab69898b535399accbef92f5c0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3880624
Commit-Queue: Garrett Beaty <gbeaty@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
The warning that a PRESUBMIT.py file was still being run under Python 2
was apparently too polite as one was just added. This change adds
instructions on how to prevent this, which should make it clear that
the behavior is not desirable.
The warning was added in crrev.com/c/3826917.
Bug: 1313804
Change-Id: I81a6ea45907b5ea00e7d945c3131a329708cc377
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3878875
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
This is a reland of commit 10dbd7babd
Original change's description:
> Remove old DepotToolsOwners implementation
>
> code-owners should have been enabled for most hosts that depot_tools
> supports by now. Remove our own implementation and rely on code-owners.
>
> Change-Id: Iaf0d3db65b2e5063b67d42b92188c4ec51d2cd9a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3783475
> Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
> Reviewed-by: Joanna Wang <jojwang@chromium.org>
> Commit-Queue: Gavin Mak <gavinmak@google.com>
Change-Id: Ic87f34411bb38b91fcf49adb07601ae10244e828
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3881043
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
depot_tools codebase uses py3 and there's limited py2 usage, namely for
presubmits. This CL drops running most of py2 unit tests since there are
no longer useful.
Bug: 1357152
Change-Id: I49a3df503026bc6918362a9b5600f5714eb5c87a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3872425
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
As per the lawyers, the preferred style has no period after "Authors"
when the "all rights" sentence is dropped. Adjust the regex to not
match a period when there is no "all rights" sentence.
Bug: 1098010
Change-Id: Ib4103c09f9d02d58b9294643bbedd72fc895bbe2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3876526
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Avi Drissman <avi@chromium.org>
This is a reland of commit eb16430cf9
Original change's description:
> Use io.open for opening files
>
> Use io.open which is consistent in py2 and py3.
>
> Bug: 1357152
> Change-Id: I49a3df503026bc6918362a9b5600f57111111111
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3872429
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Bug: 1357152
Change-Id: I58881c040ca7333f0247875a0c4abe31cf793b08
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3877645
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
On macOS, it failed with:
Exception in thread git-retry.tee.stderr:
Traceback (most recent call last):
File "/path/to/cipd's/3.8/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "$HOME/depot_tools/git_retry.py", line 36, in run
self.out_fd.write(line)
TypeError: write() argument must be str, not bytes
Change-Id: Ib2a77731dee10b6bb2a2ea2a7ffeaf1165e15df6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3873929
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Marc-Antoine Ruel <maruel@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>