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>
- 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>
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>
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>
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>
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>
The scripts still work with Python 2.
There are no intended behaviour changes.
Bug: 939847
Change-Id: Icada60c5b2cf351d62aead26b7364fcef2c2a3e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1524486
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Raul Tambre <raul@tambre.ee>
If we already have the correct commit, it is not necessary to fetch. Any
fetches can takes minutes due to gerrit problems, and often fail
completely, so it is helpful to avoid them completely whenever we can.
Reland now that skia autoroller does its own fetch.
Bug: 938627
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1504102
Commit-Queue: Michael Spang <spang@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Change-Id: I5a6877125c682ff0d98bd6d2ffe495245f74c513
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1512024
Auto-Submit: Michael Spang <spang@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
This reverts commit 61a1b5f310.
Reason for revert:
It's blocking skia autoroller
https://skia-review.googlesource.com/c/buildbot/+/198700
Original change's description:
> Avoid unnecessary invocations of "git fetch"
>
> If we already have the correct commit, it is not necessary to fetch. Any
> fetches can takes minutes due to gerrit problems, and often fail
> completely, so it is helpful to avoid them completely whenever we can.
>
> Bug: 938627
>
> Change-Id: I54494cad9b9aa0090f51674b6b9f56bb3e842f12
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1504102
> Commit-Queue: Michael Spang <spang@chromium.org>
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
TBR=spang@chromium.org,agable@chromium.org,ehmaldonado@chromium.org
Change-Id: If8bd26d74bf84ff0ca69378dbfe6b9369b9988d3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 938627
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1508980
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
If we're asked to sync a repo to branch-heads or tags,
make sure we fetch refs/branch-heads/* and refs/tags/* even if
--with-branch-heads or --with-tags was not passed.
Bug: 938160
Change-Id: I04de8e7762c83322692d9551d057ec803fd2ac9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1506420
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
If we already have the correct commit, it is not necessary to fetch. Any
fetches can takes minutes due to gerrit problems, and often fail
completely, so it is helpful to avoid them completely whenever we can.
Bug: 938627
Change-Id: I54494cad9b9aa0090f51674b6b9f56bb3e842f12
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1504102
Commit-Queue: Michael Spang <spang@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Also add shortcuts, so we don't have to look through all the branches
if the patch is based on a common branch (i.e. master, infra/config, lkgr)
Bug: 870279
Change-Id: I625a8481dccac9a475b096b926e6fab7efe676b0
Reviewed-on: https://chromium-review.googlesource.com/1161094
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Abort any cherry-picks before applying the patch, so that if the bots are in a
bad state, we don't fail.
Original change's description:
> Reland "gclient_scm: Use cherry-picking instead of rebasing."
>
> The failures were caused by:
> 1 - When one change (call it #2) has been uploaded on top of another (#1),
> and (#1) has already landed, git cherry-pick complains that the range
> '<merge-base>..<change #2>' contains empty commits, since the contents
> of (#1) are already present in the tree.
> 2 - We did not abort the cherry-picking when 'git cherry-pick' failed,
> so a failure made all further CLs in that bot fail.
>
> This CL fixes it and prevents further regressions.
>
> Original change's description:
> > gclient_scm: Use cherry-picking instead of rebasing.
> >
> > Currently gclient might include extra commits when applying patches.
> > For example, in this case we checkout |patch| and rebase it on top of |base|,
> > thus including an |extra commit| that we shouldn't.
> >
> > o master
> > |
> > . o patch
> > |/
> > o extra commit
> > |
> > o base (what gclient synced src at)
> >
> > This change uses the merge-base between |patch| and |master| to cherry-pick only
> > the changes belonging to the patch.
> >
> > Bug: 850812
> > Change-Id: I138192f96bc62b1bb19b0e1ad952c8f8c67631c4
> > Reviewed-on: https://chromium-review.googlesource.com/1137052
> > Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> > Reviewed-by: Aaron Gable <agable@chromium.org>
>
> Bug: 850812
> Change-Id: I83f38d0a258df3f5cd89e277f0d648badff29a22
> Reviewed-on: https://chromium-review.googlesource.com/1139554
> Reviewed-by: Aaron Gable <agable@chromium.org>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Bug: 850812
Change-Id: Ic65bda67c792bd7af5ec013a62d9615d1498eb3a
Reviewed-on: https://chromium-review.googlesource.com/1142805
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
This reverts commit f9afc77f28.
Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=864301#c10
Original change's description:
> Reland "gclient_scm: Use cherry-picking instead of rebasing."
>
> The failures were caused by:
> 1 - When one change (call it #2) has been uploaded on top of another (#1),
> and (#1) has already landed, git cherry-pick complains that the range
> '<merge-base>..<change #2>' contains empty commits, since the contents
> of (#1) are already present in the tree.
> 2 - We did not abort the cherry-picking when 'git cherry-pick' failed,
> so a failure made all further CLs in that bot fail.
>
> This CL fixes it and prevents further regressions.
>
> Original change's description:
> > gclient_scm: Use cherry-picking instead of rebasing.
> >
> > Currently gclient might include extra commits when applying patches.
> > For example, in this case we checkout |patch| and rebase it on top of |base|,
> > thus including an |extra commit| that we shouldn't.
> >
> > o master
> > |
> > . o patch
> > |/
> > o extra commit
> > |
> > o base (what gclient synced src at)
> >
> > This change uses the merge-base between |patch| and |master| to cherry-pick only
> > the changes belonging to the patch.
> >
> > Bug: 850812
> > Change-Id: I138192f96bc62b1bb19b0e1ad952c8f8c67631c4
> > Reviewed-on: https://chromium-review.googlesource.com/1137052
> > Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> > Reviewed-by: Aaron Gable <agable@chromium.org>
>
> Bug: 850812
> Change-Id: I83f38d0a258df3f5cd89e277f0d648badff29a22
> Reviewed-on: https://chromium-review.googlesource.com/1139554
> Reviewed-by: Aaron Gable <agable@chromium.org>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
TBR=agable@chromium.org,ehmaldonado@chromium.org,jbudorick@chromium.org
Change-Id: I2138757899abd6eb9bece2dac3a25676effafdf3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 850812
Reviewed-on: https://chromium-review.googlesource.com/1142624
Reviewed-by: John Budorick <jbudorick@chromium.org>
Commit-Queue: John Budorick <jbudorick@chromium.org>
The failures were caused by:
1 - When one change (call it #2) has been uploaded on top of another (#1),
and (#1) has already landed, git cherry-pick complains that the range
'<merge-base>..<change #2>' contains empty commits, since the contents
of (#1) are already present in the tree.
2 - We did not abort the cherry-picking when 'git cherry-pick' failed,
so a failure made all further CLs in that bot fail.
This CL fixes it and prevents further regressions.
Original change's description:
> gclient_scm: Use cherry-picking instead of rebasing.
>
> Currently gclient might include extra commits when applying patches.
> For example, in this case we checkout |patch| and rebase it on top of |base|,
> thus including an |extra commit| that we shouldn't.
>
> o master
> |
> . o patch
> |/
> o extra commit
> |
> o base (what gclient synced src at)
>
> This change uses the merge-base between |patch| and |master| to cherry-pick only
> the changes belonging to the patch.
>
> Bug: 850812
> Change-Id: I138192f96bc62b1bb19b0e1ad952c8f8c67631c4
> Reviewed-on: https://chromium-review.googlesource.com/1137052
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Aaron Gable <agable@chromium.org>
Bug: 850812
Change-Id: I83f38d0a258df3f5cd89e277f0d648badff29a22
Reviewed-on: https://chromium-review.googlesource.com/1139554
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
This reverts commit fb78b368de.
Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=864301
Original change's description:
> gclient_scm: Use cherry-picking instead of rebasing.
>
> Currently gclient might include extra commits when applying patches.
> For example, in this case we checkout |patch| and rebase it on top of |base|,
> thus including an |extra commit| that we shouldn't.
>
> o master
> |
> . o patch
> |/
> o extra commit
> |
> o base (what gclient synced src at)
>
> This change uses the merge-base between |patch| and |master| to cherry-pick only
> the changes belonging to the patch.
>
> Bug: 850812
> Change-Id: I138192f96bc62b1bb19b0e1ad952c8f8c67631c4
> Reviewed-on: https://chromium-review.googlesource.com/1137052
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Aaron Gable <agable@chromium.org>
TBR=agable@chromium.org,ehmaldonado@chromium.org
Change-Id: I57299e60e58eac5656dc88937c622d0d14c4ba37
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 850812
Reviewed-on: https://chromium-review.googlesource.com/1139553
Reviewed-by: John Budorick <jbudorick@chromium.org>
Commit-Queue: John Budorick <jbudorick@chromium.org>
Currently gclient might include extra commits when applying patches.
For example, in this case we checkout |patch| and rebase it on top of |base|,
thus including an |extra commit| that we shouldn't.
o master
|
. o patch
|/
o extra commit
|
o base (what gclient synced src at)
This change uses the merge-base between |patch| and |master| to cherry-pick only
the changes belonging to the patch.
Bug: 850812
Change-Id: I138192f96bc62b1bb19b0e1ad952c8f8c67631c4
Reviewed-on: https://chromium-review.googlesource.com/1137052
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
The update_scripts step doesn't set '--reset'
Additionally, if there was no fetch config, don't fail trying to unset it.
Tbr: agable@chromium.org
No-Try: True
Bug: 862547
Change-Id: I90886ca7d1dd20ae59b378a5998de47dc67c60f9
Reviewed-on: https://chromium-review.googlesource.com/1137693
Commit-Queue: Edward Lesmes <ehmaldonado@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>
This CL makes a couple changes:
* The goal here is to be able to specify git cache entirely from the
environment variable $GIT_CACHE_PATH and not require special treatment from
bot_update. Eventually this will be specified at the swarming task level
instead of in the recipe (i.e. "cached git" will eventually be an
implementation detail of git on the bots and completely transparent to
all other software).
* Removal of the general --cache-dir option from gclient. This option was
error-prone; it doesn't actually make sense to configure this on
a per-invocation basis. The sole exception was `gclient config`, which
now allows this option to be set directly.
* Consolidation of GitWrapper.cache_dir and GitWrapper._GetMirror; previously
these two things could disagree, leading to weird intermediate states. Now
they're the same value.
R=agable@chromium.org, ehmaldonado@chromium.org, tandrii@chromium.org
Bug: 823434
Change-Id: I14adc7619b5fc10768ce32be2651c6215ba94aff
Reviewed-on: https://chromium-review.googlesource.com/1105473
Reviewed-by: Aaron Gable <agable@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
This reverts commit c912114140.
Reason for revert: broke patch application on infra/config https://crbug.com/853032
Original change's description:
> gclient_scm: Use cherry-picking instead of rebasing.
>
> We have a problem when in this situation, we checkout |patch| and rebase it on
> top of |base|, thus including an |extra commit| that we shouldn't.
>
> o master
> |
> . o patch
> |/
> o extra commit
> |
> o base (what gclient synced src at)
>
> This does merge-base between |patch| and |master|, and cherry-picks only the
> changes belonging to the patch.
>
> Bug: 850812
> Change-Id: Id09ae1682e53b69ed49b2fb649310de6a6a8a29e
> Reviewed-on: https://chromium-review.googlesource.com/1098228
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Aaron Gable <agable@chromium.org>
TBR=agable@chromium.org,ehmaldonado@chromium.org
Change-Id: Ib3feeee2f44f5441713383f1dbf08db16fae4717
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 850812, 853032
Reviewed-on: https://chromium-review.googlesource.com/1101977
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
We have a problem when in this situation, we checkout |patch| and rebase it on
top of |base|, thus including an |extra commit| that we shouldn't.
o master
|
. o patch
|/
o extra commit
|
o base (what gclient synced src at)
This does merge-base between |patch| and |master|, and cherry-picks only the
changes belonging to the patch.
Bug: 850812
Change-Id: Id09ae1682e53b69ed49b2fb649310de6a6a8a29e
Reviewed-on: https://chromium-review.googlesource.com/1098228
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
This is a reland of e877b1776a
Original change's description:
> gclient: Get rid of parsed_url.
>
> There is no reason I can see to set parsed_url so late.
> Also, the tests are misleading, since relative URLs don't behave the way
> the tests led you to believe.
>
> Bug: 839925
> Change-Id: I08d92b7b7847bdc406f003d4a4139d968cc662b1
> Reviewed-on: https://chromium-review.googlesource.com/1047797
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
TBR=agable@chromium.org
Bug: 839925
Change-Id: I9200ec5fbe7289022e9754f0c78676dc931fcaeb
Reviewed-on: https://chromium-review.googlesource.com/1054567
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: John Budorick <jbudorick@chromium.org>
Suspected of breaking the world.
This reverts commit e877b1776a.
TBR=ehmaldonado@chromium.org,tandrii@chromium.org
Bug: 841936
Change-Id: Iad2b55a2235d8d0b1a3d7681cbd577f795cb89dd
Reviewed-on: https://chromium-review.googlesource.com/1054440
Reviewed-by: John Budorick <jbudorick@chromium.org>
Commit-Queue: John Budorick <jbudorick@chromium.org>
There is no reason I can see to set parsed_url so late.
Also, the tests are misleading, since relative URLs don't behave the way
the tests led you to believe.
Bug: 839925
Change-Id: I08d92b7b7847bdc406f003d4a4139d968cc662b1
Reviewed-on: https://chromium-review.googlesource.com/1047797
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
So we know why did git fail on the Chromium Windows trybots.
R=agable@chromium.org
Bug: 643346
Change-Id: Iac0abd9202fb56fbed6f3edf382b755e96fed3bf
Reviewed-on: https://chromium-review.googlesource.com/1031128
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
file_list can be none if gclient runs with --nohooks.
Fix apply_patch_ref so that it doesn't try to update file_list when it is
None.
TBR=agable@chromium.org
Bug: 643346
Change-Id: If00547da004415edfe68196a44cbda753b4db017
Reviewed-on: https://chromium-review.googlesource.com/989279
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Mimics bot_update's functionality to apply gerrit refs in gclient
via --gerrit-ref flags.
When the patch fails to apply, gclient sync will return exit code 2.
The idea is to move this logic from bot_update to gclient sync to
deal when patches for projects like ANGLE are tried on Chromium bots.
This way the patch is applied before recursively parsing and syncing
ANGLE’s DEPS.chromium file, which doesn't currently happen.
Bug: 643346
Change-Id: I7e2018b3c393a5ac9852b8c3611f906977eeeb18
Reviewed-on: https://chromium-review.googlesource.com/961605
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
gclient previously used a CIPD root per DEPS file. This didn't work
in cases in which a DEPS file wanted to specify a CIPD package outside
of its directory hierarchy, though, as is the case with buildspecs.
Bug: 755920
Change-Id: I0d6c3db567f17f9171c0feaaf9ed6bc64db22757
Reviewed-on: https://chromium-review.googlesource.com/955933
Commit-Queue: John Budorick <jbudorick@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
Reviewed-by: Michael Moss <mmoss@chromium.org>
When someone runs "gclient diff", they expect to be diffing their
local state against the state of a clean gclient checkout.
Up until now, "gclient diff" has been doing... not that. It's been
assuming that the sha1 in DEPS is approximately the head of the
remote's master branch, finding the merge-base between the local
content and that remote master, and diffing against that merge-base.
This makes basically no sense in the context of gclient. With
gclient, we already know exactly what should be checked out: it's
whatever is in DEPS.
This CL updates the behavior of "gclient diff" to do the right thing.
Bug: 731701
Change-Id: I23a43cbc0d6bc7772495097ff615d4d070f5ad19
Reviewed-on: https://chromium-review.googlesource.com/914717
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
This will allow us to show the progress when cloning a new repo when running
commands like gclient sync.
R=agable@chromium.org
Bug: 722686
Change-Id: I268cba343ea4c3c024292c9341d5009aa112b184
Reviewed-on: https://chromium-review.googlesource.com/890524
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>