vcs: use proper attributes/inits on base and child classes.

This commit is contained in:
Marcin Kuzminski 2018-02-20 17:47:18 +01:00
parent e5db2ac1d2
commit f689a025ce
3 changed files with 22 additions and 4 deletions

View file

@ -248,6 +248,20 @@ class BaseRepository(object):
"""
raise NotImplementedError
@LazyProperty
def branches_closed(self):
"""
A `dict` which maps tags names to commit ids.
"""
raise NotImplementedError
@LazyProperty
def bookmarks(self):
"""
A `dict` which maps tags names to commit ids.
"""
raise NotImplementedError
@LazyProperty
def tags(self):
"""

View file

@ -71,8 +71,6 @@ class GitRepository(BaseRepository):
# caches
self._commit_ids = {}
self.bookmarks = {}
@LazyProperty
def bare(self):
return self._remote.bare()
@ -322,6 +320,10 @@ class GitRepository(BaseRepository):
def branches_closed(self):
return {}
@LazyProperty
def bookmarks(self):
return {}
@LazyProperty
def branches_all(self):
all_branches = {}

View file

@ -77,8 +77,6 @@ class SubversionRepository(base.BaseRepository):
self._init_repo(create, src_url)
self.bookmarks = {}
def _init_repo(self, create, src_url):
if create and os.path.exists(self.path):
raise RepositoryError(
@ -106,6 +104,10 @@ class SubversionRepository(base.BaseRepository):
def branches_closed(self):
return {}
@LazyProperty
def bookmarks(self):
return {}
@LazyProperty
def branches_all(self):
# TODO: johbo: Implement proper branch support