diff --git a/rhodecode/controllers/admin/repos.py b/rhodecode/controllers/admin/repos.py --- a/rhodecode/controllers/admin/repos.py +++ b/rhodecode/controllers/admin/repos.py @@ -97,12 +97,13 @@ class ReposController(BaseController): .filter(UserFollowing.follows_repository == c.repo_info).scalar() if c.repo_info.stats: - last_rev = c.repo_info.stats.stat_on_revision + # this is on what revision we ended up so we add +1 for count + last_rev = c.repo_info.stats.stat_on_revision + 1 else: last_rev = 0 c.stats_revision = last_rev - c.repo_last_rev = repo.count() - 1 if repo.revisions else 0 + c.repo_last_rev = repo.count() if repo.revisions else 0 if last_rev == 0 or c.repo_last_rev == 0: c.stats_percentage = 0 @@ -287,6 +288,7 @@ class ReposController(BaseController): try: repo_model = RepoModel() repo_model.delete_perm_user(request.POST, repo_name) + Session.commit() except Exception, e: h.flash(_('An error occurred during deletion of repository user'), category='error') @@ -302,6 +304,7 @@ class ReposController(BaseController): try: repo_model = RepoModel() repo_model.delete_perm_users_group(request.POST, repo_name) + Session.commit() except Exception, e: h.flash(_('An error occurred during deletion of repository' ' users groups'), @@ -319,6 +322,7 @@ class ReposController(BaseController): try: repo_model = RepoModel() repo_model.delete_stats(repo_name) + Session.commit() except Exception, e: h.flash(_('An error occurred during deletion of repository stats'), category='error') @@ -334,6 +338,7 @@ class ReposController(BaseController): try: ScmModel().mark_for_invalidation(repo_name) + Session.commit() except Exception, e: h.flash(_('An error occurred during cache invalidation'), category='error') @@ -357,6 +362,7 @@ class ReposController(BaseController): self.scm_model.toggle_following_repo(repo_id, user_id) h.flash(_('Updated repository visibility in public journal'), category='success') + Session.commit() except: h.flash(_('An error occurred during setting this' ' repository in public journal'), diff --git a/rhodecode/controllers/forks.py b/rhodecode/controllers/forks.py --- a/rhodecode/controllers/forks.py +++ b/rhodecode/controllers/forks.py @@ -80,12 +80,12 @@ class ForksController(BaseRepoController .filter(UserFollowing.follows_repository == c.repo_info).scalar() if c.repo_info.stats: - last_rev = c.repo_info.stats.stat_on_revision + last_rev = c.repo_info.stats.stat_on_revision+1 else: last_rev = 0 c.stats_revision = last_rev - c.repo_last_rev = repo.count() - 1 if repo.revisions else 0 + c.repo_last_rev = repo.count() if repo.revisions else 0 if last_rev == 0 or c.repo_last_rev == 0: c.stats_percentage = 0 diff --git a/rhodecode/controllers/summary.py b/rhodecode/controllers/summary.py --- a/rhodecode/controllers/summary.py +++ b/rhodecode/controllers/summary.py @@ -57,6 +57,7 @@ README_FILES = [''.join([x[0][0], x[1][0 sorted(list(product(ALL_READMES, ALL_EXTS)), key=lambda y:y[0][1] + y[1][1])] + class SummaryController(BaseRepoController): @LoginRequired() @@ -94,7 +95,7 @@ class SummaryController(BaseRepoControll uri = uri_tmpl % {'user': username, 'pass': password, 'scheme': parsed_url.scheme, - 'netloc':parsed_url.netloc, + 'netloc': parsed_url.netloc, 'path':parsed_url.path} c.clone_repo_url = uri @@ -151,8 +152,8 @@ class SummaryController(BaseRepoControll key=lambda k: k[1])[:10] ) ) - last_rev = stats.stat_on_revision - c.repo_last_rev = c.rhodecode_repo.count() - 1 \ + last_rev = stats.stat_on_revision + 1 + c.repo_last_rev = c.rhodecode_repo.count()\ if c.rhodecode_repo.revisions else 0 if last_rev == 0 or c.repo_last_rev == 0: pass diff --git a/rhodecode/lib/celerylib/tasks.py b/rhodecode/lib/celerylib/tasks.py --- a/rhodecode/lib/celerylib/tasks.py +++ b/rhodecode/lib/celerylib/tasks.py @@ -78,12 +78,13 @@ def get_logger(cls): return log + @task(ignore_result=True) @locked_task def whoosh_index(repo_location, full_index): from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon - #log = whoosh_index.get_logger() + # log = whoosh_index.get_logger(whoosh_index) index_location = config['index_dir'] WhooshIndexingDaemon(index_location=index_location, @@ -100,6 +101,7 @@ def get_commits_stats(repo_name, ts_min_ lockkey_path = config['here'] log.info('running task with lockkey %s', lockkey) + try: sa = get_session() lock = l = DaemonLock(file_=jn(lockkey_path, lockkey)) @@ -114,15 +116,15 @@ def get_commits_stats(repo_name, ts_min_ return True repo = repo.scm_instance - repo_size = len(repo.revisions) - #return if repo have no revisions + repo_size = repo.count() + # return if repo have no revisions if repo_size < 1: lock.release() return True skip_date_limit = True parse_limit = int(config['app_conf'].get('commit_parse_limit')) - last_rev = 0 + last_rev = None last_cs = None timegetter = itemgetter('time') @@ -149,8 +151,10 @@ def get_commits_stats(repo_name, ts_min_ log.debug('starting parsing %s', parse_limit) lmktime = mktime - last_rev = last_rev + 1 if last_rev > 0 else last_rev - + last_rev = last_rev + 1 if last_rev >= 0 else 0 + log.debug('Getting revisions from %s to %s' % ( + last_rev, last_rev + parse_limit) + ) for cs in repo[last_rev:last_rev + parse_limit]: last_cs = cs # remember last parsed changeset k = lmktime([cs.date.timetuple()[0], cs.date.timetuple()[1],