Show More
@@ -43,13 +43,12 b' from rhodecode.lib.utils2 import (' | |||||
43 | from rhodecode.lib.vcs.backends import get_backend |
|
43 | from rhodecode.lib.vcs.backends import get_backend | |
44 | from rhodecode.model import BaseModel |
|
44 | from rhodecode.model import BaseModel | |
45 | from rhodecode.model.db import ( |
|
45 | from rhodecode.model.db import ( | |
46 | _hash_key, joinedload, or_, Repository, UserRepoToPerm, UserGroupRepoToPerm, |
|
46 | _hash_key, func, case, joinedload, or_, in_filter_generator, | |
|
47 | Session, Repository, UserRepoToPerm, UserGroupRepoToPerm, | |||
47 | UserRepoGroupToPerm, UserGroupRepoGroupToPerm, User, Permission, |
|
48 | UserRepoGroupToPerm, UserGroupRepoGroupToPerm, User, Permission, | |
48 | Statistics, UserGroup, RepoGroup, RepositoryField, UserLog) |
|
49 | Statistics, UserGroup, RepoGroup, RepositoryField, UserLog) | |
49 |
|
||||
50 | from rhodecode.model.settings import VcsSettingsModel |
|
50 | from rhodecode.model.settings import VcsSettingsModel | |
51 |
|
51 | |||
52 |
|
||||
53 | log = logging.getLogger(__name__) |
|
52 | log = logging.getLogger(__name__) | |
54 |
|
53 | |||
55 |
|
54 | |||
@@ -249,26 +248,29 b' class RepoModel(BaseModel):' | |||||
249 |
|
248 | |||
250 | repos_data = [] |
|
249 | repos_data = [] | |
251 | for repo in repo_list: |
|
250 | for repo in repo_list: | |
252 | cs_cache = repo.changeset_cache |
|
251 | # NOTE(marcink): because we use only raw column we need to load it like that | |
|
252 | changeset_cache = Repository._load_changeset_cache( | |||
|
253 | repo.repo_id, repo._changeset_cache) | |||
|
254 | last_commit_change = Repository._load_commit_change(changeset_cache) | |||
|
255 | ||||
253 | row = { |
|
256 | row = { | |
254 | "menu": quick_menu(repo.repo_name), |
|
257 | "menu": quick_menu(repo.repo_name), | |
255 |
|
258 | |||
256 | "name": repo_lnk(repo.repo_name, repo.repo_type, repo.repo_state, |
|
259 | "name": repo_lnk(repo.repo_name, repo.repo_type, repo.repo_state, | |
257 | repo.private, repo.archived, repo.fork), |
|
260 | repo.private, repo.archived, repo.fork), | |
258 | "name_raw": repo.repo_name.lower(), |
|
261 | "name_raw": repo.repo_name.lower(), | |
|
262 | "desc": desc(repo.description), | |||
259 |
|
263 | |||
260 |
"last_change": last_change( |
|
264 | "last_change": last_change(last_commit_change), | |
261 |
"last_change_raw": datetime_to_time( |
|
265 | "last_change_raw": datetime_to_time(last_commit_change), | |
262 |
|
266 | |||
263 | "last_changeset": last_rev(repo.repo_name, cs_cache), |
|
267 | "last_changeset": last_rev(repo.repo_name, changeset_cache), | |
264 | "last_changeset_raw": cs_cache.get('revision'), |
|
268 | "last_changeset_raw": changeset_cache.get('revision'), | |
265 |
|
269 | |||
266 |
" |
|
270 | "owner": user_profile(repo.User.username), | |
267 | "owner": user_profile(repo.user.username), |
|
|||
268 |
|
271 | |||
269 | "state": state(repo.repo_state), |
|
272 | "state": state(repo.repo_state), | |
270 | "rss": rss_lnk(repo.repo_name), |
|
273 | "rss": rss_lnk(repo.repo_name), | |
271 |
|
||||
272 | "atom": atom_lnk(repo.repo_name), |
|
274 | "atom": atom_lnk(repo.repo_name), | |
273 | } |
|
275 | } | |
274 | if admin: |
|
276 | if admin: |
@@ -36,8 +36,8 b' from zope.cachedescriptors.property impo' | |||||
36 |
|
36 | |||
37 | from rhodecode import events |
|
37 | from rhodecode import events | |
38 | from rhodecode.model import BaseModel |
|
38 | from rhodecode.model import BaseModel | |
39 | from rhodecode.model.db import (_hash_key, |
|
39 | from rhodecode.model.db import (_hash_key, func, or_, in_filter_generator, | |
40 | RepoGroup, UserRepoGroupToPerm, User, Permission, UserGroupRepoGroupToPerm, |
|
40 | Session, RepoGroup, UserRepoGroupToPerm, User, Permission, UserGroupRepoGroupToPerm, | |
41 | UserGroup, Repository) |
|
41 | UserGroup, Repository) | |
42 | from rhodecode.model.settings import VcsSettingsModel, SettingsModel |
|
42 | from rhodecode.model.settings import VcsSettingsModel, SettingsModel | |
43 | from rhodecode.lib.caching_query import FromCache |
|
43 | from rhodecode.lib.caching_query import FromCache | |
@@ -698,6 +698,8 b' class RepoGroupModel(BaseModel):' | |||||
698 | for repo_group in repo_groups: |
|
698 | for repo_group in repo_groups: | |
699 | repo_group.update_commit_cache() |
|
699 | repo_group.update_commit_cache() | |
700 |
|
700 | |||
|
701 | ||||
|
702 | ||||
701 | def get_repo_groups_as_dict(self, repo_group_list=None, admin=False, |
|
703 | def get_repo_groups_as_dict(self, repo_group_list=None, admin=False, | |
702 | super_user_actions=False): |
|
704 | super_user_actions=False): | |
703 |
|
705 | |||
@@ -721,11 +723,6 b' class RepoGroupModel(BaseModel):' | |||||
721 | last_change = last_change + datetime.timedelta(seconds=utc_offset) |
|
723 | last_change = last_change + datetime.timedelta(seconds=utc_offset) | |
722 | return _render("last_change", last_change) |
|
724 | return _render("last_change", last_change) | |
723 |
|
725 | |||
724 | def last_rev(repo_name, cs_cache): |
|
|||
725 | return _render('revision', repo_name, cs_cache.get('revision'), |
|
|||
726 | cs_cache.get('raw_id'), cs_cache.get('author'), |
|
|||
727 | cs_cache.get('message'), cs_cache.get('date')) |
|
|||
728 |
|
||||
729 | def desc(desc, personal): |
|
726 | def desc(desc, personal): | |
730 | return _render( |
|
727 | return _render( | |
731 | 'repo_group_desc', desc, personal, c.visual.stylify_metatags) |
|
728 | 'repo_group_desc', desc, personal, c.visual.stylify_metatags) | |
@@ -742,22 +739,24 b' class RepoGroupModel(BaseModel):' | |||||
742 |
|
739 | |||
743 | repo_group_data = [] |
|
740 | repo_group_data = [] | |
744 | for group in repo_group_list: |
|
741 | for group in repo_group_list: | |
745 | cs_cache = group.changeset_cache |
|
742 | # NOTE(marcink): because we use only raw column we need to load it like that | |
746 | last_repo_name = cs_cache.get('source_repo_name') |
|
743 | changeset_cache = RepoGroup._load_changeset_cache( | |
747 |
|
744 | '', group._changeset_cache) | ||
|
745 | last_commit_change = RepoGroup._load_commit_change(changeset_cache) | |||
748 | row = { |
|
746 | row = { | |
749 | "menu": quick_menu(group.group_name), |
|
747 | "menu": quick_menu(group.group_name), | |
750 | "name": repo_group_lnk(group.group_name), |
|
748 | "name": repo_group_lnk(group.group_name), | |
751 | "name_raw": group.group_name, |
|
749 | "name_raw": group.group_name, | |
752 | "last_change": last_change(group.last_commit_change), |
|
750 | ||
753 |
"last_change |
|
751 | "last_change": last_change(last_commit_change), | |
|
752 | "last_change_raw": datetime_to_time(last_commit_change), | |||
754 |
|
753 | |||
755 | "last_changeset": "", |
|
754 | "last_changeset": "", | |
756 | "last_changeset_raw": "", |
|
755 | "last_changeset_raw": "", | |
757 |
|
756 | |||
758 |
"desc": desc(group.description |
|
757 | "desc": desc(group.group_description, group.personal), | |
759 | "top_level_repos": 0, |
|
758 | "top_level_repos": 0, | |
760 |
"owner": user_profile(group. |
|
759 | "owner": user_profile(group.User.username) | |
761 | } |
|
760 | } | |
762 | if admin: |
|
761 | if admin: | |
763 | repo_count = group.repositories.count() |
|
762 | repo_count = group.repositories.count() |
General Comments 0
You need to be logged in to leave comments.
Login now