Luke Ross

Colorado

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

Web-based git repository viewer.

Commit 2e1fcc024ba6d04850c4616bc8cc1bacc7be4e10

Support for multi-line commits. Fork marker on index page.

Committed 28 Jul 2018 by Luke Ross

colorado/static/colorado.css

@@ -10,5 +10,6 @@
 .tidbit { font-style: italic; font-size: smaller; }
 
 #file-list { margin-top: 1em; }
+#rev-desc { white-space: pre }
 #rev-diff-id { display: inline-block; margin: 0; }
 #toolbar a { margin-right: 1ex; }


colorado/templates/index.xml

@@ -5,6 +5,9 @@
 <div meld:id="repo" class="repo-list-item">
 <h3><a href="#" meld:id="repo-name">Colorado</a></h3>
 <p meld:id="repo-desc">Description</p>
-<p class="tidbit">Last updated <span meld:id="repo-updated" title="2017-01-01 00:00:00">2017-01-01 00:00:00</span></p>
+<p class="tidbit">
+	<span meld:id="repo-forked">Fork - </span>
+	Last updated <span meld:id="repo-updated" title="2017-01-01 00:00:00">2017-01-01 00:00:00</span>
+</p>
 </div>
 </div>


colorado/templates/repo-revision.xml

@@ -15,7 +15,7 @@ Brief introduction to the repo.
 
 <h3 id="rev-diff-id">Commit <a href="#" meld:id="rev-id">abc123</a></h3>
 
-<p meld:id="rev-desc">Description</p>
+<p meld:id="rev-desc" id="rev-desc">Description</p>
 
 <p class="tidbit">Committed <a href="#" meld:id="rev-when" title="2017-01-01 12:34:34">2017-01-01 12:34:34</a> by
 <span meld:id="rev-author">Author</span></p>


colorado/views.py

@@ -187,6 +187,8 @@ def index():
 		updated = repo.get_master().commit.committed_datetime
 		ele.findmeld("repo-updated").content(arrow.get(updated).humanize())
 		ele.findmeld("repo-updated").set("title", updated.isoformat(" "))
+		if not repo.forked_from_git:
+			ele.findmeld("repo-forked").deparent()
 	return write_template(tpl)
 
 
@@ -350,7 +352,8 @@ def history_view(slug, type, id):
 				".top_level_view", slug=slug, type=type, id=thing.name
 			))
 		ele.set("id", "rev-" + c.hexsha)
-		ele.findmeld("rev-desc").content(c.message)
+		ele.findmeld("rev-desc").content(c.message.splitlines()[0])
+		ele.findmeld("rev-desc").set("title", c.message)
 		ele.findmeld("rev-desc").set("href", url_for(
 			".diff_view", slug=slug, id=c.hexsha
 		))
@@ -524,11 +527,16 @@ def tree_base_view(slug, type, id, repo, commit, tree, show_download=False):
 			ele.findmeld("file-name").set("title", nice_size(direntry.size))
 			if direntry.path in by_file:
 				file_commit = by_file[direntry.path]
-				ele.findmeld("file-revdesc").content(file_commit.message)
+				ele.findmeld("file-revdesc").content(
+					file_commit.message.splitlines()[0]
+				)
 				ele.findmeld("file-revdesc").set("href", url_for(
 					".diff_view", slug=slug, id=file_commit.hexsha
 				))
-				ele.findmeld("file-revdesc").set("title", file_commit.hexsha)
+				ele.findmeld("file-revdesc").set(
+					"title",
+					"{}\n{}".format(file_commit.hexsha, file_commit.message)
+				)
 				ele.findmeld("file-when").content(
 					arrow.get(file_commit.committed_datetime).humanize()
 				)
@@ -627,10 +635,16 @@ def trees_view(slug):
 		ele.findmeld("branch-name").set("href", url_for(
 			".top_level_view", slug=slug, type=type.lower(), id=thing.name
 		))
-		ele.findmeld("branch-revdesc").content(thing.commit.message)
+		ele.findmeld("branch-revdesc").content(
+			thing.commit.message.splitlines()[0]
+		)
 		ele.findmeld("branch-revdesc").set("href", url_for(
 			".diff_view", slug=slug, id=thing.commit.hexsha
 		))
+		ele.findmeld("branch-revdesc").set(
+			"title",
+			"{}\n{}".format(thing.commit.hexsha, thing.commit.message)
+		)
 		ele.findmeld("branch-when").content(
 			arrow.get(thing.commit.committed_datetime).humanize()
 		)


setup.py

@@ -4,7 +4,7 @@ from setuptools import setup
 
 setup(
 	name="Colorado",
-	version="0.4",
+	version="0.5",
 	description="Colorado git browser",
 	author="Luke Ross",
 	author_email="luke@lukeross.name",