##// END OF EJS Templates
archives: allows downloading refs that have slashes and special refs. e.g f/feat1 branch names.
marcink -
r3698:3343038b new-ui
parent child Browse files
Show More
@@ -1,488 +1,488 b''
1 1 # -*- coding: utf-8 -*-
2 2
3 3 # Copyright (C) 2016-2019 RhodeCode GmbH
4 4 #
5 5 # This program is free software: you can redistribute it and/or modify
6 6 # it under the terms of the GNU Affero General Public License, version 3
7 7 # (only), as published by the Free Software Foundation.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU Affero General Public License
15 15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 16 #
17 17 # This program is dual-licensed. If you wish to learn more about the
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20 from rhodecode.apps._base import add_route_with_slash
21 21
22 22
23 23 def includeme(config):
24 24
25 25 # repo creating checks, special cases that aren't repo routes
26 26 config.add_route(
27 27 name='repo_creating',
28 28 pattern='/{repo_name:.*?[^/]}/repo_creating')
29 29
30 30 config.add_route(
31 31 name='repo_creating_check',
32 32 pattern='/{repo_name:.*?[^/]}/repo_creating_check')
33 33
34 34 # Summary
35 35 # NOTE(marcink): one additional route is defined in very bottom, catch
36 36 # all pattern
37 37 config.add_route(
38 38 name='repo_summary_explicit',
39 39 pattern='/{repo_name:.*?[^/]}/summary', repo_route=True)
40 40 config.add_route(
41 41 name='repo_summary_commits',
42 42 pattern='/{repo_name:.*?[^/]}/summary-commits', repo_route=True)
43 43
44 44 # Commits
45 45 config.add_route(
46 46 name='repo_commit',
47 47 pattern='/{repo_name:.*?[^/]}/changeset/{commit_id}', repo_route=True)
48 48
49 49 config.add_route(
50 50 name='repo_commit_children',
51 51 pattern='/{repo_name:.*?[^/]}/changeset_children/{commit_id}', repo_route=True)
52 52
53 53 config.add_route(
54 54 name='repo_commit_parents',
55 55 pattern='/{repo_name:.*?[^/]}/changeset_parents/{commit_id}', repo_route=True)
56 56
57 57 config.add_route(
58 58 name='repo_commit_raw',
59 59 pattern='/{repo_name:.*?[^/]}/changeset-diff/{commit_id}', repo_route=True)
60 60
61 61 config.add_route(
62 62 name='repo_commit_patch',
63 63 pattern='/{repo_name:.*?[^/]}/changeset-patch/{commit_id}', repo_route=True)
64 64
65 65 config.add_route(
66 66 name='repo_commit_download',
67 67 pattern='/{repo_name:.*?[^/]}/changeset-download/{commit_id}', repo_route=True)
68 68
69 69 config.add_route(
70 70 name='repo_commit_data',
71 71 pattern='/{repo_name:.*?[^/]}/changeset-data/{commit_id}', repo_route=True)
72 72
73 73 config.add_route(
74 74 name='repo_commit_comment_create',
75 75 pattern='/{repo_name:.*?[^/]}/changeset/{commit_id}/comment/create', repo_route=True)
76 76
77 77 config.add_route(
78 78 name='repo_commit_comment_preview',
79 79 pattern='/{repo_name:.*?[^/]}/changeset/{commit_id}/comment/preview', repo_route=True)
80 80
81 81 config.add_route(
82 82 name='repo_commit_comment_delete',
83 83 pattern='/{repo_name:.*?[^/]}/changeset/{commit_id}/comment/{comment_id}/delete', repo_route=True)
84 84
85 85 # still working url for backward compat.
86 86 config.add_route(
87 87 name='repo_commit_raw_deprecated',
88 88 pattern='/{repo_name:.*?[^/]}/raw-changeset/{commit_id}', repo_route=True)
89 89
90 90 # Files
91 91 config.add_route(
92 92 name='repo_archivefile',
93 pattern='/{repo_name:.*?[^/]}/archive/{fname}', repo_route=True)
93 pattern='/{repo_name:.*?[^/]}/archive/{fname:.*}', repo_route=True)
94 94
95 95 config.add_route(
96 96 name='repo_files_diff',
97 97 pattern='/{repo_name:.*?[^/]}/diff/{f_path:.*}', repo_route=True)
98 98 config.add_route( # legacy route to make old links work
99 99 name='repo_files_diff_2way_redirect',
100 100 pattern='/{repo_name:.*?[^/]}/diff-2way/{f_path:.*}', repo_route=True)
101 101
102 102 config.add_route(
103 103 name='repo_files',
104 104 pattern='/{repo_name:.*?[^/]}/files/{commit_id}/{f_path:.*}', repo_route=True)
105 105 config.add_route(
106 106 name='repo_files:default_path',
107 107 pattern='/{repo_name:.*?[^/]}/files/{commit_id}/', repo_route=True)
108 108 config.add_route(
109 109 name='repo_files:default_commit',
110 110 pattern='/{repo_name:.*?[^/]}/files', repo_route=True)
111 111
112 112 config.add_route(
113 113 name='repo_files:rendered',
114 114 pattern='/{repo_name:.*?[^/]}/render/{commit_id}/{f_path:.*}', repo_route=True)
115 115
116 116 config.add_route(
117 117 name='repo_files:annotated',
118 118 pattern='/{repo_name:.*?[^/]}/annotate/{commit_id}/{f_path:.*}', repo_route=True)
119 119 config.add_route(
120 120 name='repo_files:annotated_previous',
121 121 pattern='/{repo_name:.*?[^/]}/annotate-previous/{commit_id}/{f_path:.*}', repo_route=True)
122 122
123 123 config.add_route(
124 124 name='repo_nodetree_full',
125 125 pattern='/{repo_name:.*?[^/]}/nodetree_full/{commit_id}/{f_path:.*}', repo_route=True)
126 126 config.add_route(
127 127 name='repo_nodetree_full:default_path',
128 128 pattern='/{repo_name:.*?[^/]}/nodetree_full/{commit_id}/', repo_route=True)
129 129
130 130 config.add_route(
131 131 name='repo_files_nodelist',
132 132 pattern='/{repo_name:.*?[^/]}/nodelist/{commit_id}/{f_path:.*}', repo_route=True)
133 133
134 134 config.add_route(
135 135 name='repo_file_raw',
136 136 pattern='/{repo_name:.*?[^/]}/raw/{commit_id}/{f_path:.*}', repo_route=True)
137 137
138 138 config.add_route(
139 139 name='repo_file_download',
140 140 pattern='/{repo_name:.*?[^/]}/download/{commit_id}/{f_path:.*}', repo_route=True)
141 141 config.add_route( # backward compat to keep old links working
142 142 name='repo_file_download:legacy',
143 143 pattern='/{repo_name:.*?[^/]}/rawfile/{commit_id}/{f_path:.*}',
144 144 repo_route=True)
145 145
146 146 config.add_route(
147 147 name='repo_file_history',
148 148 pattern='/{repo_name:.*?[^/]}/history/{commit_id}/{f_path:.*}', repo_route=True)
149 149
150 150 config.add_route(
151 151 name='repo_file_authors',
152 152 pattern='/{repo_name:.*?[^/]}/authors/{commit_id}/{f_path:.*}', repo_route=True)
153 153
154 154 config.add_route(
155 155 name='repo_files_remove_file',
156 156 pattern='/{repo_name:.*?[^/]}/remove_file/{commit_id}/{f_path:.*}',
157 157 repo_route=True)
158 158 config.add_route(
159 159 name='repo_files_delete_file',
160 160 pattern='/{repo_name:.*?[^/]}/delete_file/{commit_id}/{f_path:.*}',
161 161 repo_route=True)
162 162 config.add_route(
163 163 name='repo_files_edit_file',
164 164 pattern='/{repo_name:.*?[^/]}/edit_file/{commit_id}/{f_path:.*}',
165 165 repo_route=True)
166 166 config.add_route(
167 167 name='repo_files_update_file',
168 168 pattern='/{repo_name:.*?[^/]}/update_file/{commit_id}/{f_path:.*}',
169 169 repo_route=True)
170 170 config.add_route(
171 171 name='repo_files_add_file',
172 172 pattern='/{repo_name:.*?[^/]}/add_file/{commit_id}/{f_path:.*}',
173 173 repo_route=True)
174 174 config.add_route(
175 175 name='repo_files_create_file',
176 176 pattern='/{repo_name:.*?[^/]}/create_file/{commit_id}/{f_path:.*}',
177 177 repo_route=True)
178 178
179 179 # Refs data
180 180 config.add_route(
181 181 name='repo_refs_data',
182 182 pattern='/{repo_name:.*?[^/]}/refs-data', repo_route=True)
183 183
184 184 config.add_route(
185 185 name='repo_refs_changelog_data',
186 186 pattern='/{repo_name:.*?[^/]}/refs-data-changelog', repo_route=True)
187 187
188 188 config.add_route(
189 189 name='repo_stats',
190 190 pattern='/{repo_name:.*?[^/]}/repo_stats/{commit_id}', repo_route=True)
191 191
192 192 # Changelog
193 193 config.add_route(
194 194 name='repo_changelog',
195 195 pattern='/{repo_name:.*?[^/]}/changelog', repo_route=True)
196 196 config.add_route(
197 197 name='repo_changelog_file',
198 198 pattern='/{repo_name:.*?[^/]}/changelog/{commit_id}/{f_path:.*}', repo_route=True)
199 199 config.add_route(
200 200 name='repo_changelog_elements',
201 201 pattern='/{repo_name:.*?[^/]}/changelog_elements', repo_route=True)
202 202 config.add_route(
203 203 name='repo_changelog_elements_file',
204 204 pattern='/{repo_name:.*?[^/]}/changelog_elements/{commit_id}/{f_path:.*}', repo_route=True)
205 205
206 206 # Compare
207 207 config.add_route(
208 208 name='repo_compare_select',
209 209 pattern='/{repo_name:.*?[^/]}/compare', repo_route=True)
210 210
211 211 config.add_route(
212 212 name='repo_compare',
213 213 pattern='/{repo_name:.*?[^/]}/compare/{source_ref_type}@{source_ref:.*?}...{target_ref_type}@{target_ref:.*?}', repo_route=True)
214 214
215 215 # Tags
216 216 config.add_route(
217 217 name='tags_home',
218 218 pattern='/{repo_name:.*?[^/]}/tags', repo_route=True)
219 219
220 220 # Branches
221 221 config.add_route(
222 222 name='branches_home',
223 223 pattern='/{repo_name:.*?[^/]}/branches', repo_route=True)
224 224
225 225 # Bookmarks
226 226 config.add_route(
227 227 name='bookmarks_home',
228 228 pattern='/{repo_name:.*?[^/]}/bookmarks', repo_route=True)
229 229
230 230 # Forks
231 231 config.add_route(
232 232 name='repo_fork_new',
233 233 pattern='/{repo_name:.*?[^/]}/fork', repo_route=True,
234 234 repo_forbid_when_archived=True,
235 235 repo_accepted_types=['hg', 'git'])
236 236
237 237 config.add_route(
238 238 name='repo_fork_create',
239 239 pattern='/{repo_name:.*?[^/]}/fork/create', repo_route=True,
240 240 repo_forbid_when_archived=True,
241 241 repo_accepted_types=['hg', 'git'])
242 242
243 243 config.add_route(
244 244 name='repo_forks_show_all',
245 245 pattern='/{repo_name:.*?[^/]}/forks', repo_route=True,
246 246 repo_accepted_types=['hg', 'git'])
247 247 config.add_route(
248 248 name='repo_forks_data',
249 249 pattern='/{repo_name:.*?[^/]}/forks/data', repo_route=True,
250 250 repo_accepted_types=['hg', 'git'])
251 251
252 252 # Pull Requests
253 253 config.add_route(
254 254 name='pullrequest_show',
255 255 pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}',
256 256 repo_route=True)
257 257
258 258 config.add_route(
259 259 name='pullrequest_show_all',
260 260 pattern='/{repo_name:.*?[^/]}/pull-request',
261 261 repo_route=True, repo_accepted_types=['hg', 'git'])
262 262
263 263 config.add_route(
264 264 name='pullrequest_show_all_data',
265 265 pattern='/{repo_name:.*?[^/]}/pull-request-data',
266 266 repo_route=True, repo_accepted_types=['hg', 'git'])
267 267
268 268 config.add_route(
269 269 name='pullrequest_repo_refs',
270 270 pattern='/{repo_name:.*?[^/]}/pull-request/refs/{target_repo_name:.*?[^/]}',
271 271 repo_route=True)
272 272
273 273 config.add_route(
274 274 name='pullrequest_repo_targets',
275 275 pattern='/{repo_name:.*?[^/]}/pull-request/repo-targets',
276 276 repo_route=True)
277 277
278 278 config.add_route(
279 279 name='pullrequest_new',
280 280 pattern='/{repo_name:.*?[^/]}/pull-request/new',
281 281 repo_route=True, repo_accepted_types=['hg', 'git'],
282 282 repo_forbid_when_archived=True)
283 283
284 284 config.add_route(
285 285 name='pullrequest_create',
286 286 pattern='/{repo_name:.*?[^/]}/pull-request/create',
287 287 repo_route=True, repo_accepted_types=['hg', 'git'],
288 288 repo_forbid_when_archived=True)
289 289
290 290 config.add_route(
291 291 name='pullrequest_update',
292 292 pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}/update',
293 293 repo_route=True, repo_forbid_when_archived=True)
294 294
295 295 config.add_route(
296 296 name='pullrequest_merge',
297 297 pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}/merge',
298 298 repo_route=True, repo_forbid_when_archived=True)
299 299
300 300 config.add_route(
301 301 name='pullrequest_delete',
302 302 pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}/delete',
303 303 repo_route=True, repo_forbid_when_archived=True)
304 304
305 305 config.add_route(
306 306 name='pullrequest_comment_create',
307 307 pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}/comment',
308 308 repo_route=True)
309 309
310 310 config.add_route(
311 311 name='pullrequest_comment_delete',
312 312 pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}/comment/{comment_id}/delete',
313 313 repo_route=True, repo_accepted_types=['hg', 'git'])
314 314
315 315 # Artifacts, (EE feature)
316 316 config.add_route(
317 317 name='repo_artifacts_list',
318 318 pattern='/{repo_name:.*?[^/]}/artifacts', repo_route=True)
319 319
320 320 # Settings
321 321 config.add_route(
322 322 name='edit_repo',
323 323 pattern='/{repo_name:.*?[^/]}/settings', repo_route=True)
324 324 # update is POST on edit_repo
325 325
326 326 # Settings advanced
327 327 config.add_route(
328 328 name='edit_repo_advanced',
329 329 pattern='/{repo_name:.*?[^/]}/settings/advanced', repo_route=True)
330 330 config.add_route(
331 331 name='edit_repo_advanced_archive',
332 332 pattern='/{repo_name:.*?[^/]}/settings/advanced/archive', repo_route=True)
333 333 config.add_route(
334 334 name='edit_repo_advanced_delete',
335 335 pattern='/{repo_name:.*?[^/]}/settings/advanced/delete', repo_route=True)
336 336 config.add_route(
337 337 name='edit_repo_advanced_locking',
338 338 pattern='/{repo_name:.*?[^/]}/settings/advanced/locking', repo_route=True)
339 339 config.add_route(
340 340 name='edit_repo_advanced_journal',
341 341 pattern='/{repo_name:.*?[^/]}/settings/advanced/journal', repo_route=True)
342 342 config.add_route(
343 343 name='edit_repo_advanced_fork',
344 344 pattern='/{repo_name:.*?[^/]}/settings/advanced/fork', repo_route=True)
345 345
346 346 config.add_route(
347 347 name='edit_repo_advanced_hooks',
348 348 pattern='/{repo_name:.*?[^/]}/settings/advanced/hooks', repo_route=True)
349 349
350 350 # Caches
351 351 config.add_route(
352 352 name='edit_repo_caches',
353 353 pattern='/{repo_name:.*?[^/]}/settings/caches', repo_route=True)
354 354
355 355 # Permissions
356 356 config.add_route(
357 357 name='edit_repo_perms',
358 358 pattern='/{repo_name:.*?[^/]}/settings/permissions', repo_route=True)
359 359
360 360 # Permissions Branch (EE feature)
361 361 config.add_route(
362 362 name='edit_repo_perms_branch',
363 363 pattern='/{repo_name:.*?[^/]}/settings/branch_permissions', repo_route=True)
364 364 config.add_route(
365 365 name='edit_repo_perms_branch_delete',
366 366 pattern='/{repo_name:.*?[^/]}/settings/branch_permissions/{rule_id}/delete',
367 367 repo_route=True)
368 368
369 369 # Maintenance
370 370 config.add_route(
371 371 name='edit_repo_maintenance',
372 372 pattern='/{repo_name:.*?[^/]}/settings/maintenance', repo_route=True)
373 373
374 374 config.add_route(
375 375 name='edit_repo_maintenance_execute',
376 376 pattern='/{repo_name:.*?[^/]}/settings/maintenance/execute', repo_route=True)
377 377
378 378 # Fields
379 379 config.add_route(
380 380 name='edit_repo_fields',
381 381 pattern='/{repo_name:.*?[^/]}/settings/fields', repo_route=True)
382 382 config.add_route(
383 383 name='edit_repo_fields_create',
384 384 pattern='/{repo_name:.*?[^/]}/settings/fields/create', repo_route=True)
385 385 config.add_route(
386 386 name='edit_repo_fields_delete',
387 387 pattern='/{repo_name:.*?[^/]}/settings/fields/{field_id}/delete', repo_route=True)
388 388
389 389 # Locking
390 390 config.add_route(
391 391 name='repo_edit_toggle_locking',
392 392 pattern='/{repo_name:.*?[^/]}/settings/toggle_locking', repo_route=True)
393 393
394 394 # Remote
395 395 config.add_route(
396 396 name='edit_repo_remote',
397 397 pattern='/{repo_name:.*?[^/]}/settings/remote', repo_route=True)
398 398 config.add_route(
399 399 name='edit_repo_remote_pull',
400 400 pattern='/{repo_name:.*?[^/]}/settings/remote/pull', repo_route=True)
401 401 config.add_route(
402 402 name='edit_repo_remote_push',
403 403 pattern='/{repo_name:.*?[^/]}/settings/remote/push', repo_route=True)
404 404
405 405 # Statistics
406 406 config.add_route(
407 407 name='edit_repo_statistics',
408 408 pattern='/{repo_name:.*?[^/]}/settings/statistics', repo_route=True)
409 409 config.add_route(
410 410 name='edit_repo_statistics_reset',
411 411 pattern='/{repo_name:.*?[^/]}/settings/statistics/update', repo_route=True)
412 412
413 413 # Issue trackers
414 414 config.add_route(
415 415 name='edit_repo_issuetracker',
416 416 pattern='/{repo_name:.*?[^/]}/settings/issue_trackers', repo_route=True)
417 417 config.add_route(
418 418 name='edit_repo_issuetracker_test',
419 419 pattern='/{repo_name:.*?[^/]}/settings/issue_trackers/test', repo_route=True)
420 420 config.add_route(
421 421 name='edit_repo_issuetracker_delete',
422 422 pattern='/{repo_name:.*?[^/]}/settings/issue_trackers/delete', repo_route=True)
423 423 config.add_route(
424 424 name='edit_repo_issuetracker_update',
425 425 pattern='/{repo_name:.*?[^/]}/settings/issue_trackers/update', repo_route=True)
426 426
427 427 # VCS Settings
428 428 config.add_route(
429 429 name='edit_repo_vcs',
430 430 pattern='/{repo_name:.*?[^/]}/settings/vcs', repo_route=True)
431 431 config.add_route(
432 432 name='edit_repo_vcs_update',
433 433 pattern='/{repo_name:.*?[^/]}/settings/vcs/update', repo_route=True)
434 434
435 435 # svn pattern
436 436 config.add_route(
437 437 name='edit_repo_vcs_svn_pattern_delete',
438 438 pattern='/{repo_name:.*?[^/]}/settings/vcs/svn_pattern/delete', repo_route=True)
439 439
440 440 # Repo Review Rules (EE feature)
441 441 config.add_route(
442 442 name='repo_reviewers',
443 443 pattern='/{repo_name:.*?[^/]}/settings/review/rules', repo_route=True)
444 444
445 445 config.add_route(
446 446 name='repo_default_reviewers_data',
447 447 pattern='/{repo_name:.*?[^/]}/settings/review/default-reviewers', repo_route=True)
448 448
449 449 # Repo Automation (EE feature)
450 450 config.add_route(
451 451 name='repo_automation',
452 452 pattern='/{repo_name:.*?[^/]}/settings/automation', repo_route=True)
453 453
454 454 # Strip
455 455 config.add_route(
456 456 name='edit_repo_strip',
457 457 pattern='/{repo_name:.*?[^/]}/settings/strip', repo_route=True)
458 458
459 459 config.add_route(
460 460 name='strip_check',
461 461 pattern='/{repo_name:.*?[^/]}/settings/strip_check', repo_route=True)
462 462
463 463 config.add_route(
464 464 name='strip_execute',
465 465 pattern='/{repo_name:.*?[^/]}/settings/strip_execute', repo_route=True)
466 466
467 467 # Audit logs
468 468 config.add_route(
469 469 name='edit_repo_audit_logs',
470 470 pattern='/{repo_name:.*?[^/]}/settings/audit_logs', repo_route=True)
471 471
472 472 # ATOM/RSS Feed
473 473 config.add_route(
474 474 name='rss_feed_home',
475 475 pattern='/{repo_name:.*?[^/]}/feed/rss', repo_route=True)
476 476
477 477 config.add_route(
478 478 name='atom_feed_home',
479 479 pattern='/{repo_name:.*?[^/]}/feed/atom', repo_route=True)
480 480
481 481 # NOTE(marcink): needs to be at the end for catch-all
482 482 add_route_with_slash(
483 483 config,
484 484 name='repo_summary',
485 485 pattern='/{repo_name:.*?[^/]}', repo_route=True)
486 486
487 487 # Scan module for configuration decorators.
488 488 config.scan('.views', ignore='.tests')
General Comments 0
You need to be logged in to leave comments. Login now