Skip to content

Commit 6cb7308

Browse files
Revert "get: recoup cache optimal location"
This reverts commit 8e49228.
1 parent a01f81e commit 6cb7308

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

dvc/external_repo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def external_repo(url=None, rev=None, rev_lock=None, cache_dir=None):
3333
repo.close()
3434

3535

36-
def cached_clone(url, rev=None, **_ignored_kwargs):
36+
def cached_clone(url, rev=None, clone_path=None, **_ignored_kwargs):
3737
"""Clone an external git repo to a temporary directory.
3838
3939
Returns the path to a local temporary directory with the specified
@@ -44,7 +44,7 @@ def cached_clone(url, rev=None, **_ignored_kwargs):
4444
4545
"""
4646

47-
new_path = tempfile.mkdtemp("dvc-erepo")
47+
new_path = clone_path or tempfile.mkdtemp("dvc-erepo")
4848

4949
# Copy and adjust existing clean clone
5050
if (url, None, None) in REPO_CACHE:

dvc/repo/get.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
import shortuuid
55

6-
from dvc.cache import CacheConfig
7-
from dvc.config import Config
86
from dvc.exceptions import (
97
DvcException,
108
NotDvcRepoError,
@@ -51,11 +49,9 @@ def get(url, path, out=None, rev=None):
5149
dpath = os.path.dirname(os.path.abspath(out))
5250
tmp_dir = os.path.join(dpath, "." + str(shortuuid.uuid()))
5351
try:
54-
clone_dir = cached_clone(url, rev=rev)
52+
cached_clone(url, rev=rev, clone_path=tmp_dir)
5553
try:
56-
repo = Repo(clone_dir)
57-
cache_config = CacheConfig(repo.config)
58-
cache_config.set_dir(tmp_dir, level=Config.LEVEL_LOCAL)
54+
repo = Repo(tmp_dir)
5955

6056
# Try any links possible to avoid data duplication.
6157
#
@@ -81,13 +77,12 @@ def get(url, path, out=None, rev=None):
8177
if os.path.isabs(path):
8278
raise FileNotFoundError
8379

84-
fs_copy(os.path.join(clone_dir, path), out)
80+
fs_copy(os.path.join(tmp_dir, path), out)
8581

8682
except (OutputNotFoundError, FileNotFoundError):
8783
raise PathMissingError(path, url)
8884
finally:
8985
remove(tmp_dir)
90-
remove(clone_dir)
9186

9287

9388
def _get_cached(repo, output, out):

0 commit comments

Comments
 (0)