Commit Graph

239 Commits (main)

Author SHA1 Message Date
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
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
Allen Li b471d6f709 [scm] Fix type annotations
Change-Id: If18010e076b4b9bac540ff03daefc7d312713778
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5867128
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
5 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
Allen Li 39ca85acf5 [scm] Add lock around all set calls
Bug: b/356935829
Change-Id: I886d20b71af26efd828d18cb1b01f1271f42d053
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5786165
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
7 months ago
Allen Li 9ddf1780c6 [scm] Add global config lock
Otherwise, when this is run concurrently by gclient, it causes race conflicts.

Bug: b/356935829
Change-Id: Ic7697415f7dbb82971be511c5058206f9195e896
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5784434
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
7 months ago
Robert Iannucci 10d7ebda04 [scm_mock] Remove unused `config` parameter.
R=ayatane, yiwzhang

Change-Id: I843a967249d9f1f967c94af91f98c3885b319d01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5763524
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Allen Li <ayatane@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
7 months ago
Robert Iannucci 283661a975 [scm] Add key canonicalization to scm's CachedGitConfigState.
This will allow `git cl` to be much more consistent with regards to
setting and reading git config key values in both production and
testing.

R=ayatane, yiwzhang

Change-Id: I2f1f1c5c6aaab12e2e9dbcf36c181244706cd4a8
Bug: 357688295
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5762199
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
7 months ago
Robert Iannucci a3fb9bad66 [scm] Mock global git config scope globally.
This will be useful for writing tests which rely on shared 'global'
config between different working directories.

This also adds support for mocking 'system' (global, immutable) and
'workspace' (local, mutable). The workspace scope I think is a bit iffy
though, given how `git cl` is actually built - currently scm.GIT doesn't
really know about clone vs. workspace, and afaik no config adjustements
actually apply to the workspace scope.

Adds tests for mocked git config implementation, including bug fixes
to the current implementation revealed by the tests.

R=ayatane, yiwzhang

Change-Id: Ia56d2a81d8df6ae75d9f8d0497be0d67bdc03651
Bug: 355505750
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5759163
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
7 months ago
Allen Li 536cf08520 [scm] Add type annotations to GetBranchConfig
Bug: b/351071334
Change-Id: Ide215e4b73806e8b198104b50fc8b0cb6f5bf8e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5754252
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
7 months ago
Allen Li a6cd7589e9 [scm] Fix type errors
Bug: b/351071334
Change-Id: I43855632ac36a06569047d688fe710b83df4e707
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5751005
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
7 months ago
Robert Iannucci 126b52e8e5 [scm.py] Fix error with missing_ok in GitConfig.
Previously there was an error where you could have:

  global: {"key": ["something"]}
  local: {}

And called SetConfig("key", None, missing_ok=False) - this would end
up raising CalledProcessError(returncode=5) because the caching
layer would see that "key" was not missing, then call into the
storage layer which would do `git config --local ...` which was
missing "key" (and therefore fail).

R=ayatane, yiwzhang

Change-Id: Idc9dc63a1b1c0a4a203c403dbb3c2ea521099b26
Bug: 342644760
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5744333
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
7 months ago
Allen Li 9ad0a20472 [scm] Add type annotations
Otherwise pyright assumes a ton of values here are bytes

Bug: b/351071334
Change-Id: Ib360c27f6f82d35bcf885c5918b6def4ca26825f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5744594
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
7 months ago
Allen Li 03434d28f4 [git_auth] Add git_auth tests
Bug: b/351024645
Change-Id: Ie8808de63d09c4a89187f81a5782e09fe73c8b0f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5698748
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
7 months ago
Robert Iannucci a6502426b5 [git_cl] Remove uses of RunGit which interact with git config.
The previous interactions were incorrect w.r.t. scm.GIT's config
cache.

This moves depot_tools towards having one fewer git wrapper
(converging towards scm.GIT).

R=ayatane, yiwzhang@google.com

Change-Id: I507628b53f6a87a1eecbbe3e1e27c1eb6af3b878
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5648617
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
7 months ago
Robert Iannucci 14ddf6e8ba [scm] Refactor git config state to be fully mock-able.
Previously little bits of the scm.GIT were mocked (like SetConfig,
and GetConfig, but not the other config related methods).

This changes things so that the git config state is a class whose
logic is shared between prod and test, with a 'real' and 'test'
implementation which know how to load and save configuration at
a low level.

R=yiwzhang

Change-Id: I1dc11b550908862607ea539de7fa60fbce30e700
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5660891
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Allen Li <ayatane@chromium.org>
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
7 months ago
Allen Li 4f1cfb994f [scm] Add append to SetConfig
Bug: b/348024314
Change-Id: Ib2066594806ffdf5f6941468e91a9ad7b8a02bef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5655832
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
8 months ago
Allen Li 7a9bffe87f [scm] Sort SetConfig keyword arguments
Bug: b/348024314
Change-Id: I84cc44b41fbfd90f7b6bd58b6128bc82a1706322
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5655831
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
8 months ago
Robert Iannucci 821e028ffd [git_cl] Add missing_ok to SetConfig
Split from https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5648617

Change-Id: Id33b509937c4eb9a95f5f603593a79a1c5a3c109
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5651982
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
8 months ago
Gavin Mak 8ac3425344 Create scm.DIFF.GetAllFiles
For a ProvidedDiffChange, the AllFiles method naively returns all files
with rglob("*"). The returned list includes files in nested submodules.
This does not match the behavior of GitChange's AllFiles which uses
git ls-files to find all files.

Implement a new SCM that stops iterating recursively when it
sees a submodule from .gitmodules in the repo root.

Bug: b/323243527
Change-Id: I170d0f1bc4a838acea04779dee3df7fca0bce359
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5648616
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
8 months ago
Allen Li 39e7285c30 [scm] Fix docstring reference to `modify_all`
Bug: b/348024314
Change-Id: Ic5609fe286e8c016862aa38dbb0f17c9b52e7941
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5641260
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
8 months ago
Bruce Dawson 062ecac69f Use git_common to call git
In preparation for some Windows optimizations to how git_common calls
git it is important to use git_common more widely, specifically from
scm.py and gclient_scm.py. This change updates scm.py and gclient_scm.py
and updates the associated tests:

Test command lines used when updating the tests include:
vpython3 tests/gclient_scm_test.py ManagedGitWrapperTestCaseMock.testUpdateConflict

vpython3 tests/gclient_scm_test.py GerritChangesTest.testRecoversAfterPatchFailure

vpython3 tests/gerrit_util_test.py CookiesAuthenticatorTest.testGetGitcookiesPath

Bug: 332982922
Change-Id: I7aacb110b2888c164259815385cd77e26942adc7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5478509
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
9 months ago
Josip Sokcevic 8281847e05 [scm] Run remote set-head if symbolic-ref fails
If symbolic-ref remote HEAD is not available, we skip setting it and
query remote Git using ls-remote. Such information is not stored, and
gclient will need to repeat it on the next invocation.

Instead, we can call set-head on symbolic-ref failure. While that's
slower operation than ls-remote, it saved in internal Git database and
can be reused on next gclient invocation.

We may be okay with hardcoding 'main' as default remote branch today,
but it's possible that some projects still use old default.

R=gavinmak@google.com

Change-Id: Ic4c826b888d96e367039bfc4b9bd2ba0d8b58b52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5492789
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
10 months ago
Aravind Vasudevan 7a7c5e3adc [scm] Remove unused methods
Bug: 1475776
Change-Id: I75f8358f5ed475c180b60cfed825e66e4733f8f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5422043
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Auto-Submit: Aravind Vasudevan <aravindvasudev@google.com>
11 months ago
Aravind Vasudevan 6c92a665e1 [scm] Clean up unused functions
This change removes some dead code from back in the SVN days. `GetCasedPath()`[1] and `GenFakeDiff()`[2] were a part of the SVN class from when scm.py used to support two scm. `only_int()` was used within `AssertVersion()` which was removed[3]. I could not find any usage for `ValidateEmail()` even within the old commits[4].

[1] https://codereview.chromium.org/538009
[2] https://codereview.chromium.org/1965001
[3] https://crrev.com/c/2116938
[4] https://codereview.chromium.org/501166

Bug: 1475776
Change-Id: I730f0d994d8027bd67587fd16ad1e502bdfb94fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5279813
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
1 year ago
Aravind Vasudevan 9f9bab25da Reland "Update gclient to use git config caching"
This reverts commit 3569608028.

Reason for revert: This includes a fix for crbug.com/324358728.

The rebase-update command has logic which tries to specifically set a key to an empty string and this has been intentionally set this way[1]. The new SetConfig implementation does treats empty string as None and hence tries to unset the config, resulting in error code 5. The patchset 2 fixes this bug and adds a test to ensure SetConfig can set an empty string to be backward compatible.

[1] https://codereview.chromium.org/228353003

Original change's description:
> Revert "Update gclient to use git config caching"
>
> This reverts commit 3edda8d185.
>
> Reason for revert: Breaks rebase-update; crbug.com/324358728
>
> Original change's description:
> > Update gclient to use git config caching
> >
> > This change updates all the modules used by gclient to use `scm.GIT` for git config calls over directly invoking the subprocess.
> >
> > This change currently doesn't modify git_cache since the config reads and writes within it are done on bare repository. A follow-up CL will update git_cache.
> >
> > A follow-up CL will also update git_cl and git_map_branches since they have shown performance improvements too: https://crrev.com/c/4697786.
> >
> > Benchmarking
> > ============
> > With chromium/src as the baseline super project, this change reduces about 380 git config calls out of 507 total calls on cache hits during no-op. The below numbers are benchmarked with `update_depot_tools` turned off.
> >
> > Windows Benchmark
> > =================
> > Baseline (gpaste/6360045736951808): ~1min 12 sec.
> > With Caching (gpaste/6480065209040896): ~1min 3sec.
> > ~12.5% decrease in gclient sync noop runtime.
> >
> > Linux Benchmark
> > ===============
> > Baseline (gpaste/4730436763254784): ~3.739 sec.
> > With Caching (gpaste/4849870978940928): ~3.534 sec.
> > ~5.5% decrease in gclient sync noop runtime.
> >
> > Bug: 1501984
> > Change-Id: Ib48df2d26a0c742a9b555a1e2ed6366221c7db17
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5252498
> > Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
> > Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
>
> Bug: 1501984
> Change-Id: I4a603238d9ed43edafc8e574493800670520a1d9
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5279198
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>

Bug: 1501984
Change-Id: I405abc16c2ef6f0689031c82c61af71aad302122
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5280779
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
1 year ago
Aravind Vasudevan 05048d2cb0 [scm] Fix _load_config to support multi-line
Bug: 1501984, 324449654
Change-Id: Ibe64317e92731735f4ab23c8491eb42e960f9432
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5279207
Auto-Submit: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
1 year ago
Aravind Vasudevan 0784439733 [scm] Implement caching for git config
Bug: 1501984
Change-Id: I751a1f08eb9ae7141b8b4e1517731ed553328c03
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5252497
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Joanna Wang b25b4680f2 Make scm.ListSubmodules return paths for the OS.
Bug: 1522071
Change-Id: Ifbdfc456fbfb0a74d68c7109aa8bd3deae612e39
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5236697
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
1 year ago
Joanna Wang 46cb7d0aca Add AffectedSubmodules() to presubmit change.
+ Change scm GetAllFiles back to returning all files
  + should be safe to do since it's only used by presubmit code
+  add ignore_submodules option to CaptureStatus
  + It's used by other parts of depot_tools code
+ Add AffectedSubmodules to return submodules only
+ AffectedFiles still only returns non-submodule files.

Bug: 1475770
Change-Id: I457ad96099fb20eff4cc1a4fc84f59e7ae707abe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5216005
Auto-Submit: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Joanna Wang 9a16009d09 Fix ListSubmodule git call.
Bug: 1475770

Change-Id: I26f758fb3cbd9ac217e6e0abb719e13d21feb61f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5214266
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Joanna Wang 5400d9ef5a Add ListSubmodules helper for presubmits.
We need this for this presubmit otherwise we cannot remove git deps from DEPS: http://shortn/_P7Xkt33SRx
We will also be able to reuse this and replace: http://shortn/_WYBIUC9pa4

Bug: 1475770
Change-Id: I4cea689d130df77c344d82d4d8f9db02d42cd847
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5209098
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Gavin Mak edba22d4eb Fix multiline comment formatting
Many incorrectly formatted comments exist from the switch to
4 space indent: https://crrev.com/c/4836379

Bug: 1514505
Change-Id: I6366f9da812919bd35b999f18fa8a49b7a66c09b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5153633
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Josip Sokcevic 31a590e0cd [scm] Cache ResolveCommit call
The cache won't be used if ResolveCommit throws an exception or when
non-sha1 is used.

This optimization saves about 7% of overall gclient sync on
chromium/src.

R=gavinmak@google.com

Change-Id: I9c36d937dc7b8553818888e2e9c4eecd029a978c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5147496
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Josip Sokcevic 4cf6518959 scm: Remove usage of distutil
The package is deprecated and will be removed in py 3.12.

R=ddoman@google.com

Bug: 1500415
Change-Id: Ia130c556ad3f2135fac4a9b1d9bb4ecc088cfe9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5030818
Reviewed-by: Scott Lee <ddoman@chromium.org>
Reviewed-by: Jonathan Nieder <jrn@google.com>
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Scott Lee <ddoman@chromium.org>
Commit-Queue: Jonathan Nieder <jrn@google.com>
1 year ago
Joanna Wang 60adf7b6d9 sync: Ensure child dependencies are always removed first.
Fixed: chromium:1454643, chromium:1486677
Change-Id: I3f8f5f9a2e2419830e94fa1419292717820830c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4914238
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Mike Frysinger 124bb8e53c switch to 4 space indent
Leave the recipes/ code at 2 space to match the rest of the recipes
project in other repos.

Reformatted using:
files=( $(
	git ls-tree -r --name-only HEAD | \
		grep -Ev -e '^(third_party|recipes)/' | \
		grep '\.py$';
	git grep -l '#!/usr/bin/env.*python' | grep -v '\.py$'
) )
parallel ./yapf -i -- "${files[@]}"
~/chromiumos/chromite/contrib/reflow_overlong_comments "${files[@]}"

The files that still had strings that were too long were manually
reformatted because they were easy and only a few issues.
autoninja.py
clang_format.py
download_from_google_storage.py
fix_encoding.py
gclient_utils.py
git_cache.py
git_common.py
git_map_branches.py
git_reparent_branch.py
gn.py
my_activity.py
owners_finder.py
presubmit_canned_checks.py
reclient_helper.py
reclientreport.py
roll_dep.py
rustfmt.py
siso.py
split_cl.py
subcommand.py
subprocess2.py
swift_format.py
upload_to_google_storage.py

These files still had lines (strings) that were too long, so the pylint
warnings were suppressed with a TODO.
auth.py
gclient.py
gclient_eval.py
gclient_paths.py
gclient_scm.py
gerrit_util.py
git_cl.py
presubmit_canned_checks.py
presubmit_support.py
scm.py

Change-Id: Ia6535c4f2c48d46b589ec1e791dde6c6b2ea858f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4836379
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Joanna Wang e36c6bba14 Make gclient getdep work with submodules.
Bug: 1475770
Change-Id: I341910e75195d87b91defd98f2c6ba25262995b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4828423
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
2 years ago
Josip Sokcevic 2d5c673fdb [scm] Fix list all files when filename has space
Off by one - we should have 4 parts, so we need maxsplit=3.

R=aravindvasudev@google.com, jojwang

Fixed: 1474283
Change-Id: I13b568feb8ee2aa307a2267c43765c1749b77c90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4799773
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
2 years ago
Josip Sokcevic 49b24e41da [scm] Remove gitlinks from list of affected files
Presubmit checks expect files to be actual files. Gitlink entries are
directories (if initialized), and that breaks various existing tests.

Since we don't run presubmits from git dependencies, it's safe to ignore
any updates to gitlinks and omit them from All Files.

R=jojwang

Change-Id: I670e5caef4067a0203578e9be50c4fabf23b3153
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4795116
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
2 years ago
Josip Sokcevic 7958e30579 Revert "Move scm.py to lib/"
This reverts commit 688adfe276.

Reason for revert: breaks try jobs

Original change's description:
> Move scm.py to lib/
>
> It belongs there.
>
> Change-Id: I286b50c43c587c39557fc508175efbd4b0f51d51
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4289680
> Reviewed-by: Joanna Wang <jojwang@chromium.org>
> Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>

Change-Id: I662907b8bb4b2e7db82409bd34c3905db7961a12
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4300261
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2 years ago
Josip Sokcevic 688adfe276 Move scm.py to lib/
It belongs there.

Change-Id: I286b50c43c587c39557fc508175efbd4b0f51d51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4289680
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Joanna Wang b46232e729 [stacked_changes] Add Changelist._PrepareChange() common func called before creating commits.
Bug: b/265929888
Change-Id: I18a0c5ba6757aef91e750b9703079c96b090dc1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4178920
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Joanna Wang ab9c6ba27f Make cwd optional for scm.IsAncestor()
Bug:b/265929888
Change-Id: I9f25cd26eaf2d708ce3ac7d86503bb2c295c8406
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4178351
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
2 years ago
Aravind Vasudevan c5f0cbb865 Use pylint 2.7 for depot_tools
This includes a few fixes for specific errors, and disables several new
warnings introduced in this version, in order to allow for an incremental migration.

Bug:1262286
Change-Id: I4b8f8fc521386419a3121bbb07edc8ac83170a94
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3413679
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
3 years ago
Josip Sokcevic 42c5bbbc96 Revert "Use pylint 2.7 for depot_tools"
This reverts commit 22bf605bb6.

Reason for revert: breaks gclient sync

Original change's description:
> Use pylint 2.7 for depot_tools
>
> This includes a few fixes for specific errors, and disables several new
> warnings introduced in this version, in order to allow for an incremental migration.
>
> Bug:1262286
> Change-Id: Ie97d686748c9c952e87718a65f401c5f6f80a5c9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3400616
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>

Bug: 1262286
Change-Id: Ieb946073c7886c7bf056ce843a5a48e82becf7a5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3413672
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
3 years ago
Aravind Vasudevan 22bf605bb6 Use pylint 2.7 for depot_tools
This includes a few fixes for specific errors, and disables several new
warnings introduced in this version, in order to allow for an incremental migration.

Bug:1262286
Change-Id: Ie97d686748c9c952e87718a65f401c5f6f80a5c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3400616
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
3 years ago
Josip Sokcevic e1482c5548 Refresh remote HEAD if matches legacy default
If remote HEAD returns legacy default branch, refresh HEAD by running
set-head to check if there are any changes.

R=gavinmak@google.com

Change-Id: I5891a899b512e81fccfb086a056d497c906df4b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3152593
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
4 years ago