Show More
@@ -44,6 +44,7 b' from rhodecode.lib.vcs import get_backen' | |||||
44 | from rhodecode.lib.vcs.utils.helpers import get_scm |
|
44 | from rhodecode.lib.vcs.utils.helpers import get_scm | |
45 | from rhodecode.lib.vcs.exceptions import VCSError |
|
45 | from rhodecode.lib.vcs.exceptions import VCSError | |
46 | from rhodecode.lib.vcs.utils.lazy import LazyProperty |
|
46 | from rhodecode.lib.vcs.utils.lazy import LazyProperty | |
|
47 | from rhodecode.lib.vcs.backends.base import EmptyChangeset | |||
47 |
|
48 | |||
48 | from rhodecode.lib.utils2 import str2bool, safe_str, get_changeset_safe, \ |
|
49 | from rhodecode.lib.utils2 import str2bool, safe_str, get_changeset_safe, \ | |
49 | safe_unicode, remove_suffix, remove_prefix |
|
50 | safe_unicode, remove_suffix, remove_prefix | |
@@ -1053,15 +1054,18 b' class Repository(Base, BaseModel):' | |||||
1053 | """ |
|
1054 | """ | |
1054 | from rhodecode.lib.vcs.backends.base import BaseChangeset |
|
1055 | from rhodecode.lib.vcs.backends.base import BaseChangeset | |
1055 | if cs_cache is None: |
|
1056 | if cs_cache is None: | |
1056 |
cs_cache = |
|
1057 | cs_cache = EmptyChangeset() | |
|
1058 | # use no-cache version here | |||
|
1059 | scm_repo = self.scm_instance_no_cache | |||
|
1060 | if scm_repo: | |||
|
1061 | cs_cache = scm_repo.get_changeset() | |||
|
1062 | ||||
1057 | if isinstance(cs_cache, BaseChangeset): |
|
1063 | if isinstance(cs_cache, BaseChangeset): | |
1058 | cs_cache = cs_cache.__json__() |
|
1064 | cs_cache = cs_cache.__json__() | |
1059 |
|
1065 | |||
1060 | if (cs_cache != self.changeset_cache |
|
1066 | if (cs_cache != self.changeset_cache or not self.changeset_cache): | |
1061 | or not self.last_change |
|
|||
1062 | or not self.changeset_cache): |
|
|||
1063 | _default = datetime.datetime.fromtimestamp(0) |
|
1067 | _default = datetime.datetime.fromtimestamp(0) | |
1064 |
last_change = cs_cache.get('date') or |
|
1068 | last_change = cs_cache.get('date') or _default | |
1065 | log.debug('updated repo %s with new cs cache %s' % (self, cs_cache)) |
|
1069 | log.debug('updated repo %s with new cs cache %s' % (self, cs_cache)) | |
1066 | self.updated_on = last_change |
|
1070 | self.updated_on = last_change | |
1067 | self.changeset_cache = cs_cache |
|
1071 | self.changeset_cache = cs_cache | |
@@ -1188,7 +1192,8 b' class Repository(Base, BaseModel):' | |||||
1188 | repo_full_path = self.repo_full_path |
|
1192 | repo_full_path = self.repo_full_path | |
1189 | try: |
|
1193 | try: | |
1190 | alias = get_scm(repo_full_path)[0] |
|
1194 | alias = get_scm(repo_full_path)[0] | |
1191 |
log.debug('Creating instance of %s repository' |
|
1195 | log.debug('Creating instance of %s repository from %s' | |
|
1196 | % (alias, repo_full_path)) | |||
1192 | backend = get_backend(alias) |
|
1197 | backend = get_backend(alias) | |
1193 | except VCSError: |
|
1198 | except VCSError: | |
1194 | log.error(traceback.format_exc()) |
|
1199 | log.error(traceback.format_exc()) |
@@ -149,11 +149,7 b' class RepoModel(BaseModel):' | |||||
149 | if not repositories: |
|
149 | if not repositories: | |
150 | repositories = Repository.getAll() |
|
150 | repositories = Repository.getAll() | |
151 | for repo in repositories: |
|
151 | for repo in repositories: | |
152 |
|
|
152 | repo.update_changeset_cache() | |
153 | last_cs = EmptyChangeset() |
|
|||
154 | if scm_repo: |
|
|||
155 | last_cs = scm_repo.get_changeset() |
|
|||
156 | repo.update_changeset_cache(last_cs) |
|
|||
157 |
|
153 | |||
158 | def get_repos_as_dict(self, repos_list=None, admin=False, perm_check=True, |
|
154 | def get_repos_as_dict(self, repos_list=None, admin=False, perm_check=True, | |
159 | super_user_actions=False): |
|
155 | super_user_actions=False): |
General Comments 0
You need to be logged in to leave comments.
Login now