Changeset View
Changeset View
Standalone View
Standalone View
swh/web/browse/views/revision.py
Show First 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | for i, change in enumerate(changes): | ||||
link_text = change['from_path'] + ' → ' + change['to_path'] | link_text = change['from_path'] + ' → ' + change['to_path'] | ||||
changes_msg.append('renamed: %s' % | changes_msg.append('renamed: %s' % | ||||
_gen_diff_link(i, panel_diff_link, link_text)) | _gen_diff_link(i, panel_diff_link, link_text)) | ||||
if not changes: | if not changes: | ||||
changes_msg.append('No changes') | changes_msg.append('No changes') | ||||
return mark_safe('\n'.join(changes_msg)) | return mark_safe('\n'.join(changes_msg)) | ||||
@browse_route(r'revision/(?P<sha1_git>[0-9a-f]+)/diff/', | @browse_route(r'revision/(?P<sha1_git>[0-9a-fA-F]+)/diff/', | ||||
view_name='diff-revision') | view_name='diff-revision') | ||||
def _revision_diff(request, sha1_git): | def _revision_diff(request, sha1_git): | ||||
""" | """ | ||||
Browse internal endpoint to compute revision diff | Browse internal endpoint to compute revision diff | ||||
""" | """ | ||||
try: | try: | ||||
revision = service.lookup_revision(sha1_git) | revision = service.lookup_revision(sha1_git) | ||||
snapshot_context = None | snapshot_context = None | ||||
Show All 21 Lines | def _revision_diff(request, sha1_git): | ||||
} | } | ||||
diff_data_json = json.dumps(diff_data, separators=(',', ': ')) | diff_data_json = json.dumps(diff_data, separators=(',', ': ')) | ||||
return HttpResponse(diff_data_json, content_type='application/json') | return HttpResponse(diff_data_json, content_type='application/json') | ||||
NB_LOG_ENTRIES = 100 | NB_LOG_ENTRIES = 100 | ||||
@browse_route(r'revision/(?P<sha1_git>[0-9a-f]+)/log/', | @browse_route(r'revision/(?P<sha1_git>[0-9a-fA-F]+)/log/', | ||||
view_name='browse-revision-log') | view_name='browse-revision-log') | ||||
def revision_log_browse(request, sha1_git): | def revision_log_browse(request, sha1_git): | ||||
""" | """ | ||||
Django view that produces an HTML display of the history | Django view that produces an HTML display of the history | ||||
log for a revision identified by its id. | log for a revision identified by its id. | ||||
The url that points to it is :http:get:`/browse/revision/(sha1_git)/log/` | The url that points to it is :http:get:`/browse/revision/(sha1_git)/log/` | ||||
""" # noqa | """ # noqa | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | return render(request, 'browse/revision-log.html', | ||||
'breadcrumbs': None, | 'breadcrumbs': None, | ||||
'top_right_link': None, | 'top_right_link': None, | ||||
'snapshot_context': None, | 'snapshot_context': None, | ||||
'vault_cooking': None, | 'vault_cooking': None, | ||||
'show_actions_menu': True, | 'show_actions_menu': True, | ||||
'swh_ids': None}) | 'swh_ids': None}) | ||||
@browse_route(r'revision/(?P<sha1_git>[0-9a-f]+)/', | @browse_route(r'revision/(?P<sha1_git>[0-9a-fA-F]+)/', | ||||
r'revision/(?P<sha1_git>[0-9a-f]+)/(?P<extra_path>.+)/', | r'revision/(?P<sha1_git>[0-9a-fA-F]+)/(?P<extra_path>.+)/', | ||||
view_name='browse-revision') | view_name='browse-revision') | ||||
def revision_browse(request, sha1_git, extra_path=None): | def revision_browse(request, sha1_git, extra_path=None): | ||||
""" | """ | ||||
Django view that produces an HTML display of a revision | Django view that produces an HTML display of a revision | ||||
identified by its id. | identified by its id. | ||||
The url that points to it is :http:get:`/browse/revision/(sha1_git)/`. | The url that points to it is :http:get:`/browse/revision/(sha1_git)/`. | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 291 Lines • Show Last 20 Lines |