Tests should start to rely on fake_repos.DEFAULT_BRANCH so it can be
renamed in the future. This is a quick fix in case
git.init.defaultBranch is set to a custom value.
Bug: 1144918
Change-Id: I1c8cd591bee6b5fe14a5de4683111a89224cb2b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2521655
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
And merge it in use_relative_paths. In all Chromium repos,
use_relative_hooks is True iff:
- use_relative_paths is True, and
- there is at least one hook
It makes sense that you'd want to use relative hooks if you use relative
paths so this CL merges both flags into use_relative_paths.
Bug: chromium:1107325
Change-Id: I0fe40eba1e1c61be26c812c7ca4329efb72c7f90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2306795
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Without this repos that use the use_relative_paths still need to use
their absolute path for gclient_gn_args_file.
Bug: chromium:1102833
Change-Id: I470096625061a28abf495f4d1035121edbcd581f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2279874
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This was made by running `codespell` and `scspell`
and then checking the results.
Change-Id: I169fd5b40294f83015075b4a899fbca263821f25
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2144602
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
Auto-Submit: Quinten Yearsley <qyearsley@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Running gclient_smoketests times out on windows when using git daemon,
so use a local directory as remote instead.
Bug: 1024683
Change-Id: I6ca506d74de463d914317f176eefbe74996298c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1879723
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
This ensures relative file: directives in OWNERS files also work if
the directory of the owners file gets deleted.
Bug: 1015444
Change-Id: I9471a28a7246513120dd3ebb924f6d64eb50c2df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1870249
Reviewed-by: Tamer Tas <tmrts@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Ran:
vi $(git grep --name-only iteritems | grep -v third_party)
vi $(git grep --name-only itervalues | grep -v third_party)
vi $(git grep --name-only 'print ' | grep -v third_party)
and edited the files quickly with adhoc macros. Then ran in recipes/:
./recipes.py test train
There was only a small subset of files that had been updated to use
six.iteritems() and six.itervalues(). Since the dataset size that is
being used in gclient is small (pretty much always below 200 items),
it's better to just switch to .items() right away and take the temporary
performance hit, so that we don't need to come back to rewrite the code.
Recipe-Nontrivial-Roll: build
Bug: 984182
Change-Id: I5faf11486b66b0d73c9098ab0f2ce1b15a45c53e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1854900
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Marc-Antoine Ruel <maruel@chromium.org>
This will make it easier to get rid of super_mox.py
Bug: 984182
Change-Id: Ic6c9646b8a96ef05ac59293a62f68ad7db7dc2d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1754977
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Also replace mox with mock and move the test script to a different file.
Bug: 984182
Change-Id: I9005a523c2abd82c38a7c61501c7cbfd4201a5b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1745412
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
SIGKILL doesn't exist on Windows, but SIGTERM does.
For our purposes they do the same thing.
Bug: 962263
Change-Id: I16929cf7d1377cd81f71401a48b5a84fe54da493
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1608561
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
Commit-Queue: Raul Tambre <raul@tambre.ee>
Auto-Submit: Raul Tambre <raul@tambre.ee>
Ran "2to3 -w -n -f except ./".
The scripts still work with Python 2.
There are no intended behaviour changes.
Bug: 942522
Change-Id: Ifa274cb83f74cfa8ce092fffbb88f3ab5309e72c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1607841
Commit-Queue: Raul Tambre <raul@tambre.ee>
Auto-Submit: Raul Tambre <raul@tambre.ee>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Python doesn't guarantee that the file created by tempfile.NamedTemporaryFile can be opened by multiple programs at once.
This is the case on Windows, so we need to close the temporary PID file and only then pass it to Git.
Bug: 962263
Change-Id: Idf4a36b33ce06d7ab06453c20a690622179aef58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1608560
Auto-Submit: Raul Tambre <raul@tambre.ee>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Raul Tambre <raul@tambre.ee>
This avoids the need to do the decoding everywhere separately.
Also a small fix for filter() no longer returning a list on Py3.
The scripts still work with Python 2.
There are no intended behaviour changes.
Bug: 942522
Change-Id: Id0f5153011b2ef1b64394359087864cd9434e45e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1595685
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Auto-Submit: Raul Tambre <raul@tambre.ee>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Ran "2to3 -w -n -f print ./" and manually added imports.
Ran "^\s*print " and "\s+print " to find batch/shell scripts, comments and the like with embedded code, and updated them manually.
Also manually added imports to files, which used print as a function, but were missing the import.
The scripts still work with Python 2.
There are no intended behaviour changes.
Bug: 942522
Change-Id: Id777e4d4df4adcdfdab1b18bde89f235ef491b9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1595684
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Auto-Submit: Raul Tambre <raul@tambre.ee>
Python (prior to 3.8) treats meaningless string escape sequences as if
they were a slash followed by the character. That is, '\w' == '\\w'.
Python 3.8 rejects this, and it's confusing. This change fixes seven of these
regex strings found in depot_tools (through a regex search, natch). Most of
the fixes don't actually change the value of the strings, and this was
manually verified:
>>> '(/c(/.*/\+)?)?/(\d+)(/(\d+)?/?)?$' == r'(/c(/.*/\+)?)?/(\d+)(/(\d+)?/?)?$'
True
>>> '#\s*OWNERS_STATUS\s+=\s+(.+)$' == r'#\s*OWNERS_STATUS\s+=\s+(.+)$'
True
>>> 'COM\d' == r'COM\d'
True
>>> '^\s+Change-Id:\s*(\S+)$' == r'^\s+Change-Id:\s*(\S+)$'
True
>>> 'ETag:\s+([a-z0-9]{32})' == r'ETag:\s+([a-z0-9]{32})'
True
Two exceptions were the regex expressions in filter_demo_output.py and scm.py.
These were turned into raw strings despite this changing the value of the
string passed to re. This works because re supports the \x, \d, \w, \t, and
other escape sequences needed to make this work.
TL;DR - use raw strings for regex to avoid melting your brain. If bulk changing
regex strings to raw watch out for double-slashes.
Bug: 958138
Change-Id: Ic45264cfc63e8bae9cfcffe2cd88a57c2d3dcdae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1590534
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
connect(2) says stream sockets may only succeed to connect once. This means
if the call to sock.connect() fails it will continue failing for the
entirety of the wait loop, and we will fail to wait for a port to bind even
when it eventually becomes available.
Make sure we create a new socket every time we are about to try to connect
to it.
Change-Id: I16d7dbea3590c5bf7f7240bdefcc5ec0bcd1edb5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1528291
Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Instead of creating an empty dict and setting all the required git variables
there, add those variables to os.environ so that we do not drop other
required variables -- in my case, git was not in /usr/bin so invoking 'git
commit' in _add_schema_commit fails with "no such file or directory".
Change-Id: I8c9b14e1f534efc8f40d21b312a5396b2f65f4a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1528290
Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
The script gets confused on Windows, because the path delimieter is \,
not /.
Bug: 899724
Change-Id: Id907aceb4f7bb6fcc0460245890b9e4716054ff9
Reviewed-on: https://chromium-review.googlesource.com/c/1308897
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
This is a reland of 67ef3f67e8
We no longer call cipd unconditionally.
Original change's description:
> gclient: delete unversioned directory before adding cipd dep for the same path
>
> Bug: 882611
> Change-Id: I46e41cc9693b90874b5d6569a12ec638eaac1050
> Reviewed-on: https://chromium-review.googlesource.com/1228655
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Bug: 882611
Change-Id: I683bfc62bd1eebfec0853583f96f3981c2c6bdf2
Reviewed-on: https://chromium-review.googlesource.com/1232891
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
When a recursive dependency has use_relative_paths it also makes sense
to have the hooks working directory by the dependency's directory.
Otherwise if a hook uses one of the relative dependencies it is impossible
to know which path prefix to use.
However we cannot change the behavior of hooks with use_relative_paths
because it would break existing projects that use_relative_paths but
hardcoded the prefix for hooks. Instead we add a second boolean,
use_relative_hooks that triggers the behavior.
Adds tests for the new behavior and a test for existing interactio
between hooks and recursedeps.
BUG=chromium:875245
Change-Id: Ie4c526baa425ff887b3be54e0feca7c597ededec
Reviewed-on: https://chromium-review.googlesource.com/1213327
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
When a git mirror is configured, it fetches only refs/heads/*,
and possibly branch-heads and tags, but not refs/changes.
When gclient attempts to sync refs/changes/* from a mirror,
it fails, since the mirror has no such objects.
See for example [1], where the DEPS entry for builtools was
modified to sync to a CL, but all the bots failed to sync to it.
This change modifies gclient to always fetch refs/changes/*
directly from the repo, even when a mirror is configured.
[1] https://chromium-review.googlesource.com/c/chromium/src/+/1119098/6
Bug: 858894
Change-Id: I71bb313e4325a81b2985db1d00c70a8844dc7c22
Reviewed-on: https://chromium-review.googlesource.com/1119525
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>