feat(git/svn): remove filesystem modifications from git/svn calls. When sharding comes in place we can't do this.

- This code was moved back to the vcsserver logic now
This commit is contained in:
RhodeCode Admin 2023-12-01 10:18:51 +01:00
parent 25c079d921
commit a507c058d8
2 changed files with 6 additions and 16 deletions

View file

@ -150,8 +150,7 @@ class GitRepository(BaseRepository):
bare=False):
if create and os.path.exists(self.path):
raise RepositoryError(
"Cannot create repository at %s, location already exist"
% self.path)
f"Cannot create repository at {self.path}, location already exist")
if bare and do_workspace_checkout:
raise RepositoryError("Cannot update a bare repository")
@ -162,8 +161,6 @@ class GitRepository(BaseRepository):
GitRepository.check_url(src_url, self.config)
if create:
os.makedirs(self.path, mode=0o755)
if bare:
self._remote.init_bare()
else:
@ -179,8 +176,7 @@ class GitRepository(BaseRepository):
else:
if not self._remote.assert_correct_path():
raise RepositoryError(
'Path "%s" does not contain a Git repository' %
(self.path,))
f'Path "{self.path}" does not contain a Git repository')
# TODO: johbo: check if we have to translate the OSError here
except OSError as err:

View file

@ -88,8 +88,7 @@ class SubversionRepository(base.BaseRepository):
def _init_repo(self, create, src_url):
if create and os.path.exists(self.path):
raise RepositoryError(
f"Cannot create repository at {self.path}, location already exist"
)
f"Cannot create repository at {self.path}, location already exist")
if create:
self._remote.create_repository(settings.SVN_COMPATIBLE_VERSION)
@ -97,7 +96,9 @@ class SubversionRepository(base.BaseRepository):
src_url = _sanitize_url(src_url)
self._remote.import_remote_repository(src_url)
else:
self._check_path()
if not self._remote.is_path_valid_repository(self.path):
raise VCSError(
f'Path "{self.path}" does not contain a Subversion repository')
@CachedProperty
def commit_ids(self):
@ -243,13 +244,6 @@ class SubversionRepository(base.BaseRepository):
pass
return False
def _check_path(self):
if not os.path.exists(self.path):
raise VCSError(f'Path "{self.path}" does not exist!')
if not self._remote.is_path_valid_repository(self.path):
raise VCSError(
'Path "%s" does not contain a Subversion repository' %
(self.path, ))
@LazyProperty
def last_change(self):