Luke Ross

Colorado

4 releases git clone https://lukeross.name/projects/colorado.git/

Web-based git repository viewer.

Commit 8c117decae6b49e044bb094fdf23084db4eedbb8

Proper repo history links

Committed 17 Oct 2018 by Luke Ross

colorado/templates/repo-home.xml

@@ -25,7 +25,7 @@ Brief introduction to the repo.
 <tr meld:id="file">
 	<td><strong><a href="#" meld:id="file-name" title="1.2k">README.txt</a></strong></td>
 <td><a href="#" meld:id="file-revdesc">some change</a></td>
-<td meld:id="file-when" title="2017-06-01 12:34:45">2017-06-01 12:34:45</td>
+<td><a href="#" meld:id="file-when" title="2017-06-01 12:34:45">2017-06-01 12:34:45</a></td>
 </tr>
 </table>
 


colorado/views.py

@@ -3,6 +3,7 @@ import chardet
 from collections import defaultdict
 from flask import abort, Blueprint, current_app, make_response, send_file, \
 	url_for
+from gitdb.exc import BadName
 from io import BytesIO
 from itertools import chain
 from lxmlmeld import parse_xml
@@ -217,7 +218,7 @@ def look_up_thing(slug, type, id):
 	elif type == "commit":
 		try:
 			commit = git.commit(id)
-		except:
+		except (BadName, ValueError):
 			abort(404)
 		return repo, commit, commit
 	else:
@@ -543,6 +544,12 @@ def tree_base_view(slug, type, id, repo, commit, tree, show_download=False):
 				ele.findmeld("file-when").set(
 					"title", file_commit.committed_datetime.isoformat(" ")
 				)
+				ele.findmeld("file-when").set(
+					"href", url_for(
+						".history_view", slug=slug, type=type, id=id,
+						_anchor="rev-" + file_commit.hexsha
+					)
+				)
 		else:
 			ele.findmeld("file-name").content(direntry.name + "/")
 			ele.findmeld("file-name").attrib.pop("title")
@@ -658,3 +665,8 @@ def trees_view(slug):
 			make_tar_filename(slug, type.lower(), thing.name, thing.commit)
 		)
 	return write_template(tpl)
+
+
+@bp.route("/<slug>/feed", methods=["GET"])
+def feed_view(slug):
+	pass