1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-16 23:29:49 +00:00

improve file revisions

This commit is contained in:
lins05
2012-10-31 16:36:37 +08:00
parent d60d4338b9
commit 78579659ff
2 changed files with 2 additions and 8 deletions

View File

@@ -46,7 +46,7 @@
<td>{{ commit.revision_file_size|filesizeformat }} </td>
<td>
{% if not commit.is_current_version %}
{% if commit.id != repo.head_cmmt_id %}
<a href="{{ SITE_ROOT }}repo/revert_file/{{ repo.id }}/?commit={{ commit.id }}&p={{path|urlencode}}&from=file_revisions" class="op">{% trans 'Restore' %}</a>
{% endif %}
<a href="{{ SITE_ROOT }}repo/file_revisions/{{ repo.id }}/?commit={{ commit.id }}&p={{path|urlencode}}&op=download" class="op">{% trans 'Download' %}</a>

View File

@@ -2255,19 +2255,13 @@ def render_file_revisions (request, repo_id):
is_owner = False
try:
current_commit = get_commits(repo_id, 0, 1)[0]
current_file_id = get_file_revision_id_size (current_commit.id, path)[0]
for commit in commits:
file_id, file_size = get_file_revision_id_size (commit.id, path)
if not file_id or file_size is None:
# do not use no file_size, since it's ok to have file_size = 0
# do not use 'not file_size', since it's ok to have file_size = 0
return render_error(request)
commit.revision_file_size = file_size
commit.file_id = file_id
if file_id == current_file_id:
commit.is_current_version = True
else:
commit.is_current_version = False
except Exception, e:
return render_error(request, str(e))