mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-12-02 23:10:25 +01:00
1) split Project's methods into separate files; 2) rename Project into Repo(similar to gitpython's Repo) Signed-off-by: Ruslan Kuprieiev <[email protected]>
24 lines
642 B
Python
24 lines
642 B
Python
"""Manages source control systems(e.g. Git)."""
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
from dvc.scm.base import Base
|
|
from dvc.scm.git import Git
|
|
|
|
|
|
def SCM(root_dir, repo=None): # pylint: disable=invalid-name
|
|
"""Returns SCM instance that corresponds to a repo at the specified
|
|
path.
|
|
|
|
Args:
|
|
root_dir (str): path to a root directory of the repo.
|
|
repo (dvc.repo.Repo): dvc repo instance that root_dir belongs to.
|
|
|
|
Returns:
|
|
dvc.scm.base.Base: SCM instance.
|
|
"""
|
|
if Git.is_repo(root_dir) or Git.is_submodule(root_dir):
|
|
return Git(root_dir, repo=repo)
|
|
|
|
return Base(root_dir, repo=repo)
|