Commit Graph

417 Commits (36179f554889bdadf476421a7fc3d40147e6e4c5)

Author SHA1 Message Date
Nico Weber 4bd1522a29 gclient: Stop running git under "arch" on macOS
We now have an arm python binary, so this should no longer be needed.

Bug: 1103326,1184767,1103236
Change-Id: I5510bf2c61adc2d0d505a886956a6677303df271
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2888957
Auto-Submit: Nico Weber <thakis@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
4 years ago
Edward Lesmes 07a683430c Reland "git-cache: Add option to fetch commits."
This is a reland of 4c67f856f0
Issues should have been fixed by crrev.com/c/2838026

Original change's description:
> git-cache: Add option to fetch commits.
>
> Add option to git cache to fetch commits.
> And use it in bot_update and gclient sync to make sure
> the needed commits are present on the checkout.
>
> Change-Id: I9e90da9e3be6e7bacf714b22bf0b735463e655b6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2829942
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: Ie5a29737f5a75d28bc7c5c2f6cb99ec7f87cd9e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2841046
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 4ea67bbd15 gclient: Map origin/foo to refs/remotes/origin/foo
Bug: 1200657
Change-Id: Ib719b984a71cd944bbccf3ec7065aaa17f60e638
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2838026
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 93d80d8686 Revert "git-cache: Add option to fetch commits."
This reverts commit 4c67f856f0.

Reason for revert: crbug.com/1200657

Original change's description:
> git-cache: Add option to fetch commits.
>
> Add option to git cache to fetch commits.
> And use it in bot_update and gclient sync to make sure
> the needed commits are present on the checkout.
>
> Change-Id: I9e90da9e3be6e7bacf714b22bf0b735463e655b6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2829942
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: I31a1defb26119bcb46894ab4084d626b65c45fed
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2837413
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
4 years ago
Edward Lesmes 4c67f856f0 git-cache: Add option to fetch commits.
Add option to git cache to fetch commits.
And use it in bot_update and gclient sync to make sure
the needed commits are present on the checkout.

Change-Id: I9e90da9e3be6e7bacf714b22bf0b735463e655b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2829942
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Josip Sokcevic 091f5ac0a6 Use real default branch in gclient
Currently, gclient sync assumes the default branch is master, and
it doesn't work at all if such branch doesn't exist. This change queries
local git copy to get remote HEAD. If local git version is not
available, it queries remote git server using ls-remote.

This change requires git version 2.28 (depot_tools comes with 2.29).

R=ehmaldonado@chromium.org

Bug: 1156318
Change-Id: Id348e0f1004093f395139e8f4d62adb66b94ca9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2628359
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Josip Sokcevic 9c0dc3026e Replace non-inclusive terms
Bug: 1118410, 1118413, 1118422, 1118424, 1118426
Bug: 1118428, 1118430, 1118434, 1118438, 1118442
Bug: 1118453, 1118454
Recipe-Nontrivial-Roll: chromiumos
Recipe-Nontrivial-Roll: build
Change-Id: I43e6305f8c3136774f01b57f12bb442bcb863371
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2551388
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Adam Norberg a1e15498cd Xcode 12b3 (and later) emits arm64e binaries; try that architecture.
In Xcode 12 beta 3, pointer authentication was turned on for ARM64
binaries, yielding arm64e architecture. Attempting to run with only
arm64 specified does not allow an arm64e slice to run. Prefer arm64e
if available, but allow an arm64 slice if that's the only option.
(If provided multiple architectures, arch uses the first one that can
be used.)

Bug: 1103236
Change-Id: Id3498816a2495a449a16b3b6a66b0e776b70f4e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2404709
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Adam Norberg <norberg@google.com>
5 years ago
Anthony Polito 486f1812ef Add a little bit more context to a failure case for debugging reasons
Bug: 1110152
Change-Id: I4b525a62aa87ea98590741445b4273068edb7f6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2332373
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Anthony Polito <apolito@google.com>
5 years ago
Edward Lesmes f627d9fc54 gclient: Apply on patch of remote's branch-heads instead of local.
refs/branch-heads/ might be out of date, as bot_update is now fetching
refs/branch-heads/* as refs/remotes/branch-heads/*.

Bug: 1108638
Change-Id: I5a221e8e01017552f42c0c52d7ef7327acc5f63e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2316327
Reviewed-by: Michael Moss <mmoss@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lesmes d4e20f24d5 gclient: Unset core.worktree after cloning on Windows.
Caused by https://github.com/git-for-windows/git/issues/2569

Bug: 1070694
Change-Id: Ice39e0f61e5c571562736a35e6441d01cb76ea06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2300652
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Nico Weber c49c88ac82 gclient: Force "git clone" to run arm git on arm macs.
With this, `fetch chromium` manages to client src.git and all
dependencies in DEPS (and then dies in runhooks).

Bug: 1103236
Change-Id: I0e26b78f1c552aa23eaa6c43b61f3c6809a3ada1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2287751
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
5 years ago
Josip Sokcevic 252ff1fead Remove rev-parse --verify FETCH_HEAD
It's not used and causes some problems if refs on clone aren't set
properly.

R=ehmaldonado@chromium.org

Bug: 1049610
Change-Id: I71c1215c9a3355dd54e2d66860d755c6fe8032db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2224853
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Josip Sokcevic 14a83aec56 Reland "Use OS level locking in git_cache.py"
This is a reland of d3affaa624

Original change's description:
> Use OS level locking in git_cache.py
> 
> Without OS level locking it's possible to leave "lock" files on disk
> which will prevent next run to acquire those locks. This can easily
> happen if SIGKIL is issued.
> 
> R=apolito@google.com, ehmaldonado@chromium.org
> 
> Bug: 1049610
> Change-Id: Id87aa1376b9ea5ff0c2d14f3603636493ed1dd5b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2189333
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>

Bug: 1049610
Change-Id: I58e65a10f7c779e0de1121ba7167c694996e390c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2211189
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Josip Sokcevic 8f6bfe301f Revert "Use OS level locking in git_cache.py"
This reverts commit d3affaa624.

Reason for revert: no attribute ignore_lock

Original change's description:
> Use OS level locking in git_cache.py
> 
> Without OS level locking it's possible to leave "lock" files on disk
> which will prevent next run to acquire those locks. This can easily
> happen if SIGKIL is issued.
> 
> R=​apolito@google.com, ehmaldonado@chromium.org
> 
> Bug: 1049610
> Change-Id: Id87aa1376b9ea5ff0c2d14f3603636493ed1dd5b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2189333
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>

TBR=iannucci@chromium.org,ehmaldonado@chromium.org,apolito@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com

Change-Id: Iecc963e0a99d7f59f3f8801e529839346f9fbaf3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1049610
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2211186
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Josip Sokcevic d3affaa624 Use OS level locking in git_cache.py
Without OS level locking it's possible to leave "lock" files on disk
which will prevent next run to acquire those locks. This can easily
happen if SIGKIL is issued.

R=apolito@google.com, ehmaldonado@chromium.org

Bug: 1049610
Change-Id: Id87aa1376b9ea5ff0c2d14f3603636493ed1dd5b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2189333
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Edward Lesmes 8073a50204 gclient: Set with_branch_heads if asked to sync to refs/branch-heads/*
The bug is caused because we already have refs/branch-heads/XXXX locally,
so we don't attempt to fetch it again, even if it has been updated.

This solution is a bit of a hack to make sure that we fetch
refs/branch-heads/*, which is the most common case for this to fail.

Bug: 1070545
Change-Id: Iec7cfff18219794230188e2b9e901c587acd274b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2149849
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
5 years ago
Quinten Yearsley 925cedba7b Run spellchecker on depot_tools
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>
5 years ago
Edward Lesmes 50da7706ce Reland "git-cl: Remove unused and duplicate functions."
This is a reland of e3a49aa405

GetRelativeRoot was fixed to use '.' instead of None

Original change's description:
> git-cl: Remove unused and duplicate functions.
>
> Remove unused functions, and use scm.GIT where possible to reduce
> duplication.
>
> Change-Id: I24f05e7b3ae04743e97b6665ee668f44d6acc294
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2116938
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: I54bd1d34d3501a38bf8af2f9e70059d58fa538a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2125293
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
John Budorick d94f8ea2b5 gclient: update logging.warn to logging.warning.
logging.warn is deprecated.

Change-Id: I047f356b8eeced631edc51e3b846f0995f4ce95e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2124526
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: John Budorick <jbudorick@chromium.org>
5 years ago
Edward Lesmes cba460828f Revert "git-cl: Remove unused and duplicate functions."
This reverts commit e3a49aa405.

Reason for revert:

TypeError: expected str, bytes or os.PathLike object, not NoneType

Original change's description:
> git-cl: Remove unused and duplicate functions.
> 
> Remove unused functions, and use scm.GIT where possible to reduce
> duplication.
> 
> Change-Id: I24f05e7b3ae04743e97b6665ee668f44d6acc294
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2116938
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

TBR=ehmaldonado@chromium.org,apolito@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com

Change-Id: I334a6289eb2c1f3e20feddd428307542d2aa38a9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2119411
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lesmes e3a49aa405 git-cl: Remove unused and duplicate functions.
Remove unused functions, and use scm.GIT where possible to reduce
duplication.

Change-Id: I24f05e7b3ae04743e97b6665ee668f44d6acc294
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2116938
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lesmes ae3586b538 depot_tools: Use gclient_utils.AskForData instead of raw_input.
gclient_utils.AskForData will use raw_input on Python 2 and input on Python 3.

Bug: 1063976
Change-Id: I93c059c4e4454d01787716b5a0a2641ad5253f53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2116370
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur e0ba7b8e7a gclient: Fix auto-fetching refs.
gclient executes `git rev-parse <ref>` to check if <ref>
already exists in the local clone, which succeeds when
<ref> is a git revision hash, even if it doesn't exist.

We execute `git rev-parse <ref>^{commit}` instead, which only
succeeds when <ref> resolves to a valid commit in the local
repo.

Change-Id: Ia1cdf7162c4c82a7e4214c6af375c1a9522d7b07
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2095745
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lesmes 05934953bf gclient: Make smoketests run on Windows.
Bug: 1024683
Change-Id: I1c30473699c1bd6b198188b53b632e3617fed335
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1929653
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Anthony Polito bb45734988 Changed "gclient sync -D" logic to compare against the expected DEPS version
Also add a better warning if 'gclient sync -D' fails due to a modified file.
I've tested this code via deleting a DEP and running gclient sync -D.

Bug: 981149
Change-Id: I97035ac238d163ccb1684c3ee423c223ed0f6299
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1891830
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Anthony Polito <apolito@google.com>
5 years ago
danakj d5c0b56e84 Use git fetch --no-tags to fetch commits to apply via cherry-pick.
This changes the behaviour when applying a patch to not fetch tags
along with the patch being applied. The fetch to apply a patch only
needs the commits that will be cherry picked, it does not need tags.

Fetching tags creates slow bottlenecks if a repo such as chromium has
10k+ tags. Using --no-tags prevents the server from sending the list
of all tags and the client from processing them.

Bug: 1019824
Change-Id: I756beb8c2b0c7ec3c0fc48b7431d0cf8c0bbbbd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1894393
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Erik Chen <erikchen@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
5 years ago
Robert Iannucci c39a77883d [gclient] Reset to parent commit with rebase_patch_ref=False instead of master.
This makes no-rebase-patch-ref correctly populate `file_list` and work with
`git diff --cached` (i.e. they will show only the files affected by the
patchset).

Previously gclient would `reset --soft` to master. Because we didn't rebase
on top of master with `no-rebase-patch-ref`, it has roughly nothing to do
with the patchref we just checked out.

R=gbeaty@chromium.org, ltina@google.com, tandrii@chromium.org

Context:
Tricium recipes sometimes need to use no-rebase-patch-ref in order to get
accurate linenumbers in the diff (i.e. so that the tricium comments will
actually line up correctly with the patchset the user uploaded); Tricium
recipes also need to accurately get the diff file list in this mode.
Change-Id: I5f3c95cd4958cf407a83b96c238b8c55c452ac81
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1895041
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Commit-Queue: Andrii Shyshkalov <tandrii@google.com>
5 years ago
Edward Lesmes e79107e01b gclient_scm: Fix tests on windows
Change-Id: I649bee199e52ecbd66467cfaf850a7a57e2eedf6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1874506
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Dirk Pranke db1e79c1c5 Fix gclient crash with unicode strings in .gclient files.
Older .gclient files might have explicit u'' strings in their
specs; as part of upgrading code to Python3 compatibility,
we apparently recently introduced a bug in the handling of this
that might cause them to fail on Windows.

This CL fixes that issue by ensuring that the GIT_DIR env var
is always set to a regular string, regardless of whether
the solution name was specified to be a regular string
or a unicode string.

Bug: 1016599
Change-Id: I295d220559eac20a2ced876672d5ccdb787a5338
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1874704
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
5 years ago
Erik Chen e16ffffc28 Add logging to bot_update.py and gclient_scm.py
Bug: chromium:1014216
Change-Id: I620f197fe26d8817ddb51e7a30ae774439d79bdf
Recipe-Nontrivial-Roll: chromiumos
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1860854
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Auto-Submit: Erik Chen <erikchen@chromium.org>
5 years ago
Mike Frysinger 286fb1607d gclient: have git operations specify the git dir by default
If the .git/ subdir exists and mostly looks OK, but in reality git
doesn't accept it, gclient will blindly run git in the subdir and
think it's operating on the local .git/.  Kind of like:
  $ cd src/third_party/emoji-segmenter/src/
  $ rm -rf .git && mkdir .git
  # This works on the top level src/.git/.
  $ git <operation>

Instead of relying on this automatic git behavior, use GIT_DIR by
default so we force git to only look at that specific checkout.  If
it's broken, git will fail on us (good) instead of silently falling
back to the parent (bad).
  $ cd src/third_party/emoji-segmenter/src/
  $ rm -rf .git && mkdir .git
  $ GIT_DIR=$PWD/.git git <operation>
  <this now hard fails>

Bug: 1000825
Test: `gclient sync -j1` with a broken src/third_party/emoji-segmenter/src/.git/ caused the sync to halt
Change-Id: I777d67cd5daa354b32c424414d93a61b3b600f54
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1785957
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Quinten Yearsley 3841eaa164 Remove unused imports in depot_tools/*.py
I know that sometimes imports can have side-effects,
so unused imports shouldn't always be removed, but these
ones look like they could be.

Change-Id: Iea9f82afa99b0ea35f29a28f20ce0493b579cfee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1819860
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
6 years ago
Edward Lemur 26a8b9f356 depot_tools: Make gclient Python3 compatible.
Bug: 984182
Change-Id: Idc38678acbfca9cc6b89d77db28fdc24784f2b7d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1753742
Commit-Queue: Edward Lemur <ehmaldonado@google.com>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
6 years ago
Edward Lemur 979fa780ce depot_tools: Make gclient_scm Python 3 compatible.
Bug: 984182
Change-Id: Ib9c5d2762546f29eaca5eae89b0428431067da4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1753029
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
6 years ago
Edward Lemur 24146be833 depot_tools: Simplify CheckCallAndFilter[AndHeader]
- Merge CheckCallAndFilter[AndHeader]
- print_stdout will cause command output to be redirected to sys.stdout.
- Made compatible with Python 3.

Bug: 984182
Change-Id: Ida30e295b872c8c1a1474a376a90aecea924f307
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1727404
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
6 years ago
Edward Lemur 4c5c8ab626 Reland "Reland "gclient: Require a target ref when applying patches.""
This is a reland of 822dbc51a2

Skia has fixed the test.

Original change's description:
> Reland "gclient: Require a target ref when applying patches."
>
> This is a reland of 1d6478a5ff
>
> Original change's description:
> > gclient: Require a target ref when applying patches.
> >
> > Bug: 956807
> > Change-Id: Icfffe965f9f4651f22e8ba32c60133a5620bb350
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1616804
> > Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
> > Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
>
> Bug: 956807
> Change-Id: I3de8475a091ce6a2a14ff7dcfb92507a205ef78c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1623594
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

TBR=tandrii@chromium.org

Bug: 956807
Change-Id: Ie273dafb921206f6346678c1861320129ad5b6fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1649695
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lesmes 42b03c3453 Revert "Reland "gclient: Require a target ref when applying patches.""
This reverts commit 822dbc51a2.

Reason for revert:
Skia autoroller is complaining
https://skia-review.googlesource.com/c/buildbot/+/219338

Original change's description:
> Reland "gclient: Require a target ref when applying patches."
> 
> This is a reland of 1d6478a5ff
> 
> Original change's description:
> > gclient: Require a target ref when applying patches.
> > 
> > Bug: 956807
> > Change-Id: Icfffe965f9f4651f22e8ba32c60133a5620bb350
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1616804
> > Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
> > Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> 
> Bug: 956807
> Change-Id: I3de8475a091ce6a2a14ff7dcfb92507a205ef78c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1623594
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

TBR=borenet@chromium.org,tandrii@chromium.org,ehmaldonado@chromium.org

Change-Id: I14a70206a34f7024abc21039806f23dc7cf56bb6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 956807
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1648321
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 822dbc51a2 Reland "gclient: Require a target ref when applying patches."
This is a reland of 1d6478a5ff

Original change's description:
> gclient: Require a target ref when applying patches.
> 
> Bug: 956807
> Change-Id: Icfffe965f9f4651f22e8ba32c60133a5620bb350
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1616804
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Bug: 956807
Change-Id: I3de8475a091ce6a2a14ff7dcfb92507a205ef78c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1623594
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 3acbc749e4 gclient: Make it possible to set target_rev to a commit hash.
Bug: 956807
Change-Id: I333479715257a582e26a823ed5c0e2382851ff35
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1625775
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Edward Lesmes 9a01eb27ff Revert "gclient: Require a target ref when applying patches."
This reverts commit 1d6478a5ff.

Reason for revert: 
Skia doesn't pass target refs to patches yet.

Original change's description:
> gclient: Require a target ref when applying patches.
> 
> Bug: 956807
> Change-Id: Icfffe965f9f4651f22e8ba32c60133a5620bb350
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1616804
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

TBR=tandrii@chromium.org,ehmaldonado@chromium.org

Change-Id: I96c7d4ab7df151f50e82f783ef1a8769890aef9a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 956807
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1623593
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 1d6478a5ff gclient: Require a target ref when applying patches.
Bug: 956807
Change-Id: Icfffe965f9f4651f22e8ba32c60133a5620bb350
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1616804
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Raul Tambre cd862e37ea gclient_scm: Decode Git output centrally for better Python 3 support
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>
6 years ago
Edward Lemur 8c66565649 gclient: Fix applying patches to branch heads.
Bug: 956807
Change-Id: I2eed6db1f338806812fca778986d51b0a007eddd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1592577
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Edward Lemur a0ffbe4505 gclient: Convert target ref to patch to a remote ref.
Bug: 956807
Change-Id: I2e1d0b61d99796434115012709b6e79e507e2986
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1590495
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Aaron Gable ac9b0f3786 Restore py2/py3 compatibility with basestring
A previous CL replaced "basestring" with "str", because basestring
does not exist in Python 3. However, this broke Python 2's ability
to interoperate with unicode strings. This CL introduces a workaround
(defining basestring to be equivalent to string, if it doesn't exist
already), and restores the references to basestring. This workaround
can be fixed when we're 100% on Python 3.

It also undoes some unnecessary and harder-to-read formatting changes.

Bug: 942522
Change-Id: I4a31ee46dc048134c2e4832b6c44ea00ce341899
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1572441
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
6 years ago
Henrique Ferreiro e72279d25f Keep warning about unversioned trees until removed
Restore previous behavior and keep emitting a warning when an existing
gclient entry is not longer part of the client. Additionally, suggest
the usage of `gclient sync -D` to automatically remove them.

Change-Id: I62d4662ae4d0886d340230019419b68debffc5ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1483031
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Michael Moss <mmoss@chromium.org>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
6 years ago
Edward Lemur 9a5e3bd817 gclient_scm: Simplify fetching refs.
Bug: 874501, 942229
Change-Id: Ie9896e8a289e32a1b468ed5fa51c95a81970bdf8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1544802
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Edward Lemur bdbe07f29d gclient: Support syncing deps to refs/{branch-heads,tags}:revision.
Arbitrary refs (i.e. syncing to refs/arbitrary/stuff:revision) is not
guaranteed to work.

Bug: 874501, 942229
Change-Id: If08f0d9ae257e3d9f486d3ea6b310c8d94d3b918
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1542588
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Karen Qian <karenqian@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Raul Tambre b946b2389c Improve gclient Python 3 compatibility
This enables gclient sync and gclient runhooks to run, barring hook script failures.
git cl upload also now works.

The scripts still work with Python 2.
There are no intended behaviour changes.

Bug: 942522
Change-Id: I2ac587b5f803ba7f5bb5e412337ce049f4b1a741
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1524583
Commit-Queue: Raul Tambre <raul@tambre.ee>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
6 years ago