Skip to content
Snippets Groups Projects
Commit 1c735d40 authored by Georges Racinet's avatar Georges Racinet
Browse files

RepositoryService.RemoveRepository: simplification

Now that we need to load the repo for the working directories
machinery, no need to repeat the exceptions that can be raised
by the loading.

The only difference lies in the error message on missing repository,
which we are confortable ignoring.
parent 9fd108e9
No related branches found
No related tags found
3 merge requests!204Making Heptapod 0.40 the new oldstable,!203Merge stable branch into default,!201RemoveRepository: cleanup working directories
Pipeline #73330 passed
......@@ -515,10 +515,4 @@
# asynchronous (as the Rails app does), but it is not in the
# Gitaly server implementation. The renaming is done for
# atomicity purposes.
try:
repo_path = self.repo_disk_path(request.repository, context)
except KeyError as exc:
self.handle_key_error(context, exc.args)
except ValueError as exc:
self.handle_value_error(context, exc.args)
......@@ -524,11 +518,9 @@
if not os.path.exists(repo_path):
# same error message as Gitaly (probably no need to repeat
# repo details, since request often logged client-side)
context.abort(StatusCode.NOT_FOUND, "repository does not exist")
repo = self.load_repo(request.repository, context)
repo_path = repo.root
try:
workdirs = self.repo_workdirs_root(request.repository, context)
# TODO since we're doing this, we might as well do it from
# the onset and avoid repeating exception treatment OR we could
# do the cleanup in `CreateRepository` and friends
......@@ -529,10 +521,9 @@
try:
workdirs = self.repo_workdirs_root(request.repository, context)
# TODO since we're doing this, we might as well do it from
# the onset and avoid repeating exception treatment OR we could
# do the cleanup in `CreateRepository` and friends
repo = self.load_repo(request.repository, context)
remove_all_workdirs(workdirs, repo)
except Exception:
# we don't want to prevent the removal for this
......
......@@ -192,6 +192,7 @@
repository=Repository(storage_name='unknown',
relative_path='/some/path'))
assert_compare_errors(
same_details=False,
repository=Repository(storage_name=grpc_repo.storage_name,
relative_path='no/such/path'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment