-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlocal.py
38 lines (27 loc) · 1.05 KB
/
local.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
from vcsrepository import VcsRepository
class Local:
storage_path = ''
def __init__(self, storage_path):
"""Creates Local service instance.
:param str tmp_path: Path to store local repositories
"""
self.storage_path = storage_path.rstrip('/') + '/'
def create_repository(self, vcs_repository):
"""Creates repository locally.
:param VcsRepository vcs_repository: Repository data
:return: Created repository
:rtype VcsRepository
"""
return VcsRepository(vcs_repository.name,
'',
self.storage_path + '/' + vcs_repository.name,
False,
False)
def repository_exists(self, vcs_repository):
"""Checks whether a repository exists
:param VcsRepository vcs_repository: Repository to check
:return: Whether repository exists
:rtype bool
"""
return os.path.exists(self.storage_path + vcs_repository.name)