|
a/Allura/allura/lib/repository.py |
|
b/Allura/allura/lib/repository.py |
|
... |
|
... |
69 |
def admin_menu(self):
|
69 |
def admin_menu(self):
|
70 |
admin_url = c.project.url()+'admin/'+self.config.options.mount_point+'/'
|
70 |
admin_url = c.project.url()+'admin/'+self.config.options.mount_point+'/'
|
71 |
links = [SitemapEntry('Viewable Files', admin_url + 'extensions', className='admin_modal')]
|
71 |
links = [SitemapEntry('Viewable Files', admin_url + 'extensions', className='admin_modal')]
|
72 |
links.append(SitemapEntry('Refresh Repository',
|
72 |
links.append(SitemapEntry('Refresh Repository',
|
73 |
c.project.url() + self.config.options.mount_point + '/refresh',
|
73 |
c.project.url() + self.config.options.mount_point + '/refresh',
|
74 |
className='nav_child'))
|
74 |
))
|
75 |
links += super(RepositoryApp, self).admin_menu()
|
75 |
links += super(RepositoryApp, self).admin_menu()
|
76 |
[links.remove(l) for l in links[:] if l.label == 'Options']
|
76 |
[links.remove(l) for l in links[:] if l.label == 'Options']
|
77 |
return links
|
77 |
return links
|
78 |
|
78 |
|
79 |
@h.exceptionless([], log)
|
79 |
@h.exceptionless([], log)
|
|
... |
|
... |
94 |
merge_request_count = self.repo.merge_requests_by_statuses('open').count()
|
94 |
merge_request_count = self.repo.merge_requests_by_statuses('open').count()
|
95 |
if merge_request_count:
|
95 |
if merge_request_count:
|
96 |
links += [
|
96 |
links += [
|
97 |
SitemapEntry(
|
97 |
SitemapEntry(
|
98 |
'Merge Requests', c.app.url + 'merge-requests/',
|
98 |
'Merge Requests', c.app.url + 'merge-requests/',
|
99 |
className='nav_child',
|
|
|
100 |
small=merge_request_count) ]
|
99 |
small=merge_request_count) ]
|
101 |
if self.repo.upstream_repo.name:
|
100 |
if self.repo.upstream_repo.name:
|
102 |
repo_path_parts = self.repo.upstream_repo.name.strip('/').split('/')
|
101 |
repo_path_parts = self.repo.upstream_repo.name.strip('/').split('/')
|
103 |
links += [
|
102 |
links += [
|
104 |
SitemapEntry('Clone of'),
|
103 |
SitemapEntry('Clone of'),
|
105 |
SitemapEntry('%s / <strong>%s</strong>' %
|
104 |
SitemapEntry('%s / <strong>%s</strong>' %
|
106 |
(repo_path_parts[1], repo_path_parts[-1]),
|
105 |
(repo_path_parts[1], repo_path_parts[-1]),
|
107 |
self.repo.upstream_repo.name,
|
106 |
self.repo.upstream_repo.name)
|
108 |
className='nav_child')
|
|
|
109 |
]
|
107 |
]
|
110 |
if len(c.app.repo.branches) and has_access(c.app.repo, 'admin'):
|
108 |
if len(c.app.repo.branches) and has_access(c.app.repo, 'admin'):
|
111 |
links.append(SitemapEntry('Request Merge', c.app.url + 'request_merge',
|
109 |
links.append(SitemapEntry('Request Merge', c.app.url + 'request_merge',
|
112 |
ui_icon=g.icons['merge'],
|
110 |
ui_icon=g.icons['merge'],
|
113 |
className='nav_child'))
|
111 |
))
|
114 |
pending_upstream_merges = self.repo.pending_upstream_merges()
|
112 |
pending_upstream_merges = self.repo.pending_upstream_merges()
|
115 |
if pending_upstream_merges:
|
113 |
if pending_upstream_merges:
|
116 |
links.append(SitemapEntry(
|
114 |
links.append(SitemapEntry(
|
117 |
'Pending Merges',
|
115 |
'Pending Merges',
|
118 |
self.repo.upstream_repo.name + 'merge-requests/',
|
116 |
self.repo.upstream_repo.name + 'merge-requests/',
|
119 |
className='nav_child',
|
|
|
120 |
small=pending_upstream_merges))
|
117 |
small=pending_upstream_merges))
|
121 |
if self.repo.branches:
|
118 |
if self.repo.branches:
|
122 |
links.append(SitemapEntry('Branches'))
|
119 |
links.append(SitemapEntry('Branches'))
|
123 |
for b in self.repo.branches:
|
120 |
for b in self.repo.branches:
|
124 |
links.append(SitemapEntry(
|
121 |
links.append(SitemapEntry(
|
125 |
b.name, url(c.app.url, dict(branch='ref/' + b.name)),
|
122 |
b.name, url(c.app.url, dict(branch='ref/' + b.name)),
|
126 |
className='nav_child',
|
|
|
127 |
small=b.count))
|
123 |
small=b.count))
|
128 |
if self.repo.repo_tags:
|
124 |
if self.repo.repo_tags:
|
129 |
links.append(SitemapEntry('Tags'))
|
125 |
links.append(SitemapEntry('Tags'))
|
130 |
max_tags = 10
|
126 |
max_tags = 10
|
131 |
for i, b in enumerate(self.repo.repo_tags):
|
127 |
for i, b in enumerate(self.repo.repo_tags):
|
132 |
if i < max_tags:
|
128 |
if i < max_tags:
|
133 |
links.append(SitemapEntry(
|
129 |
links.append(SitemapEntry(
|
134 |
b.name, url(c.app.url, dict(branch='ref/' + b.name)),
|
130 |
b.name, url(c.app.url, dict(branch='ref/' + b.name)),
|
135 |
className='nav_child',
|
|
|
136 |
small=b.count))
|
131 |
small=b.count))
|
137 |
elif i == max_tags:
|
132 |
elif i == max_tags:
|
138 |
links.append(
|
133 |
links.append(
|
139 |
SitemapEntry(
|
134 |
SitemapEntry(
|
140 |
'More Tags',
|
135 |
'More Tags',
|
141 |
default_branch_url+'tags/',
|
136 |
default_branch_url+'tags/',
|
142 |
className='nav_child'))
|
137 |
))
|
143 |
break
|
138 |
break
|
144 |
if self.repo.forks:
|
139 |
if self.repo.forks:
|
145 |
links.append(SitemapEntry('Forks'))
|
140 |
links.append(SitemapEntry('Forks'))
|
146 |
for f in self.repo.forks:
|
141 |
for f in self.repo.forks:
|
147 |
repo_path_parts = f.url().strip('/').split('/')
|
142 |
repo_path_parts = f.url().strip('/').split('/')
|
148 |
links.append(SitemapEntry(
|
143 |
links.append(SitemapEntry(
|
149 |
'%s / <strong>%s</strong>' %
|
144 |
'%s / <strong>%s</strong>' %
|
150 |
(repo_path_parts[1], repo_path_parts[-1]),
|
145 |
(repo_path_parts[1], repo_path_parts[-1]),
|
151 |
f.url(), className='nav_child'))
|
146 |
f.url()))
|
152 |
return links
|
147 |
return links
|
153 |
|
148 |
|
154 |
def install(self, project):
|
149 |
def install(self, project):
|
155 |
self.config.options['project_name'] = project.name
|
150 |
self.config.options['project_name'] = project.name
|
156 |
super(RepositoryApp, self).install(project)
|
151 |
super(RepositoryApp, self).install(project)
|