* dvc: refactor config
Advantages:
- read like a dict
- modify as a dict for testing or manipulation purposes
- wrap modifications into context manager to save them:
with config.edit("local") as conf:
conf["core"]["remote"] = "new-default"
Design decisions:
- dropped string constants
- remote sections are parsed into a simple subdict upon load
- remote config schema is now defined by url scheme
- relative paths are handled transparently upon load/save
- user config and remote manipulations are moved to commands
- same dev manipulations are done by simply modifying a config dict
* test: do not set cache.type for remotes that doesn't support it
* dvc: fix windows absolute paths validation in config
* test: fix windows separate drive test
* dvc: stylistic fixes in config
* erepo: cache all read only external repos by hexsha
So we have 3 things cached now separately:
- clean clones, to not ask for creds repatedly
- cache dirs, also shared between erepos with same origin
- checked out clones if they are read only, addressed by (url, hexsha)
Several additions to `Git` along the way:
- Git.is_sha() static method
- .pull() and .push() work with multiple returned records correctly
- .get_rev() and .resolve_rev() work faster
- .resolve_rev() looks for remote branches
- .has_rev()
Fixes#3280.
* git: improve .resolve_rev()
It follows `git checkout` logic now - if name can be unambiguously
resolved across known remotes then it's done.
* repo: throw if root_dir in Repo.__init__() is not a directory path
When Repo is instantiated with invalid urls such as 'http://github.com/iterative/dvc.git',
it does os.path.realpath which is not intelligent enough and just concatenates with current
working directory, which is then traversed outward. It might happen that the outward folder
is a dvc directory which is not really what we want.
So, a check for root to be a directory is added. Otherwise, NotDvcRepoError is thrown with
a custom message.
* repo: set message from raise for NotDvcRepoError
* add: auto convert absolute_path => relative
- fixes#2955
* use path_isin
* catch-all absolute paths in repo
* unneeded leftover
* revert realtive imports for later
* output: move abs2relpath from Base to Local
* output:local:fix parse_path
* remove path_info
* test:local versus base abs2relpath
* test:fix remaining abs2relpath test
* output: local path relative to wdir
* output: local: modify path before inheritance
* output: local: minor inheritance fix
* test: local: split output test
* test: local: positively explicit
* made '_ignored' check if the given file is already ignored by the root .gitignore. Added corresponding functional test
* code formatting
* Changed method input, adjusted tests, formatted code
* typo
* tests: use git logger fix in conftest
See https://github.com/iterative/dvc/issues/3167
* scm: git: remove redundant comments
Co-authored-by: Ruslan Kuprieiev <[email protected]>
We used to have this line previously, thinking that it was only a py2
issue, but it turned out that it happens on py3 as well. So bring this
line back for now.