8000 refactor!(pytest plugin[svn]) Cache `svn_repo` · vcs-python/libvcs@8a05ace · GitHub
[go: up one dir, main page]

Skip to content

Commit 8a05ace

Browse files
committed
refactor!(pytest plugin[svn]) Cache svn_repo
1 parent 9a3c318 commit 8a05ace

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/libvcs/pytest_plugin.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,23 @@ def hg_repo(
679679

680680

681681
@pytest.fixture
682-
def svn_repo(projects_path: pathlib.Path, svn_remote_repo: pathlib.Path) -> SvnSync:
682+
def svn_repo(
683+
remote_repos_path: pathlib.Path,
684+
projects_path: pathlib.Path,
685+
svn_remote_repo: pathlib.Path,
686+
) -> SvnSync:
683687
"""Pre-made svn clone of remote repo checked out to user's projects dir."""
688+
remote_repo_name = unique_repo_name(remote_repos_path=projects_path)
689+
new_checkout_path = projects_path / remote_repo_name
690+
master_copy = remote_repos_path / "svn_repo"
691+
692+
if master_copy.exists():
693+
shutil.copytree(master_copy, new_checkout_path)
694+
return SvnSync(
695+
url=f"file://{svn_remote_repo}",
696+
path=str(new_checkout_path),
697+
)
698+
684699
svn_repo = SvnSync(
685700
url=f"file://{svn_remote_repo}",
686701
path=str(projects_path / "svn_repo"),

0 commit comments

Comments
 (0)
0