mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-07 23:09:21 +01:00
* import: check erepo is None before modifying url - fixes #3780 * import: add test to cover this local import
This commit is contained in:
+6
-2
@@ -17,8 +17,12 @@ def imp_url(self, url, out=None, fname=None, erepo=None, locked=True):
|
||||
out = resolve_output(url, out)
|
||||
path, wdir, out = resolve_paths(self, out)
|
||||
|
||||
# NOTE: when user is importing something from within his own repository
|
||||
if os.path.exists(url) and path_isin(os.path.abspath(url), self.root_dir):
|
||||
# NOTE: when user is importing something from within their own repository
|
||||
if (
|
||||
erepo is None
|
||||
and os.path.exists(url)
|
||||
and path_isin(os.path.abspath(url), self.root_dir)
|
||||
):
|
||||
url = relpath(url, wdir)
|
||||
|
||||
stage = create_stage(
|
||||
|
||||
@@ -342,3 +342,9 @@ def test_import_pipeline_tracked_outs(
|
||||
"file:///{}".format(fspath(tmp_dir)), "bar", out="baz"
|
||||
)
|
||||
assert (erepo_dir / "baz").read_text() == "foo"
|
||||
|
||||
|
||||
def test_local_import(tmp_dir, dvc, scm):
|
||||
tmp_dir.dvc_gen("foo", "foo", commit="init")
|
||||
(tmp_dir / "outdir").mkdir()
|
||||
dvc.imp(".", "foo", out="outdir")
|
||||
|
||||
Reference in New Issue
Block a user