This is achieved by using `lock_repo`
context manager that can be used in a recursive depth
that only resets stages when it has left any lock_repo
blocks.
Also added some ui related tests for the status which I found
missing
Before, we used to set it during initialization. But this
made it hard to test using capsys as capsys changes the
reference to sys.stdout and sys.stderr with the mocked one
during the test. But since we are using dvc.ui globally and
setting it to a real sys.stdout and sys.stderr before capsys
comes into effect, testing was not possible with it.
Now, by using property hack, we will be using the values of
sys.stdout and sys.stderr during the time of write, so the mocking
would work and would be easier to test.
This commit fixes 3 things:
1. The path printed on the terminal is properly is quoted. This was
problematic when the output is piped to `xdg-open` if the path contained
spaces or quotes or special characters.
2. The path is resolved. This is not an issue at all, but makes the
output nicer.
3. The path with which the browser is opened with uses relative path.
This is done to solve issue in WSL, that the absolute path is not
accessible outside the WSL for host programs as the linux filesystem
is available on `/wsl$` path.
* diff: clear calculated renamed files from inverted hashmap
We were trying to reuse the first encounter of file from inverted hashmap again and again, which was throwing ValueError
* refactor
* remove ordering
* add tests
* stage:list: update output and help text
* Replaced 'Produces' with 'Outputs'
* Replaced 'Stage depends on' with just 'Depends on'
* Changes help text of --names-only and --fail
* Update dvc/command/stage.py
Co-authored-by: Dave Berenbaum <[email protected]>
* s/Generates/Reports
Co-authored-by: Dave Berenbaum <[email protected]>
* don't allow loading stages without `cmd`
This was loosened when introducing parametrization.
But, `foreach`..`do` should be considered first
before stage's regular structure. And, cmd is made
required (as it should have been)
Related: #5371, #5370, #5312
* fix schema
When I opened it, I got confused for a second and had to double-check if it was really empty.
The empty file gives a false assurance. We do need to add one, which I'll add later, but for now,
we better remove it.
This happens because KeyError quotes the error message.
We'd still like to keep StageNotFound being a KeyError
semantics, but workaround the __str__ implementation.
Mypy was having some problem with the previous `__str__`
override.
Looking at the log is confusing, as the version is stuck in `1.11.0` whereas the recent one is `1.11.10`.
As the updater is also dependent on that version, it prints an ugly update message while running too.
https://github.com/iterative/dvc/issues/5023#issuecomment-758450519
* scm: implement gitignore; use `pygit2` backend
* Add is_ignored implementation on `pygit2` and `gitpython` backends.
* Also implement `._reset()` on `repo.scm` which is most of the changes.
* fix tests
* use _backend_func
* minor fixups
* Moved exception handling imports wherever they occur
* Move dvc.tree and dvc.external_repo imports to it's
nearest use, as it is expensive for `--version`.
* Move analytics import to when it's used
* Move format_link to place where error occurs
A great benefit to this is that, if the dvc.yaml file
is never interpolated, the parser is never built, which
reduces the gap even further between 1.0 and 2.0 files
I had to keep providing default value before when profiling
simple functions as an API. I added a default now, and
also made `debugtools` customizable so that you could
edit the code to, for example, have `pdb` enabled by default.
* Add pyinstrument: a statistical profiler
It is easier than cprofile, in that it can show stacktrace
of where things are slow.
Also refactored/moved debugging related utils to a separate
module
* use ipdb first, then fallback to pdb
* use ipdb first, then fallback to pdb
* Cleanup log messages when loading stages
1. Simplified callback stage debug message
2. Reduced no lock entry message to trace
If lockfile does not have some entry, it will simply complain
that lockfile is not uptodate once.
If there is no lockfile or empty lockfile, it will complain that
lockfile not found.
3. Annoying parametrization related wdir-interpolated debug message
removed.
* Update dvc/stage/__init__.py
* black
* Skip paramdependency for vars
Previously, `configs` which was a list of PathInfo was being used
to check if the `vars` should be skipped or not.
But, the file is stored as a string that made that check redundant
which might have caused #5117 as they were being stored twice,
once as a expanded paramdependency and next as a flattened dict
from vars, which later during `flatten`, it might have panicked
from that duplication.
* Use defaultdict
* change add_vars to collect_vars
minor refactors, code comments
Rename interim to definitions
provide location of entry during init for definition
small fixups to set_temporarily
Refactor loop to use dict comprehension
Provide same interface for definitions
Make it work for composite lists
Check for sequence rather than a list
refactor tests
Fixes#4955Fixes#4957Fixes#4963
We try to optimize `tree.exists` calls and probably few others
in that they either look directly into the workspace or,
to the cache without running graph checks. It does not seem
to be possible just to run graph checks on `find_outs_by_path`
due to those optimizations.
So, that's why, the `collect` also does a graph check for this
reason.
Fixes#5027Fixes#4010
* run/repro: show command on dry-run, add ">" to script output
This rollbacks the earlier commit to not show command during
the dry-run, and also prepends ">" in the command script
instead of "$" sign.
* fix tests
* repro: support regex/foreach-group to run at once
Fixes#4912Fixes#4886Fixes#4958
* Use `tree.isdir` rather than `os.path.isdir`
* Use glob rather than regex
* Update dvc/command/repro.py
* s/regex/glob
* disable glob on `collect_granular`
There's no need for a glob here
* add tests for `collect` and `collect_granular`
* s3: use mocked s3 instead of the real one
Not removing the fixtures just yet
* Update moto
Tests was failing, because of a change in `responses` package, which
`moto` was mocking. This was fixed on
https://github.com/spulec/moto/pull/3466 which is only available on
`dev122` release.
* Use mocked s3 in checkout tests
`Azure` tests are flaky for some reason. When I investigated one
of the job [1], something seemed wrong with the Azurite or
the client lib.
On `AzureTree.blob_service`, we do the following to check if the
container exists:
```python
try:
container_client.get_container_properties()
except ResourceNotFoundError:
container_client.create_container()
```
When looking at the test log, I found out that the
`get_container_properties` was failing with
`ErrorCode:ContainerNotFound` whereas `create_container`
successively was failing with `ErrorCode:ContainerAlreadyExists`.
`create_container` is correct, but `get_container_properties` is
incorrect, as many of the Azure tests have already run successfully
before.
So, either the Azurite has/had bug or the client lib has a bug.
Anyway, we'll find out after updating the Azurite.
[1]: https://github.com/iterative/dvc/runs/1448864706#step:7:4029