Show More
@@ -19,6 +19,8 b'' | |||||
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 | import datetime |
|
20 | import datetime | |
21 | import logging |
|
21 | import logging | |
|
22 | import time | |||
|
23 | ||||
22 | import formencode |
|
24 | import formencode | |
23 | import formencode.htmlfill |
|
25 | import formencode.htmlfill | |
24 |
|
26 | |||
@@ -131,9 +133,10 b' class AdminRepoGroupsView(BaseAppView, D' | |||||
131 |
|
133 | |||
132 | def last_change(last_change): |
|
134 | def last_change(last_change): | |
133 | if isinstance(last_change, datetime.datetime) and not last_change.tzinfo: |
|
135 | if isinstance(last_change, datetime.datetime) and not last_change.tzinfo: | |
134 |
|
|
136 | ts = time.time() | |
135 |
|
|
137 | utc_offset = (datetime.datetime.fromtimestamp(ts) | |
136 | last_change = last_change + delta |
|
138 | - datetime.datetime.utcfromtimestamp(ts)).total_seconds() | |
|
139 | last_change = last_change + datetime.timedelta(seconds=utc_offset) | |||
137 | return _render("last_change", last_change) |
|
140 | return _render("last_change", last_change) | |
138 |
|
141 | |||
139 | def desc(desc, personal): |
|
142 | def desc(desc, personal): |
@@ -2352,6 +2352,7 b' class Repository(Base, BaseModel):' | |||||
2352 |
|
2352 | |||
2353 | cs_cache['updated_on'] = time.time() |
|
2353 | cs_cache['updated_on'] = time.time() | |
2354 | self.changeset_cache = cs_cache |
|
2354 | self.changeset_cache = cs_cache | |
|
2355 | self.updated_on = last_change | |||
2355 | Session().add(self) |
|
2356 | Session().add(self) | |
2356 | Session().commit() |
|
2357 | Session().commit() | |
2357 |
|
2358 | |||
@@ -2858,6 +2859,7 b' class RepoGroup(Base, BaseModel):' | |||||
2858 | for repo_group, repos in repo_groups_and_repos().items(): |
|
2859 | for repo_group, repos in repo_groups_and_repos().items(): | |
2859 |
|
2860 | |||
2860 | latest_repo_cs_cache = {} |
|
2861 | latest_repo_cs_cache = {} | |
|
2862 | _date_latest = empty_date | |||
2861 | for repo in repos: |
|
2863 | for repo in repos: | |
2862 | repo_cs_cache = repo.changeset_cache |
|
2864 | repo_cs_cache = repo.changeset_cache | |
2863 | date_latest = latest_repo_cs_cache.get('date', empty_date) |
|
2865 | date_latest = latest_repo_cs_cache.get('date', empty_date) | |
@@ -2866,9 +2868,11 b' class RepoGroup(Base, BaseModel):' | |||||
2866 | if current_timestamp < datetime_to_time(parse_datetime(date_current)): |
|
2868 | if current_timestamp < datetime_to_time(parse_datetime(date_current)): | |
2867 | latest_repo_cs_cache = repo_cs_cache |
|
2869 | latest_repo_cs_cache = repo_cs_cache | |
2868 | latest_repo_cs_cache['source_repo_id'] = repo.repo_id |
|
2870 | latest_repo_cs_cache['source_repo_id'] = repo.repo_id | |
|
2871 | _date_latest = parse_datetime(latest_repo_cs_cache['date']) | |||
2869 |
|
2872 | |||
2870 | latest_repo_cs_cache['updated_on'] = time.time() |
|
2873 | latest_repo_cs_cache['updated_on'] = time.time() | |
2871 | repo_group.changeset_cache = latest_repo_cs_cache |
|
2874 | repo_group.changeset_cache = latest_repo_cs_cache | |
|
2875 | repo_group.updated_on = _date_latest | |||
2872 | Session().add(repo_group) |
|
2876 | Session().add(repo_group) | |
2873 | Session().commit() |
|
2877 | Session().commit() | |
2874 |
|
2878 |
@@ -217,8 +217,11 b' class RepoModel(BaseModel):' | |||||
217 |
|
217 | |||
218 | def last_change(last_change): |
|
218 | def last_change(last_change): | |
219 | if admin and isinstance(last_change, datetime.datetime) and not last_change.tzinfo: |
|
219 | if admin and isinstance(last_change, datetime.datetime) and not last_change.tzinfo: | |
220 | last_change = last_change + datetime.timedelta(seconds= |
|
220 | ts = time.time() | |
221 |
|
|
221 | utc_offset = (datetime.datetime.fromtimestamp(ts) | |
|
222 | - datetime.datetime.utcfromtimestamp(ts)).total_seconds() | |||
|
223 | last_change = last_change + datetime.timedelta(seconds=utc_offset) | |||
|
224 | ||||
222 | return _render("last_change", last_change) |
|
225 | return _render("last_change", last_change) | |
223 |
|
226 | |||
224 | def rss_lnk(repo_name): |
|
227 | def rss_lnk(repo_name): | |
@@ -381,7 +384,7 b' class RepoModel(BaseModel):' | |||||
381 | if ex_field: |
|
384 | if ex_field: | |
382 | ex_field.field_value = kwargs[field] |
|
385 | ex_field.field_value = kwargs[field] | |
383 | self.sa.add(ex_field) |
|
386 | self.sa.add(ex_field) | |
384 | cur_repo.updated_on = datetime.datetime.now() |
|
387 | ||
385 | self.sa.add(cur_repo) |
|
388 | self.sa.add(cur_repo) | |
386 |
|
389 | |||
387 | if source_repo_name != new_name: |
|
390 | if source_repo_name != new_name: |
@@ -28,6 +28,7 b' import datetime' | |||||
28 | import itertools |
|
28 | import itertools | |
29 | import logging |
|
29 | import logging | |
30 | import shutil |
|
30 | import shutil | |
|
31 | import time | |||
31 | import traceback |
|
32 | import traceback | |
32 | import string |
|
33 | import string | |
33 |
|
34 | |||
@@ -519,7 +520,7 b' class RepoGroupModel(BaseModel):' | |||||
519 |
|
520 | |||
520 | if 'user' in form_data: |
|
521 | if 'user' in form_data: | |
521 | repo_group.user = User.get_by_username(form_data['user']) |
|
522 | repo_group.user = User.get_by_username(form_data['user']) | |
522 | repo_group.updated_on = datetime.datetime.now() |
|
523 | ||
523 | self.sa.add(repo_group) |
|
524 | self.sa.add(repo_group) | |
524 |
|
525 | |||
525 | # iterate over all members of this groups and do fixes |
|
526 | # iterate over all members of this groups and do fixes | |
@@ -536,7 +537,7 b' class RepoGroupModel(BaseModel):' | |||||
536 | log.debug('Fixing group %s to new name %s', |
|
537 | log.debug('Fixing group %s to new name %s', | |
537 | obj.group_name, new_name) |
|
538 | obj.group_name, new_name) | |
538 | obj.group_name = new_name |
|
539 | obj.group_name = new_name | |
539 | obj.updated_on = datetime.datetime.now() |
|
540 | ||
540 | elif isinstance(obj, Repository): |
|
541 | elif isinstance(obj, Repository): | |
541 | # we need to get all repositories from this new group and |
|
542 | # we need to get all repositories from this new group and | |
542 | # rename them accordingly to new group path |
|
543 | # rename them accordingly to new group path | |
@@ -544,7 +545,7 b' class RepoGroupModel(BaseModel):' | |||||
544 | log.debug('Fixing repo %s to new name %s', |
|
545 | log.debug('Fixing repo %s to new name %s', | |
545 | obj.repo_name, new_name) |
|
546 | obj.repo_name, new_name) | |
546 | obj.repo_name = new_name |
|
547 | obj.repo_name = new_name | |
547 | obj.updated_on = datetime.datetime.now() |
|
548 | ||
548 | self.sa.add(obj) |
|
549 | self.sa.add(obj) | |
549 |
|
550 | |||
550 | self._rename_group(old_path, new_path) |
|
551 | self._rename_group(old_path, new_path) | |
@@ -714,8 +715,10 b' class RepoGroupModel(BaseModel):' | |||||
714 |
|
715 | |||
715 | def last_change(last_change): |
|
716 | def last_change(last_change): | |
716 | if admin and isinstance(last_change, datetime.datetime) and not last_change.tzinfo: |
|
717 | if admin and isinstance(last_change, datetime.datetime) and not last_change.tzinfo: | |
717 | last_change = last_change + datetime.timedelta(seconds= |
|
718 | ts = time.time() | |
718 |
|
|
719 | utc_offset = (datetime.datetime.fromtimestamp(ts) | |
|
720 | - datetime.datetime.utcfromtimestamp(ts)).total_seconds() | |||
|
721 | last_change = last_change + datetime.timedelta(seconds=utc_offset) | |||
719 | return _render("last_change", last_change) |
|
722 | return _render("last_change", last_change) | |
720 |
|
723 | |||
721 | def last_rev(repo_name, cs_cache): |
|
724 | def last_rev(repo_name, cs_cache): |
General Comments 0
You need to be logged in to leave comments.
Login now