Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
hgitaly
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
heptapod
hgitaly
Commits
288dc648
Commit
288dc648
authored
3 years ago
by
Sushil Khanchi
Browse files
Options
Downloads
Patches
Plain Diff
servicer: extract logic to find repo disk path in a method
parent
5f2066eb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!64
RepositoryService: implement CreateRepository
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hgitaly/servicer.py
+17
-13
17 additions, 13 deletions
hgitaly/servicer.py
with
17 additions
and
13 deletions
hgitaly/servicer.py
+
17
−
13
View file @
288dc648
...
...
@@ -82,19 +82,7 @@
# shamelessly taken from heptapod.wsgi for the Hgitaly bootstrap
# note that Gitaly Repository has more than just a relative path,
# we'll have to decide what we make of the extra information
rpath
=
repository
.
relative_path
if
rpath
.
endswith
(
'
.git
'
):
rpath
=
rpath
[:
-
4
]
+
'
.hg
'
root_dir
=
self
.
storages
.
get
(
repository
.
storage_name
)
if
root_dir
is
None
:
context
.
set_code
(
StatusCode
.
NOT_FOUND
)
context
.
set_details
(
"
No storage named %r
"
%
repository
.
storage_name
)
raise
KeyError
(
'
storage
'
,
repository
.
storage_name
)
# GitLab filesystem paths are always ASCII
repo_path
=
os
.
path
.
join
(
root_dir
,
rpath
.
encode
(
'
ascii
'
))
repo_path
=
self
.
repo_disk_path
(
repository
,
context
)
logger
.
info
(
"
loading repo at %r
"
,
repo_path
)
try
:
...
...
@@ -110,3 +98,19 @@
srcrepo
.
unfiltered
().
__class__
)
return
repo
def
repo_disk_path
(
self
,
repository
:
Repository
,
context
):
rpath
=
repository
.
relative_path
if
rpath
.
endswith
(
'
.git
'
):
rpath
=
rpath
[:
-
4
]
+
'
.hg
'
root_dir
=
self
.
storages
.
get
(
repository
.
storage_name
)
if
root_dir
is
None
:
context
.
set_code
(
StatusCode
.
NOT_FOUND
)
context
.
set_details
(
"
No storage named %r
"
%
repository
.
storage_name
)
raise
KeyError
(
'
storage
'
,
repository
.
storage_name
)
# GitLab filesystem paths are always ASCII
repo_path
=
os
.
path
.
join
(
root_dir
,
rpath
.
encode
(
'
ascii
'
))
return
repo_path
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment