@@ -449,10 +449,34 @@ def svn_remote_repo_single_commit_post_init(remote_repo_path: pathlib.Path) -> N
449
449
)
450
450
451
451
452
+ @pytest .fixture (scope = "session" )
453
+ def empty_svn_repo_path (libvcs_test_cache_path : pathlib .Path ) -> pathlib .Path :
454
+ """Return temporary directory to use for master-copy of a svn repo."""
455
+ return libvcs_test_cache_path / "empty_svn_repo"
456
+
457
+
458
+ @pytest .fixture (scope = "session" )
459
+ @skip_if_svn_missing
460
+ def empty_svn_repo (
461
+ empty_svn_repo_path : pathlib .Path ,
462
+ ) -> pathlib .Path :
463
+ """Return factory to create svn remote repo to for clone / push purposes."""
464
+ if empty_svn_repo_path .exists () and (empty_svn_repo_path / ".git" ).exists ():
465
+ return empty_svn_repo_path
466
+
467
+ return _create_svn_remote_repo (
468
+ remote_repos_path = empty_svn_repo_path .parent ,
469
+ remote_repo_name = empty_svn_repo_path .stem ,
470
+ remote_repo_post_init = None ,
471
+ init_cmd_args = None ,
472
+ )
473
+
474
+
452
475
@pytest .fixture
453
476
@skip_if_svn_missing
454
477
def create_svn_remote_repo (
455
478
remote_repos_path : pathlib .Path ,
479
+ empty_svn_repo : pathlib .Path ,
456
480
) -> CreateRepoPytestFixtureFn :
457
481
"""Pre-made svn repo, bare, used as a file:// remote to checkout and commit to."""
458
482
@@ -462,14 +486,20 @@ def fn(
462
486
remote_repo_post_init : Optional [CreateRepoPostInitFn ] = None ,
463
487
init_cmd_args : InitCmdArgs = None ,
464
488
) -> pathlib .Path :
465
- return _create_svn_remote_repo (
466
- remote_repos_path = remote_repos_path ,
467
- remote_repo_name = remote_repo_name
468
- if remote_repo_name is not None
469
- else unique_repo_name (remote_repos_path = remote_repos_path ),
470
- remote_repo_post_init = remote_repo_post_init ,
471
- init_cmd_args = init_cmd_args ,
472
- )
489
+ if remote_repo_name is None :
490
+ remote_repo_name = unique_repo_name (remote_repos_path = remote_repos_path )
491
+ remote_repo_path = remote_repos_path / remote_repo_name
492
+
493
+ shutil .copytree (empty_svn_repo , remote_repo_path )
494
+
495
+ if remote_repo_post_init is not None and callable (remote_repo_post_init ):
496
+ remote_repo_post_init (remote_repo_path = remote_repo_path )
497
+
498
+ assert empty_svn_repo .exists ()
499
+
500
+ assert remote_repo_path .exists ()
501
+
502
+ return remote_repo_path
473
503
474
504
return fn
475
505
0 commit comments