Commit Graph

8 Commits (main)

Author SHA1 Message Date
Robert Iannucci 7762989876 [scm_mock] Expose mocking of system config layer.
R=ayatane, yiwzhang

Change-Id: I15a48c6af54d2b047b085abc729d2849759816d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5762792
Reviewed-by: Allen Li <ayatane@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
7 months ago
Allen Li 78d32ff67a [scm_mock] Add global_state param to mock
Change-Id: If0b35ead4804c17d8ec8acdf7bff96cfe73349b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5773569
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
7 months ago
Allen Li 65acc1df40 [scm_mock] Make params keyword only
None of the optional params are used currently, so make them keyword
to ease future changes, like adding the global_config in the next CL.

Change-Id: I213cccb945c969b4211adad8ccd9170ef6209e0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5773568
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
Allen Li a1c9f5ecef [scm_mock] Fix types
Change-Id: I3d1dba2d8c3adc5ef4cf475514174b1d3f817010
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5773567
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Allen Li <ayatane@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
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>
8 months ago