##// END OF EJS Templates
repositories: use remote function to check if repo is empty...
marcink -
r3723:267daa27 new-ui
parent child Browse files
Show More
@@ -244,7 +244,10 b' class RepoAppView(BaseAppView):'
244 c.repository_requirements_missing = {}
244 c.repository_requirements_missing = {}
245 try:
245 try:
246 self.rhodecode_vcs_repo = self.db_repo.scm_instance()
246 self.rhodecode_vcs_repo = self.db_repo.scm_instance()
247 if self.rhodecode_vcs_repo:
247 # NOTE(marcink):
248 # comparison to None since if it's an object __bool__ is expensive to
249 # calculate
250 if self.rhodecode_vcs_repo is not None:
248 path_perms = self.rhodecode_vcs_repo.get_path_permissions(
251 path_perms = self.rhodecode_vcs_repo.get_path_permissions(
249 c.auth_user.username)
252 c.auth_user.username)
250 self.path_filter = PathFilter(path_perms)
253 self.path_filter = PathFilter(path_perms)
@@ -383,7 +383,7 b' class BaseRepository(object):'
383 return commit.size
383 return commit.size
384
384
385 def is_empty(self):
385 def is_empty(self):
386 return not bool(self.commit_ids)
386 return self._remote.is_empty()
387
387
388 @staticmethod
388 @staticmethod
389 def check_url(url, config):
389 def check_url(url, config):
@@ -2307,7 +2307,7 b' class Repository(Base, BaseModel):'
2307 # use no-cache version here
2307 # use no-cache version here
2308 scm_repo = self.scm_instance(cache=False, config=config)
2308 scm_repo = self.scm_instance(cache=False, config=config)
2309
2309
2310 empty = not scm_repo or scm_repo.is_empty()
2310 empty = scm_repo is None or scm_repo.is_empty()
2311 if not empty:
2311 if not empty:
2312 cs_cache = scm_repo.get_commit(
2312 cs_cache = scm_repo.get_commit(
2313 pre_load=["author", "date", "message", "parents"])
2313 pre_load=["author", "date", "message", "parents"])
General Comments 0
You need to be logged in to leave comments. Login now