##// END OF EJS Templates
changelog: rename changelog to commits pages
marcink -
r3742:0d621dfb new-ui
parent child Browse files
Show More
@@ -469,7 +469,7 b' class HomeView(BaseAppView):'
469 _query=query_modifier())
469 _query=query_modifier())
470 }
470 }
471
471
472 if repo_context in ['commit', 'changelog']:
472 if repo_context in ['commit', 'commits']:
473 queries.extend([commit_qry, file_qry])
473 queries.extend([commit_qry, file_qry])
474 elif repo_context in ['files', 'summary']:
474 elif repo_context in ['files', 'summary']:
475 queries.extend([file_qry, commit_qry])
475 queries.extend([file_qry, commit_qry])
@@ -509,7 +509,7 b' class HomeView(BaseAppView):'
509 _query=query_modifier())
509 _query=query_modifier())
510 }
510 }
511
511
512 if repo_context in ['commit', 'changelog']:
512 if repo_context in ['commit', 'commits']:
513 queries.extend([commit_qry, file_qry])
513 queries.extend([commit_qry, file_qry])
514 elif repo_context in ['files', 'summary']:
514 elif repo_context in ['files', 'summary']:
515 queries.extend([file_qry, commit_qry])
515 queries.extend([file_qry, commit_qry])
@@ -153,7 +153,7 b' class JournalView(BaseAppView):'
153 desc = action_extra()
153 desc = action_extra()
154 _url = h.route_url('home')
154 _url = h.route_url('home')
155 if entry.repository is not None:
155 if entry.repository is not None:
156 _url = h.route_url('repo_changelog',
156 _url = h.route_url('repo_commits',
157 repo_name=entry.repository.repo_name)
157 repo_name=entry.repository.repo_name)
158
158
159 feed.add_item(
159 feed.add_item(
@@ -199,7 +199,7 b' class JournalView(BaseAppView):'
199 desc = action_extra()
199 desc = action_extra()
200 _url = h.route_url('home')
200 _url = h.route_url('home')
201 if entry.repository is not None:
201 if entry.repository is not None:
202 _url = h.route_url('repo_changelog',
202 _url = h.route_url('repo_commits',
203 repo_name=entry.repository.repo_name)
203 repo_name=entry.repository.repo_name)
204
204
205 feed.add_item(
205 feed.add_item(
@@ -193,19 +193,27 b' def includeme(config):'
193 name='repo_stats',
193 name='repo_stats',
194 pattern='/{repo_name:.*?[^/]}/repo_stats/{commit_id}', repo_route=True)
194 pattern='/{repo_name:.*?[^/]}/repo_stats/{commit_id}', repo_route=True)
195
195
196 # Changelog
196 # Commits
197 config.add_route(
198 name='repo_commits',
199 pattern='/{repo_name:.*?[^/]}/commits', repo_route=True)
200 config.add_route(
201 name='repo_commits_file',
202 pattern='/{repo_name:.*?[^/]}/commits/{commit_id}/{f_path:.*}', repo_route=True)
203 config.add_route(
204 name='repo_commits_elements',
205 pattern='/{repo_name:.*?[^/]}/commits_elements', repo_route=True)
206 config.add_route(
207 name='repo_commits_elements_file',
208 pattern='/{repo_name:.*?[^/]}/commits_elements/{commit_id}/{f_path:.*}', repo_route=True)
209
210 # Changelog (old deprecated name for commits page)
197 config.add_route(
211 config.add_route(
198 name='repo_changelog',
212 name='repo_changelog',
199 pattern='/{repo_name:.*?[^/]}/changelog', repo_route=True)
213 pattern='/{repo_name:.*?[^/]}/changelog', repo_route=True)
200 config.add_route(
214 config.add_route(
201 name='repo_changelog_file',
215 name='repo_changelog_file',
202 pattern='/{repo_name:.*?[^/]}/changelog/{commit_id}/{f_path:.*}', repo_route=True)
216 pattern='/{repo_name:.*?[^/]}/changelog/{commit_id}/{f_path:.*}', repo_route=True)
203 config.add_route(
204 name='repo_changelog_elements',
205 pattern='/{repo_name:.*?[^/]}/changelog_elements', repo_route=True)
206 config.add_route(
207 name='repo_changelog_elements_file',
208 pattern='/{repo_name:.*?[^/]}/changelog_elements/{commit_id}/{f_path:.*}', repo_route=True)
209
217
210 # Compare
218 # Compare
211 config.add_route(
219 config.add_route(
@@ -33,8 +33,9 b' def route_path(name, params=None, **kwar'
33
33
34 base_url = {
34 base_url = {
35 'repo_changelog':'/{repo_name}/changelog',
35 'repo_changelog': '/{repo_name}/changelog',
36 'repo_changelog_file':'/{repo_name}/changelog/{commit_id}/{f_path}',
36 'repo_commits': '/{repo_name}/commits',
37 'repo_changelog_elements':'/{repo_name}/changelog_elements',
37 'repo_commits_file': '/{repo_name}/commits/{commit_id}/{f_path}',
38 'repo_commits_elements': '/{repo_name}/commits_elements',
38 }[name].format(**kwargs)
39 }[name].format(**kwargs)
39
40
40 if params:
41 if params:
@@ -42,8 +43,23 b' def route_path(name, params=None, **kwar'
42 return base_url
43 return base_url
43
44
44
45
46 def assert_commits_on_page(response, indexes):
47 found_indexes = [int(idx) for idx in MATCH_HASH.findall(response.body)]
48 assert found_indexes == indexes
49
50
45 class TestChangelogController(TestController):
51 class TestChangelogController(TestController):
46
52
53 def test_commits_page(self, backend):
54 self.log_user()
55 response = self.app.get(
56 route_path('repo_commits', repo_name=backend.repo_name))
57
58 first_idx = -1
59 last_idx = -DEFAULT_CHANGELOG_SIZE
60 self.assert_commit_range_on_page(
61 response, first_idx, last_idx, backend)
62
47 def test_changelog(self, backend):
63 def test_changelog(self, backend):
48 self.log_user()
64 self.log_user()
49 response = self.app.get(
65 response = self.app.get(
@@ -62,6 +78,14 b' class TestChangelogController(TestContro'
62 params=dict(branch=backend.default_branch_name)),
78 params=dict(branch=backend.default_branch_name)),
63 status=200)
79 status=200)
64
80
81 @pytest.mark.backends("hg", "git")
82 def test_commits_filtered_by_branch(self, backend):
83 self.log_user()
84 self.app.get(
85 route_path('repo_commits', repo_name=backend.repo_name,
86 params=dict(branch=backend.default_branch_name)),
87 status=200)
88
65 @pytest.mark.backends("svn")
89 @pytest.mark.backends("svn")
66 def test_changelog_filtered_by_branch_svn(self, autologin_user, backend):
90 def test_changelog_filtered_by_branch_svn(self, autologin_user, backend):
67 repo = backend['svn-simple-layout']
91 repo = backend['svn-simple-layout']
@@ -70,27 +94,22 b' class TestChangelogController(TestContro'
70 params=dict(branch='trunk')),
94 params=dict(branch='trunk')),
71 status=200)
95 status=200)
72
96
73 self.assert_commits_on_page(
97 assert_commits_on_page(response, indexes=[15, 12, 7, 3, 2, 1])
74 response, indexes=[15, 12, 7, 3, 2, 1])
75
98
76 def test_changelog_filtered_by_wrong_branch(self, backend):
99 def test_commits_filtered_by_wrong_branch(self, backend):
77 self.log_user()
100 self.log_user()
78 branch = 'wrong-branch-name'
101 branch = 'wrong-branch-name'
79 response = self.app.get(
102 response = self.app.get(
80 route_path('repo_changelog', repo_name=backend.repo_name,
103 route_path('repo_commits', repo_name=backend.repo_name,
81 params=dict(branch=branch)),
104 params=dict(branch=branch)),
82 status=302)
105 status=302)
83 expected_url = '/{repo}/changelog/{branch}'.format(
106 expected_url = '/{repo}/commits/{branch}'.format(
84 repo=backend.repo_name, branch=branch)
107 repo=backend.repo_name, branch=branch)
85 assert expected_url in response.location
108 assert expected_url in response.location
86 response = response.follow()
109 response = response.follow()
87 expected_warning = 'Branch {} is not found.'.format(branch)
110 expected_warning = 'Branch {} is not found.'.format(branch)
88 assert expected_warning in response.body
111 assert expected_warning in response.body
89
112
90 def assert_commits_on_page(self, response, indexes):
91 found_indexes = [int(idx) for idx in MATCH_HASH.findall(response.body)]
92 assert found_indexes == indexes
93
94 @pytest.mark.xfail_backends("svn", reason="Depends on branch support")
113 @pytest.mark.xfail_backends("svn", reason="Depends on branch support")
95 def test_changelog_filtered_by_branch_with_merges(
114 def test_changelog_filtered_by_branch_with_merges(
96 self, autologin_user, backend):
115 self, autologin_user, backend):
@@ -112,21 +131,20 b' class TestChangelogController(TestContro'
112 status=200)
131 status=200)
113
132
114 @pytest.mark.backends("hg")
133 @pytest.mark.backends("hg")
115 def test_changelog_closed_branches(self, autologin_user, backend):
134 def test_commits_closed_branches(self, autologin_user, backend):
116 repo = backend['closed_branch']
135 repo = backend['closed_branch']
117 response = self.app.get(
136 response = self.app.get(
118 route_path('repo_changelog', repo_name=repo.repo_name,
137 route_path('repo_commits', repo_name=repo.repo_name,
119 params=dict(branch='experimental')),
138 params=dict(branch='experimental')),
120 status=200)
139 status=200)
121
140
122 self.assert_commits_on_page(
141 assert_commits_on_page(response, indexes=[3, 1])
123 response, indexes=[3, 1])
124
142
125 def test_changelog_pagination(self, backend):
143 def test_changelog_pagination(self, backend):
126 self.log_user()
144 self.log_user()
127 # pagination, walk up to page 6
145 # pagination, walk up to page 6
128 changelog_url = route_path(
146 changelog_url = route_path(
129 'repo_changelog', repo_name=backend.repo_name)
147 'repo_commits', repo_name=backend.repo_name)
130
148
131 for page in range(1, 7):
149 for page in range(1, 7):
132 response = self.app.get(changelog_url, {'page': page})
150 response = self.app.get(changelog_url, {'page': page})
@@ -168,10 +186,10 b' class TestChangelogController(TestContro'
168 '/vcs/exceptions.py',
186 '/vcs/exceptions.py',
169 '//vcs/exceptions.py'
187 '//vcs/exceptions.py'
170 ])
188 ])
171 def test_changelog_with_filenode(self, backend, test_path):
189 def test_commits_with_filenode(self, backend, test_path):
172 self.log_user()
190 self.log_user()
173 response = self.app.get(
191 response = self.app.get(
174 route_path('repo_changelog_file', repo_name=backend.repo_name,
192 route_path('repo_commits_file', repo_name=backend.repo_name,
175 commit_id='tip', f_path=test_path),
193 commit_id='tip', f_path=test_path),
176 )
194 )
177
195
@@ -180,16 +198,16 b' class TestChangelogController(TestContro'
180 response.mustcontain('Added not implemented hg backend test case')
198 response.mustcontain('Added not implemented hg backend test case')
181 response.mustcontain('Added BaseChangeset class')
199 response.mustcontain('Added BaseChangeset class')
182
200
183 def test_changelog_with_filenode_that_is_dirnode(self, backend):
201 def test_commits_with_filenode_that_is_dirnode(self, backend):
184 self.log_user()
202 self.log_user()
185 self.app.get(
203 self.app.get(
186 route_path('repo_changelog_file', repo_name=backend.repo_name,
204 route_path('repo_commits_file', repo_name=backend.repo_name,
187 commit_id='tip', f_path='/tests'),
205 commit_id='tip', f_path='/tests'),
188 status=302)
206 status=302)
189
207
190 def test_changelog_with_filenode_not_existing(self, backend):
208 def test_commits_with_filenode_not_existing(self, backend):
191 self.log_user()
209 self.log_user()
192 self.app.get(
210 self.app.get(
193 route_path('repo_changelog_file', repo_name=backend.repo_name,
211 route_path('repo_commits_file', repo_name=backend.repo_name,
194 commit_id='tip', f_path='wrong_path'),
212 commit_id='tip', f_path='wrong_path'),
195 status=302)
213 status=302)
@@ -40,6 +40,8 b' def route_path(name, params=None, **kwar'
40 base_url = {
40 base_url = {
41 'repo_changelog': '/{repo_name}/changelog',
41 'repo_changelog': '/{repo_name}/changelog',
42 'repo_changelog_file': '/{repo_name}/changelog/{commit_id}/{f_path}',
42 'repo_changelog_file': '/{repo_name}/changelog/{commit_id}/{f_path}',
43 'repo_commits': '/{repo_name}/changelog',
44 'repo_commits_file': '/{repo_name}/changelog/{commit_id}/{f_path}',
43 'pullrequest_show': '/{repo_name}/pull-request/{pull_request_id}',
45 'pullrequest_show': '/{repo_name}/pull-request/{pull_request_id}',
44 'pullrequest_show_all': '/{repo_name}/pull-request',
46 'pullrequest_show_all': '/{repo_name}/pull-request',
45 'pullrequest_show_all_data': '/{repo_name}/pull-request-data',
47 'pullrequest_show_all_data': '/{repo_name}/pull-request-data',
@@ -998,11 +1000,11 b' class TestPullrequestsView(object):'
998 assert len(target_children) == 1
1000 assert len(target_children) == 1
999
1001
1000 expected_origin_link = route_path(
1002 expected_origin_link = route_path(
1001 'repo_changelog',
1003 'repo_commits',
1002 repo_name=pull_request.source_repo.scm_instance().name,
1004 repo_name=pull_request.source_repo.scm_instance().name,
1003 params=dict(branch='origin'))
1005 params=dict(branch='origin'))
1004 expected_target_link = route_path(
1006 expected_target_link = route_path(
1005 'repo_changelog',
1007 'repo_commits',
1006 repo_name=pull_request.target_repo.scm_instance().name,
1008 repo_name=pull_request.target_repo.scm_instance().name,
1007 params=dict(branch='target'))
1009 params=dict(branch='target'))
1008 assert origin_children[0].attrib['href'] == expected_origin_link
1010 assert origin_children[0].attrib['href'] == expected_origin_link
@@ -113,7 +113,7 b' class RepoChangelogView(RepoAppView):'
113 h.flash('Branch {} is not found.'.format(h.escape(branch_name)),
113 h.flash('Branch {} is not found.'.format(h.escape(branch_name)),
114 category='warning')
114 category='warning')
115 redirect_url = h.route_path(
115 redirect_url = h.route_path(
116 'repo_changelog_file', repo_name=repo_name,
116 'repo_commits_file', repo_name=repo_name,
117 commit_id=branch_name, f_path=f_path or '')
117 commit_id=branch_name, f_path=f_path or '')
118 raise HTTPFound(redirect_url)
118 raise HTTPFound(redirect_url)
119
119
@@ -127,13 +127,13 b' class RepoChangelogView(RepoAppView):'
127 if f_path:
127 if f_path:
128 # changelog for file
128 # changelog for file
129 return h.route_path(
129 return h.route_path(
130 'repo_changelog_file',
130 'repo_commits_file',
131 repo_name=c.rhodecode_db_repo.repo_name,
131 repo_name=c.rhodecode_db_repo.repo_name,
132 commit_id=commit_id, f_path=f_path,
132 commit_id=commit_id, f_path=f_path,
133 _query=query_params)
133 _query=query_params)
134 else:
134 else:
135 return h.route_path(
135 return h.route_path(
136 'repo_changelog',
136 'repo_commits',
137 repo_name=c.rhodecode_db_repo.repo_name, _query=query_params)
137 repo_name=c.rhodecode_db_repo.repo_name, _query=query_params)
138
138
139 c.total_cs = len(collection)
139 c.total_cs = len(collection)
@@ -171,11 +171,18 b' class RepoChangelogView(RepoAppView):'
171 @HasRepoPermissionAnyDecorator(
171 @HasRepoPermissionAnyDecorator(
172 'repository.read', 'repository.write', 'repository.admin')
172 'repository.read', 'repository.write', 'repository.admin')
173 @view_config(
173 @view_config(
174 route_name='repo_commits', request_method='GET',
175 renderer='rhodecode:templates/commits/changelog.mako')
176 @view_config(
177 route_name='repo_commits_file', request_method='GET',
178 renderer='rhodecode:templates/commits/changelog.mako')
179 # old routes for backward compat
180 @view_config(
174 route_name='repo_changelog', request_method='GET',
181 route_name='repo_changelog', request_method='GET',
175 renderer='rhodecode:templates/changelog/changelog.mako')
182 renderer='rhodecode:templates/commits/changelog.mako')
176 @view_config(
183 @view_config(
177 route_name='repo_changelog_file', request_method='GET',
184 route_name='repo_changelog_file', request_method='GET',
178 renderer='rhodecode:templates/changelog/changelog.mako')
185 renderer='rhodecode:templates/commits/changelog.mako')
179 def repo_changelog(self):
186 def repo_changelog(self):
180 c = self.load_default_context()
187 c = self.load_default_context()
181
188
@@ -224,7 +231,7 b' class RepoChangelogView(RepoAppView):'
224 except RepositoryError as e:
231 except RepositoryError as e:
225 h.flash(safe_str(e), category='warning')
232 h.flash(safe_str(e), category='warning')
226 redirect_url = h.route_path(
233 redirect_url = h.route_path(
227 'repo_changelog', repo_name=self.db_repo_name)
234 'repo_commits', repo_name=self.db_repo_name)
228 raise HTTPFound(redirect_url)
235 raise HTTPFound(redirect_url)
229 collection = list(reversed(collection))
236 collection = list(reversed(collection))
230 else:
237 else:
@@ -246,14 +253,14 b' class RepoChangelogView(RepoAppView):'
246 log.exception(safe_str(e))
253 log.exception(safe_str(e))
247 h.flash(safe_str(h.escape(e)), category='error')
254 h.flash(safe_str(h.escape(e)), category='error')
248 raise HTTPFound(
255 raise HTTPFound(
249 h.route_path('repo_changelog', repo_name=self.db_repo_name))
256 h.route_path('repo_commits', repo_name=self.db_repo_name))
250
257
251 if partial_xhr or self.request.environ.get('HTTP_X_PJAX'):
258 if partial_xhr or self.request.environ.get('HTTP_X_PJAX'):
252 # case when loading dynamic file history in file view
259 # case when loading dynamic file history in file view
253 # loading from ajax, we don't want the first result, it's popped
260 # loading from ajax, we don't want the first result, it's popped
254 # in the code above
261 # in the code above
255 html = render(
262 html = render(
256 'rhodecode:templates/changelog/changelog_file_history.mako',
263 'rhodecode:templates/commits/changelog_file_history.mako',
257 self._get_template_context(c), self.request)
264 self._get_template_context(c), self.request)
258 return Response(html)
265 return Response(html)
259
266
@@ -271,14 +278,14 b' class RepoChangelogView(RepoAppView):'
271 @HasRepoPermissionAnyDecorator(
278 @HasRepoPermissionAnyDecorator(
272 'repository.read', 'repository.write', 'repository.admin')
279 'repository.read', 'repository.write', 'repository.admin')
273 @view_config(
280 @view_config(
274 route_name='repo_changelog_elements', request_method=('GET', 'POST'),
281 route_name='repo_commits_elements', request_method=('GET', 'POST'),
275 renderer='rhodecode:templates/changelog/changelog_elements.mako',
282 renderer='rhodecode:templates/commits/changelog_elements.mako',
276 xhr=True)
283 xhr=True)
277 @view_config(
284 @view_config(
278 route_name='repo_changelog_elements_file', request_method=('GET', 'POST'),
285 route_name='repo_commits_elements_file', request_method=('GET', 'POST'),
279 renderer='rhodecode:templates/changelog/changelog_elements.mako',
286 renderer='rhodecode:templates/commits/changelog_elements.mako',
280 xhr=True)
287 xhr=True)
281 def repo_changelog_elements(self):
288 def repo_commits_elements(self):
282 c = self.load_default_context()
289 c = self.load_default_context()
283 commit_id = self.request.matchdict.get('commit_id')
290 commit_id = self.request.matchdict.get('commit_id')
284 f_path = self._get_f_path(self.request.matchdict)
291 f_path = self._get_f_path(self.request.matchdict)
@@ -312,7 +319,7 b' class RepoChangelogView(RepoAppView):'
312 except (RepositoryError, CommitDoesNotExistError, Exception) as e:
319 except (RepositoryError, CommitDoesNotExistError, Exception) as e:
313 log.exception(safe_str(e))
320 log.exception(safe_str(e))
314 raise HTTPFound(
321 raise HTTPFound(
315 h.route_path('repo_changelog', repo_name=self.db_repo_name))
322 h.route_path('repo_commits', repo_name=self.db_repo_name))
316
323
317 collection = base_commit.get_path_history(
324 collection = base_commit.get_path_history(
318 f_path, limit=hist_limit, pre_load=pre_load)
325 f_path, limit=hist_limit, pre_load=pre_load)
@@ -2061,7 +2061,8 b' def reviewer_as_json(*args, **kwargs):'
2061 def get_repo_view_type(request):
2061 def get_repo_view_type(request):
2062 route_name = request.matched_route.name
2062 route_name = request.matched_route.name
2063 route_to_view_type = {
2063 route_to_view_type = {
2064 'repo_changelog': 'changelog',
2064 'repo_changelog': 'commits',
2065 'repo_commits': 'commits',
2065 'repo_files': 'files',
2066 'repo_files': 'files',
2066 'repo_summary': 'summary',
2067 'repo_summary': 'summary',
2067 'repo_commit': 'commit'
2068 'repo_commit': 'commit'
@@ -478,11 +478,11 b' class MercurialRepository(BaseRepository'
478 ``end`` could not be found.
478 ``end`` could not be found.
479 """
479 """
480 # actually we should check now if it's not an empty repo
480 # actually we should check now if it's not an empty repo
481 branch_ancestors = False
482 if self.is_empty():
481 if self.is_empty():
483 raise EmptyRepositoryError("There are no commits yet")
482 raise EmptyRepositoryError("There are no commits yet")
484 self._validate_branch_name(branch_name)
483 self._validate_branch_name(branch_name)
485
484
485 branch_ancestors = False
486 if start_id is not None:
486 if start_id is not None:
487 self._validate_commit_id(start_id)
487 self._validate_commit_id(start_id)
488 c_start = self.get_commit(commit_id=start_id)
488 c_start = self.get_commit(commit_id=start_id)
@@ -277,7 +277,7 b' class SubversionRepository(base.BaseRepo'
277 try:
277 try:
278 commit_id = self.commit_ids[commit_idx]
278 commit_id = self.commit_ids[commit_idx]
279 except IndexError:
279 except IndexError:
280 raise CommitDoesNotExistError
280 raise CommitDoesNotExistError('No commit with idx: {}'.format(commit_idx))
281
281
282 commit_id = self._sanitize_commit_id(commit_id)
282 commit_id = self._sanitize_commit_id(commit_id)
283 commit = SubversionCommit(repository=self, commit_id=commit_id)
283 commit = SubversionCommit(repository=self, commit_id=commit_id)
@@ -98,7 +98,7 b' function setRCMouseBindings(repoName, re'
98 });
98 });
99 Mousetrap.bind(['g c'], function(e) {
99 Mousetrap.bind(['g c'], function(e) {
100 window.location = pyroutes.url(
100 window.location = pyroutes.url(
101 'repo_changelog', {'repo_name': repoName});
101 'repo_commits', {'repo_name': repoName});
102 });
102 });
103 Mousetrap.bind(['g F'], function(e) {
103 Mousetrap.bind(['g F'], function(e) {
104 window.location = pyroutes.url(
104 window.location = pyroutes.url(
@@ -196,14 +196,17 b' function registerRCRoutes() {'
196 pyroutes.register('repo_files_edit_file', '/%(repo_name)s/edit_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']);
196 pyroutes.register('repo_files_edit_file', '/%(repo_name)s/edit_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']);
197 pyroutes.register('repo_files_update_file', '/%(repo_name)s/update_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']);
197 pyroutes.register('repo_files_update_file', '/%(repo_name)s/update_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']);
198 pyroutes.register('repo_files_add_file', '/%(repo_name)s/add_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']);
198 pyroutes.register('repo_files_add_file', '/%(repo_name)s/add_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']);
199 pyroutes.register('repo_files_upload_file', '/%(repo_name)s/upload_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']);
199 pyroutes.register('repo_files_create_file', '/%(repo_name)s/create_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']);
200 pyroutes.register('repo_files_create_file', '/%(repo_name)s/create_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']);
200 pyroutes.register('repo_refs_data', '/%(repo_name)s/refs-data', ['repo_name']);
201 pyroutes.register('repo_refs_data', '/%(repo_name)s/refs-data', ['repo_name']);
201 pyroutes.register('repo_refs_changelog_data', '/%(repo_name)s/refs-data-changelog', ['repo_name']);
202 pyroutes.register('repo_refs_changelog_data', '/%(repo_name)s/refs-data-changelog', ['repo_name']);
202 pyroutes.register('repo_stats', '/%(repo_name)s/repo_stats/%(commit_id)s', ['repo_name', 'commit_id']);
203 pyroutes.register('repo_stats', '/%(repo_name)s/repo_stats/%(commit_id)s', ['repo_name', 'commit_id']);
204 pyroutes.register('repo_commits', '/%(repo_name)s/commits', ['repo_name']);
205 pyroutes.register('repo_commits_file', '/%(repo_name)s/commits/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']);
206 pyroutes.register('repo_commits_elements', '/%(repo_name)s/commits_elements', ['repo_name']);
207 pyroutes.register('repo_commits_elements_file', '/%(repo_name)s/commits_elements/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']);
203 pyroutes.register('repo_changelog', '/%(repo_name)s/changelog', ['repo_name']);
208 pyroutes.register('repo_changelog', '/%(repo_name)s/changelog', ['repo_name']);
204 pyroutes.register('repo_changelog_file', '/%(repo_name)s/changelog/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']);
209 pyroutes.register('repo_changelog_file', '/%(repo_name)s/changelog/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']);
205 pyroutes.register('repo_changelog_elements', '/%(repo_name)s/changelog_elements', ['repo_name']);
206 pyroutes.register('repo_changelog_elements_file', '/%(repo_name)s/changelog_elements/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']);
207 pyroutes.register('repo_compare_select', '/%(repo_name)s/compare', ['repo_name']);
210 pyroutes.register('repo_compare_select', '/%(repo_name)s/compare', ['repo_name']);
208 pyroutes.register('repo_compare', '/%(repo_name)s/compare/%(source_ref_type)s@%(source_ref)s...%(target_ref_type)s@%(target_ref)s', ['repo_name', 'source_ref_type', 'source_ref', 'target_ref_type', 'target_ref']);
211 pyroutes.register('repo_compare', '/%(repo_name)s/compare/%(source_ref_type)s@%(source_ref)s...%(target_ref_type)s@%(target_ref)s', ['repo_name', 'source_ref_type', 'source_ref', 'target_ref_type', 'target_ref']);
209 pyroutes.register('tags_home', '/%(repo_name)s/tags', ['repo_name']);
212 pyroutes.register('tags_home', '/%(repo_name)s/tags', ['repo_name']);
@@ -112,10 +112,10 b' var CommitsController = function () {'
112 }
112 }
113
113
114 if (urlData['commit_id'] && urlData['f_path']) {
114 if (urlData['commit_id'] && urlData['f_path']) {
115 return pyroutes.url('repo_changelog_elements_file', urlData);
115 return pyroutes.url('repo_commits_elements_file', urlData);
116 }
116 }
117 else {
117 else {
118 return pyroutes.url('repo_changelog_elements', urlData);
118 return pyroutes.url('repo_commits_elements', urlData);
119 }
119 }
120
120
121 };
121 };
@@ -283,7 +283,7 b''
283
283
284 <ul id="context-pages" class="navigation horizontal-list">
284 <ul id="context-pages" class="navigation horizontal-list">
285 <li class="${is_active('summary')}"><a class="menulink" href="${h.route_path('repo_summary', repo_name=c.repo_name)}"><div class="menulabel">${_('Summary')}</div></a></li>
285 <li class="${is_active('summary')}"><a class="menulink" href="${h.route_path('repo_summary', repo_name=c.repo_name)}"><div class="menulabel">${_('Summary')}</div></a></li>
286 <li class="${is_active('changelog')}"><a class="menulink" href="${h.route_path('repo_changelog', repo_name=c.repo_name)}"><div class="menulabel">${_('Changelog')}</div></a></li>
286 <li class="${is_active('commits')}"><a class="menulink" href="${h.route_path('repo_commits', repo_name=c.repo_name)}"><div class="menulabel">${_('Commits')}</div></a></li>
287 <li class="${is_active('files')}"><a class="menulink" href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.rhodecode_db_repo.landing_rev[1], f_path='')}"><div class="menulabel">${_('Files')}</div></a></li>
287 <li class="${is_active('files')}"><a class="menulink" href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.rhodecode_db_repo.landing_rev[1], f_path='')}"><div class="menulabel">${_('Files')}</div></a></li>
288 <li class="${is_active('compare')}"><a class="menulink" href="${h.route_path('repo_compare_select',repo_name=c.repo_name)}"><div class="menulabel">${_('Compare')}</div></a></li>
288 <li class="${is_active('compare')}"><a class="menulink" href="${h.route_path('repo_compare_select',repo_name=c.repo_name)}"><div class="menulabel">${_('Compare')}</div></a></li>
289
289
@@ -15,7 +15,7 b''
15 </%def>
15 </%def>
16
16
17 <%def name="menu_bar_subnav()">
17 <%def name="menu_bar_subnav()">
18 ${self.repo_menu(active='changelog')}
18 ${self.repo_menu(active='commits')}
19 </%def>
19 </%def>
20
20
21 <%def name="main()">
21 <%def name="main()">
@@ -25,7 +25,7 b''
25 </%def>
25 </%def>
26
26
27 <%def name="menu_bar_subnav()">
27 <%def name="menu_bar_subnav()">
28 ${self.repo_menu(active='changelog')}
28 ${self.repo_menu(active='commits')}
29 </%def>
29 </%def>
30
30
31 <%def name="main()">
31 <%def name="main()">
@@ -23,7 +23,7 b''
23 </%def>
23 </%def>
24
24
25 <%def name="menu_bar_subnav()">
25 <%def name="menu_bar_subnav()">
26 ${self.repo_menu(active='changelog')}
26 ${self.repo_menu(active='commits')}
27 </%def>
27 </%def>
28
28
29 <%def name="main()">
29 <%def name="main()">
@@ -241,7 +241,7 b''
241
241
242 $("#clear_filter").on("click", function() {
242 $("#clear_filter").on("click", function() {
243 var filter = {'repo_name': '${c.repo_name}'};
243 var filter = {'repo_name': '${c.repo_name}'};
244 window.location = pyroutes.url('repo_changelog', filter);
244 window.location = pyroutes.url('repo_commits', filter);
245 });
245 });
246
246
247 $("#branch_filter").select2({
247 $("#branch_filter").select2({
@@ -295,7 +295,7 b''
295 else if (data.type == 'book'){
295 else if (data.type == 'book'){
296 filter["bookmark"] = selected;
296 filter["bookmark"] = selected;
297 }
297 }
298 window.location = pyroutes.url('repo_changelog', filter);
298 window.location = pyroutes.url('repo_commits', filter);
299 });
299 });
300
300
301 commitsController = new CommitsController();
301 commitsController = new CommitsController();
@@ -102,7 +102,7 b''
102 ## branch
102 ## branch
103 %if commit.branch:
103 %if commit.branch:
104 <span class="tag branchtag" title="${h.tooltip(_('Branch %s') % commit.branch)}">
104 <span class="tag branchtag" title="${h.tooltip(_('Branch %s') % commit.branch)}">
105 <a href="${h.route_path('repo_changelog',repo_name=c.repo_name,_query=dict(branch=commit.branch))}"><i class="icon-code-fork"></i>${h.shorter(commit.branch)}</a>
105 <a href="${h.route_path('repo_commits',repo_name=c.repo_name,_query=dict(branch=commit.branch))}"><i class="icon-code-fork"></i>${h.shorter(commit.branch)}</a>
106 </span>
106 </span>
107 %endif
107 %endif
108
108
@@ -42,7 +42,7 b''
42 %endfor
42 %endfor
43 <tr>
43 <tr>
44 <td colspan="6">
44 <td colspan="6">
45 <a id="file_history_overview_full" href="${h.route_path('repo_changelog_file',repo_name=c.repo_name, commit_id=c.commit_id, f_path=c.f_path)}">
45 <a id="file_history_overview_full" href="${h.route_path('repo_commits_file',repo_name=c.repo_name, commit_id=c.commit_id, f_path=c.f_path)}">
46 ${_('Show Full History')}
46 ${_('Show Full History')}
47 </a>
47 </a>
48 </td>
48 </td>
@@ -48,8 +48,8 b''
48 </a>
48 </a>
49 </li>
49 </li>
50 <li>
50 <li>
51 <a title="${_('Changelog')}" href="${h.route_path('repo_changelog',repo_name=repo_name)}">
51 <a title="${_('Commits')}" href="${h.route_path('repo_commits',repo_name=repo_name)}">
52 <span>${_('Changelog')}</span>
52 <span>${_('Commits')}</span>
53 </a>
53 </a>
54 </li>
54 </li>
55 <li>
55 <li>
@@ -641,7 +641,7 b' File Edit'
641 <span class="item">1.2 KiB</span>
641 <span class="item">1.2 KiB</span>
642 <span class="item last">text/x-python</span>
642 <span class="item last">text/x-python</span>
643 <div class="buttons">
643 <div class="buttons">
644 <a class="btn btn-mini" href="/example/changelog/80ead1899f50a894889e19ffeb49c9cebf5bf045/rhodecode/websetup.py">
644 <a class="btn btn-mini" href="/example/commits/80ead1899f50a894889e19ffeb49c9cebf5bf045/rhodecode/websetup.py">
645 <i class="icon-time"></i> history
645 <i class="icon-time"></i> history
646 </a>
646 </a>
647
647
@@ -182,7 +182,7 b''
182 if (path.indexOf("#") >= 0) {
182 if (path.indexOf("#") >= 0) {
183 path = path.slice(0, path.indexOf("#"));
183 path = path.slice(0, path.indexOf("#"));
184 }
184 }
185 var url = pyroutes.url('repo_changelog_file',
185 var url = pyroutes.url('repo_commits_file',
186 {'repo_name': templateContext.repo_name,
186 {'repo_name': templateContext.repo_name,
187 'commit_id': state.commit_id, 'f_path': path, 'limit': 6});
187 'commit_id': state.commit_id, 'f_path': path, 'limit': 6});
188 $('#file_history_container').show();
188 $('#file_history_container').show();
@@ -48,7 +48,7 b''
48 <span class="item">${h.format_byte_size_binary(c.file.size)}</span>
48 <span class="item">${h.format_byte_size_binary(c.file.size)}</span>
49 <span class="item last">${c.file.mimetype}</span>
49 <span class="item last">${c.file.mimetype}</span>
50 <div class="buttons">
50 <div class="buttons">
51 <a class="btn btn-mini" href="${h.route_path('repo_changelog_file',repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path)}">
51 <a class="btn btn-mini" href="${h.route_path('repo_commits_file',repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path)}">
52 <i class="icon-time"></i> ${_('history')}
52 <i class="icon-time"></i> ${_('history')}
53 </a>
53 </a>
54
54
@@ -72,7 +72,7 b''
72 ## branch link is only valid if it is a branch
72 ## branch link is only valid if it is a branch
73 <span class="tag">
73 <span class="tag">
74 %if c.pull_request.source_ref_parts.type == 'branch':
74 %if c.pull_request.source_ref_parts.type == 'branch':
75 <a href="${h.route_path('repo_changelog', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}">${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}</a>
75 <a href="${h.route_path('repo_commits', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}">${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}</a>
76 %else:
76 %else:
77 ${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}
77 ${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}
78 %endif
78 %endif
@@ -108,7 +108,7 b''
108 ## branch link is only valid if it is a branch
108 ## branch link is only valid if it is a branch
109 <span class="tag">
109 <span class="tag">
110 %if c.pull_request.target_ref_parts.type == 'branch':
110 %if c.pull_request.target_ref_parts.type == 'branch':
111 <a href="${h.route_path('repo_changelog', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}">${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}</a>
111 <a href="${h.route_path('repo_commits', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}">${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}</a>
112 %else:
112 %else:
113 ${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}
113 ${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}
114 %endif
114 %endif
@@ -82,7 +82,7 b''
82
82
83 <div class="pull-right">
83 <div class="pull-right">
84 <div class="buttons">
84 <div class="buttons">
85 <a id="file_history_overview_full" href="${h.route_path('repo_changelog_file',repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path',''))}">
85 <a id="file_history_overview_full" href="${h.route_path('repo_commits_file',repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path',''))}">
86 ${_('Show Full History')}
86 ${_('Show Full History')}
87 </a>
87 </a>
88 | ${h.link_to(_('Annotation'), h.route_path('repo_files:annotated', repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path','')))}
88 | ${h.link_to(_('Annotation'), h.route_path('repo_files:annotated', repo_name=entry.get('repository',''),commit_id=entry.get('commit_id', 'tip'),f_path=entry.get('f_path','')))}
@@ -119,7 +119,7 b''
119 <span>0</span> ${_('Commits')}
119 <span>0</span> ${_('Commits')}
120 % endif
120 % endif
121 % else:
121 % else:
122 <a href="${h.route_path('repo_changelog', repo_name=c.repo_name)}">
122 <a href="${h.route_path('repo_commits', repo_name=c.repo_name)}">
123 <i class="icon-tag"></i>
123 <i class="icon-tag"></i>
124 % if commit_rev == 1:
124 % if commit_rev == 1:
125 <span>${commit_rev}</span> ${_('Commit')}
125 <span>${commit_rev}</span> ${_('Commit')}
@@ -76,7 +76,7 b''
76 ## branch
76 ## branch
77 %if cs.branch:
77 %if cs.branch:
78 <span class="branchtag tag" title="${h.tooltip(_('Branch %s') % cs.branch)}">
78 <span class="branchtag tag" title="${h.tooltip(_('Branch %s') % cs.branch)}">
79 <a href="${h.route_path('repo_changelog',repo_name=c.repo_name,_query=dict(branch=cs.branch))}"><i class="icon-code-fork"></i>${h.shorter(cs.branch)}</a>
79 <a href="${h.route_path('repo_commits',repo_name=c.repo_name,_query=dict(branch=cs.branch))}"><i class="icon-code-fork"></i>${h.shorter(cs.branch)}</a>
80 </span>
80 </span>
81 %endif
81 %endif
82 </div>
82 </div>
@@ -35,7 +35,7 b' from rhodecode.tests import get_new_dir'
35 from rhodecode.tests.vcs.conftest import BackendTestMixin
35 from rhodecode.tests.vcs.conftest import BackendTestMixin
36
36
37
37
38 class TestBaseChangeset:
38 class TestBaseChangeset(object):
39
39
40 def test_is_deprecated(self):
40 def test_is_deprecated(self):
41 from rhodecode.lib.vcs.backends.base import BaseChangeset
41 from rhodecode.lib.vcs.backends.base import BaseChangeset
@@ -176,6 +176,10 b' class TestCommitsInNonEmptyRepo(BackendT'
176 commit_indexes = [c.idx for c in commits]
176 commit_indexes = [c.idx for c in commits]
177 assert commit_indexes == [1, 2, 3, 7, 12, 15]
177 assert commit_indexes == [1, 2, 3, 7, 12, 15]
178
178
179 def test_get_commit_by_index(self):
180 for idx in [1, 2, 3, 4]:
181 assert idx == self.repo.get_commit(commit_idx=idx).idx
182
179 def test_get_commit_by_branch(self):
183 def test_get_commit_by_branch(self):
180 for branch, commit_id in self.repo.branches.iteritems():
184 for branch, commit_id in self.repo.branches.iteritems():
181 assert commit_id == self.repo.get_commit(branch).raw_id
185 assert commit_id == self.repo.get_commit(branch).raw_id
General Comments 0
You need to be logged in to leave comments. Login now