Mercurial > kallithea
diff rhodecode/lib/dbmigrate/schema/db_1_5_2.py @ 3708:c15d7b336af5 rhodecode-0.0.1.6.0rc1
freeze schema for 1.6 + fixed migration from version 1.4.X+
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 07 Apr 2013 23:51:53 +0200 |
parents | fa6ba6727475 |
children | 9345065b03c0 |
line wrap: on
line diff
--- a/rhodecode/lib/dbmigrate/schema/db_1_5_2.py Sun Apr 07 19:14:17 2013 +0200 +++ b/rhodecode/lib/dbmigrate/schema/db_1_5_2.py Sun Apr 07 23:51:53 2013 +0200 @@ -44,6 +44,7 @@ from rhodecode.lib.vcs.utils.helpers import get_scm from rhodecode.lib.vcs.exceptions import VCSError from rhodecode.lib.vcs.utils.lazy import LazyProperty +from rhodecode.lib.vcs.backends.base import EmptyChangeset from rhodecode.lib.utils2 import str2bool, safe_str, get_changeset_safe, \ safe_unicode, remove_suffix, remove_prefix @@ -979,17 +980,27 @@ """ from rhodecode.lib.vcs.backends.base import BaseChangeset if cs_cache is None: - cs_cache = self.get_changeset() + cs_cache = EmptyChangeset() + # use no-cache version here + scm_repo = self.scm_instance_no_cache() + if scm_repo: + cs_cache = scm_repo.get_changeset() + if isinstance(cs_cache, BaseChangeset): cs_cache = cs_cache.__json__() - if cs_cache != self.changeset_cache: - last_change = cs_cache.get('date') or self.last_change - log.debug('updated repo %s with new cs cache %s' % (self, cs_cache)) + if (cs_cache != self.changeset_cache or not self.changeset_cache): + _default = datetime.datetime.fromtimestamp(0) + last_change = cs_cache.get('date') or _default + log.debug('updated repo %s with new cs cache %s' + % (self.repo_name, cs_cache)) self.updated_on = last_change self.changeset_cache = cs_cache Session().add(self) Session().commit() + else: + log.debug('Skipping repo:%s already with latest changes' + % self.repo_name) @property def tip(self): @@ -1065,6 +1076,9 @@ """ CacheInvalidation.set_invalidate(repo_name=self.repo_name) + def scm_instance_no_cache(self): + return self.__get_instance() + @LazyProperty def scm_instance(self): import rhodecode