mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-13 15:28:27 +01:00
open_repo: return without entering context for both local and erepo
This commit is contained in:
committed by
Peter Rowlands (변기호)
parent
dd4035bc05
commit
a5dda1b8ad
+3
-10
@@ -2,8 +2,7 @@ import logging
|
||||
import os
|
||||
import tempfile
|
||||
import threading
|
||||
from contextlib import contextmanager
|
||||
from typing import TYPE_CHECKING, Dict, Iterator, Optional, Tuple
|
||||
from typing import TYPE_CHECKING, Dict, Optional, Tuple
|
||||
|
||||
from funcy import retry, wrap_with
|
||||
|
||||
@@ -18,13 +17,12 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@contextmanager
|
||||
@map_scm_exception()
|
||||
def _external_repo(
|
||||
url,
|
||||
rev: Optional[str] = None,
|
||||
**kwargs,
|
||||
) -> Iterator["Repo"]:
|
||||
) -> "Repo":
|
||||
logger.debug("Creating external repo %s@%s", url, rev)
|
||||
path = _cached_clone(url, rev)
|
||||
# Local HEAD points to the tip of whatever branch we first cloned from
|
||||
@@ -46,12 +44,7 @@ def _external_repo(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
repo = Repo(**repo_kwargs)
|
||||
|
||||
try:
|
||||
yield repo
|
||||
finally:
|
||||
repo.close()
|
||||
return Repo(**repo_kwargs)
|
||||
|
||||
|
||||
def open_repo(url, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user