Skip to content

Commit

Permalink
open_repo: return without entering context for both local and erepo
Browse files Browse the repository at this point in the history
  • Loading branch information
pmrowla committed Jul 12, 2023
1 parent dd4035b commit a5dda1b
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions dvc/repo/open_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
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

Expand All @@ -18,13 +17,12 @@
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
Expand All @@ -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):
Expand Down

0 comments on commit a5dda1b

Please sign in to comment.