##// END OF EJS Templates
- fixed issue with missing commits on some repos commands...
marcink -
r1807:1635a214 beta
parent child Browse files
Show More
@@ -97,12 +97,13 class ReposController(BaseController):
97 .filter(UserFollowing.follows_repository == c.repo_info).scalar()
97 .filter(UserFollowing.follows_repository == c.repo_info).scalar()
98
98
99 if c.repo_info.stats:
99 if c.repo_info.stats:
100 last_rev = c.repo_info.stats.stat_on_revision
100 # this is on what revision we ended up so we add +1 for count
101 last_rev = c.repo_info.stats.stat_on_revision + 1
101 else:
102 else:
102 last_rev = 0
103 last_rev = 0
103 c.stats_revision = last_rev
104 c.stats_revision = last_rev
104
105
105 c.repo_last_rev = repo.count() - 1 if repo.revisions else 0
106 c.repo_last_rev = repo.count() if repo.revisions else 0
106
107
107 if last_rev == 0 or c.repo_last_rev == 0:
108 if last_rev == 0 or c.repo_last_rev == 0:
108 c.stats_percentage = 0
109 c.stats_percentage = 0
@@ -287,6 +288,7 class ReposController(BaseController):
287 try:
288 try:
288 repo_model = RepoModel()
289 repo_model = RepoModel()
289 repo_model.delete_perm_user(request.POST, repo_name)
290 repo_model.delete_perm_user(request.POST, repo_name)
291 Session.commit()
290 except Exception, e:
292 except Exception, e:
291 h.flash(_('An error occurred during deletion of repository user'),
293 h.flash(_('An error occurred during deletion of repository user'),
292 category='error')
294 category='error')
@@ -302,6 +304,7 class ReposController(BaseController):
302 try:
304 try:
303 repo_model = RepoModel()
305 repo_model = RepoModel()
304 repo_model.delete_perm_users_group(request.POST, repo_name)
306 repo_model.delete_perm_users_group(request.POST, repo_name)
307 Session.commit()
305 except Exception, e:
308 except Exception, e:
306 h.flash(_('An error occurred during deletion of repository'
309 h.flash(_('An error occurred during deletion of repository'
307 ' users groups'),
310 ' users groups'),
@@ -319,6 +322,7 class ReposController(BaseController):
319 try:
322 try:
320 repo_model = RepoModel()
323 repo_model = RepoModel()
321 repo_model.delete_stats(repo_name)
324 repo_model.delete_stats(repo_name)
325 Session.commit()
322 except Exception, e:
326 except Exception, e:
323 h.flash(_('An error occurred during deletion of repository stats'),
327 h.flash(_('An error occurred during deletion of repository stats'),
324 category='error')
328 category='error')
@@ -334,6 +338,7 class ReposController(BaseController):
334
338
335 try:
339 try:
336 ScmModel().mark_for_invalidation(repo_name)
340 ScmModel().mark_for_invalidation(repo_name)
341 Session.commit()
337 except Exception, e:
342 except Exception, e:
338 h.flash(_('An error occurred during cache invalidation'),
343 h.flash(_('An error occurred during cache invalidation'),
339 category='error')
344 category='error')
@@ -357,6 +362,7 class ReposController(BaseController):
357 self.scm_model.toggle_following_repo(repo_id, user_id)
362 self.scm_model.toggle_following_repo(repo_id, user_id)
358 h.flash(_('Updated repository visibility in public journal'),
363 h.flash(_('Updated repository visibility in public journal'),
359 category='success')
364 category='success')
365 Session.commit()
360 except:
366 except:
361 h.flash(_('An error occurred during setting this'
367 h.flash(_('An error occurred during setting this'
362 ' repository in public journal'),
368 ' repository in public journal'),
@@ -80,12 +80,12 class ForksController(BaseRepoController
80 .filter(UserFollowing.follows_repository == c.repo_info).scalar()
80 .filter(UserFollowing.follows_repository == c.repo_info).scalar()
81
81
82 if c.repo_info.stats:
82 if c.repo_info.stats:
83 last_rev = c.repo_info.stats.stat_on_revision
83 last_rev = c.repo_info.stats.stat_on_revision+1
84 else:
84 else:
85 last_rev = 0
85 last_rev = 0
86 c.stats_revision = last_rev
86 c.stats_revision = last_rev
87
87
88 c.repo_last_rev = repo.count() - 1 if repo.revisions else 0
88 c.repo_last_rev = repo.count() if repo.revisions else 0
89
89
90 if last_rev == 0 or c.repo_last_rev == 0:
90 if last_rev == 0 or c.repo_last_rev == 0:
91 c.stats_percentage = 0
91 c.stats_percentage = 0
@@ -57,6 +57,7 README_FILES = [''.join([x[0][0], x[1][0
57 sorted(list(product(ALL_READMES, ALL_EXTS)),
57 sorted(list(product(ALL_READMES, ALL_EXTS)),
58 key=lambda y:y[0][1] + y[1][1])]
58 key=lambda y:y[0][1] + y[1][1])]
59
59
60
60 class SummaryController(BaseRepoController):
61 class SummaryController(BaseRepoController):
61
62
62 @LoginRequired()
63 @LoginRequired()
@@ -151,8 +152,8 class SummaryController(BaseRepoControll
151 key=lambda k: k[1])[:10]
152 key=lambda k: k[1])[:10]
152 )
153 )
153 )
154 )
154 last_rev = stats.stat_on_revision
155 last_rev = stats.stat_on_revision + 1
155 c.repo_last_rev = c.rhodecode_repo.count() - 1 \
156 c.repo_last_rev = c.rhodecode_repo.count()\
156 if c.rhodecode_repo.revisions else 0
157 if c.rhodecode_repo.revisions else 0
157 if last_rev == 0 or c.repo_last_rev == 0:
158 if last_rev == 0 or c.repo_last_rev == 0:
158 pass
159 pass
@@ -78,12 +78,13 def get_logger(cls):
78
78
79 return log
79 return log
80
80
81
81 @task(ignore_result=True)
82 @task(ignore_result=True)
82 @locked_task
83 @locked_task
83 def whoosh_index(repo_location, full_index):
84 def whoosh_index(repo_location, full_index):
84 from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon
85 from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon
85
86
86 #log = whoosh_index.get_logger()
87 # log = whoosh_index.get_logger(whoosh_index)
87
88
88 index_location = config['index_dir']
89 index_location = config['index_dir']
89 WhooshIndexingDaemon(index_location=index_location,
90 WhooshIndexingDaemon(index_location=index_location,
@@ -100,6 +101,7 def get_commits_stats(repo_name, ts_min_
100 lockkey_path = config['here']
101 lockkey_path = config['here']
101
102
102 log.info('running task with lockkey %s', lockkey)
103 log.info('running task with lockkey %s', lockkey)
104
103 try:
105 try:
104 sa = get_session()
106 sa = get_session()
105 lock = l = DaemonLock(file_=jn(lockkey_path, lockkey))
107 lock = l = DaemonLock(file_=jn(lockkey_path, lockkey))
@@ -114,7 +116,7 def get_commits_stats(repo_name, ts_min_
114 return True
116 return True
115
117
116 repo = repo.scm_instance
118 repo = repo.scm_instance
117 repo_size = len(repo.revisions)
119 repo_size = repo.count()
118 #return if repo have no revisions
120 # return if repo have no revisions
119 if repo_size < 1:
121 if repo_size < 1:
120 lock.release()
122 lock.release()
@@ -122,7 +124,7 def get_commits_stats(repo_name, ts_min_
122
124
123 skip_date_limit = True
125 skip_date_limit = True
124 parse_limit = int(config['app_conf'].get('commit_parse_limit'))
126 parse_limit = int(config['app_conf'].get('commit_parse_limit'))
125 last_rev = 0
127 last_rev = None
126 last_cs = None
128 last_cs = None
127 timegetter = itemgetter('time')
129 timegetter = itemgetter('time')
128
130
@@ -149,8 +151,10 def get_commits_stats(repo_name, ts_min_
149 log.debug('starting parsing %s', parse_limit)
151 log.debug('starting parsing %s', parse_limit)
150 lmktime = mktime
152 lmktime = mktime
151
153
152 last_rev = last_rev + 1 if last_rev > 0 else last_rev
154 last_rev = last_rev + 1 if last_rev >= 0 else 0
153
155 log.debug('Getting revisions from %s to %s' % (
156 last_rev, last_rev + parse_limit)
157 )
154 for cs in repo[last_rev:last_rev + parse_limit]:
158 for cs in repo[last_rev:last_rev + parse_limit]:
155 last_cs = cs # remember last parsed changeset
159 last_cs = cs # remember last parsed changeset
156 k = lmktime([cs.date.timetuple()[0], cs.date.timetuple()[1],
160 k = lmktime([cs.date.timetuple()[0], cs.date.timetuple()[1],
General Comments 0
You need to be logged in to leave comments. Login now