* Prioritize DVC_SITE_CACHE_DIR over core.site_cache_dir
* Add tests for proper prioritization of env var and config
* Tests require python-3.9 compatible typing, use Optional
* Remove comment
* Fixup
* DVC_SITE_CACHE_DIR must be sent first, deal with platformdirs afterwards
* Test should check default behaviour when no env var is set
* Add test: site_cache_dir() must return the env var if set
Clear logs before assertions so that logs from other tests do not interfere with the test.
Some destructors may also run in between due to GC, so hopefully this will fix that issue too,
or reduce the chances of it happening.
See
https://github.com/iterative/dvc/actions/runs/14873217814/job/41775314725#step:6:97.
```console
> assert first(caplog.messages) == expected_message
E assert 'RC: discarding all clients' == "Output 'path... 'stage.dvc'."
E
E + RC: discarding all clients
E - Output 'path'(stage: 'stage.dvc') is missing version info. Cache for it will not be collected. Use `dvc repro` to get your pipeline up to date.
E - You can also use `dvc commit stage.dvc` to associate existing 'path' with stage: 'stage.dvc'.
```
This `_get_remote_config()` should use `uninitialized=True` so that it supports
more broader kinds of broken/partially-initialized repositories, including some that have
`.dvc` directory missing, or `.git` directory missing.
This partially reverts #10719. #10608 is also fixed, and no longer requires `core.no_scm` to be passed.
This was already supported by `dvc.api.get_url` as it uses `uninitialized=True`, but this was not respected
in `_get_remote_config()` where it would fail before.
That said, this whole `open_repo`/`_get_remote_config` is terribly broken. For one, it is opening
a local repository, and forcing it's remote config to a repository opened with `Repo(rev=...)`,
where the config may be different.
* Forward args to _get_remote_config and honour core/no_scm if present
* Pass full config, except cache, to Repo()
* Avoid modifying original kwargs contents
* Simplify if config
* Add test
* Relax error matching.. .. Avoid windows vs unix paths
* Update dvc/repo/open_repo.py
---------
Co-authored-by: skshetry <[email protected]>
* remote: show default when run "dvc remote list"
Fixes#10708
* Indent other remotes if there is a default remote
Now regardless of whether there is a default remote or not, all remotes are equally indented
* stricter test for listing remotes shows default
* Rewrite dvc remote list implemetation
- Default remote is indicated at end of the output and colored green
- Remotes no longer reordered to show default first
- Test updated to reflect changes and remove need for function escape_ansi.
---------
Co-authored-by: RMCrean <[email protected]>
python/cpython#113829 changed `os.path.isabs` on Windows to not consider a path starting a single backslash to be an absolute path.
We do a lot of naive `posixpath` to `ntpath` conversions, and it broke DVC in multiple places. DVC is likely broken in many other places, and these bugs are difficult to identify.
In this commit, I have tried to fix in the places where the tests failed. And mostly by trying to imitate pre-3.13 behaviour.
Some of the changes may not be correct but keeps the old behaviour in place.
Also re-enabled the CI for all Python versions supported for Windows.
* fixed a bug where using both `--queue` and `-A` would yield a "removed" list without the queued experiments
* added a test to validate the fix
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* clearer name for test
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add keep_selected parameter, and corresponding code to keep only the selected exps (and remove all the other ones)
* test keep_selected_by_name
* test keep_selected_by_rev
* test keep_selected multiple, by name
* test keep all by name
* test keep by rev, with num=2
* added option to cli
* refactoring to meet pr needs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed test_experiments to add keep_selected=False to remove tests
* rename parameter to match cli option
* follow the normal path, then invert the selection before removing
* fixed tests for list ordering + fixed test with non existent name, it didn't make sense to delete everything if an exp name did not exist
* changed cli option comment
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed typing issue
* updated parameter name
* removed handling queued experiments (since --queue would remove them all)
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* code simplification, added __eq__ and __hash__ to be able to compare ExpRefs, updated and parametrized tests.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed linting issues
* - --keep and --queue together raise an InvalidArgumentError
- added a test to check if the error is raised
- fixed CLI message
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* re-run gh tests. Some tests which did not involve my changes started failing while they were passing fine before.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* save import hash info to state
* clean up path handling
* avoid walking
* tests: do not use as_posix to check for output
---------
Co-authored-by: Saugat Pachhai (सौगात) <[email protected]>