Repository: iterative/dvc

Issue:
refactor: Repo methods with "targets" param should check for str type
Repo contains several methods with `targets` param: `add`, `update`, `status`, `_fetch`, etc. Some of them, like `add` and `update`, check if `targets` param is str:

```
if isinstance(targets, str):
    targets = [targets]
```

Probably other methods should contain it too. Possible candidates:

1. `status`
1. `_checkout`
1. `_fetch`
1. `pull`
1. `push`

Discussion:

Patch:
diff --git a/dvc/repo/checkout.py b/dvc/repo/checkout.py
index ea5f7cdb8..eae723a1b 100644
--- a/dvc/repo/checkout.py
+++ b/dvc/repo/checkout.py
@@ -60,6 +60,9 @@ def _checkout(
     stats["deleted"] = [_fspath_dir(u, self.root_dir) for u in unused]
     self.state.remove_links(unused)
 
+    if isinstance(targets, str):
+        targets = [targets]
+
     pairs = set()
     for target in targets:
         try:
diff --git a/dvc/repo/fetch.py b/dvc/repo/fetch.py
index cf2a01b76..a9534d2a4 100644
--- a/dvc/repo/fetch.py
+++ b/dvc/repo/fetch.py
@@ -37,6 +37,9 @@ def _fetch(
 
     used_run_cache = self.stage_cache.pull(remote) if run_cache else []
 
+    if isinstance(targets, str):
+        targets = [targets]
+
     used = self.used_cache(
         targets,
         all_branches=all_branches,
diff --git a/dvc/repo/imp_url.py b/dvc/repo/imp_url.py
index 73420eb62..5320ea354 100644
--- a/dvc/repo/imp_url.py
+++ b/dvc/repo/imp_url.py
@@ -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(
diff --git a/dvc/repo/pull.py b/dvc/repo/pull.py
index 16d160045..4ee782bad 100644
--- a/dvc/repo/pull.py
+++ b/dvc/repo/pull.py
@@ -19,6 +19,9 @@ def pull(
     all_commits=False,
     run_cache=False,
 ):
+    if isinstance(targets, str):
+        targets = [targets]
+
     processed_files_count = self._fetch(
         targets,
         jobs,
diff --git a/dvc/repo/push.py b/dvc/repo/push.py
index 81e07ce6a..f0c88e298 100644
--- a/dvc/repo/push.py
+++ b/dvc/repo/push.py
@@ -16,6 +16,9 @@ def push(
 ):
     used_run_cache = self.stage_cache.push(remote) if run_cache else []
 
+    if isinstance(targets, str):
+        targets = [targets]
+
     used = self.used_cache(
         targets,
         all_branches=all_branches,
diff --git a/dvc/repo/status.py b/dvc/repo/status.py
index 5c0c452ff..6ea0294c3 100644
--- a/dvc/repo/status.py
+++ b/dvc/repo/status.py
@@ -116,6 +116,9 @@ def status(
     all_commits=False,
     recursive=False,
 ):
+    if isinstance(targets, str):
+        targets = [targets]
+
     if cloud or remote:
         return _cloud_status(
             self,


Test patch:
diff --git a/tests/func/test_import.py b/tests/func/test_import.py
index 3eddc1148..6ca40fb3c 100644
--- a/tests/func/test_import.py
+++ b/tests/func/test_import.py
@@ -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")