From eaccc4ce163f332b77563404ab7b08ec52069fab Mon Sep 17 00:00:00 2001 From: Mathieu Bridon Date: Mar 19 2014 10:24:16 +0000 Subject: View a commit from the DB repo --- diff --git a/progit/app.py b/progit/app.py index da524c2..a3aeb96 100644 --- a/progit/app.py +++ b/progit/app.py @@ -344,10 +344,13 @@ def view_file(repo, identifier, filename): def view_commit(repo, commitid): """ Render a commit in a repo """ - reponame = os.path.join(APP.config['GIT_FOLDER'], repo) - if not os.path.exists(reponame): + repo = progit.lib.get_project(SESSION, repo) + + if repo is None: flask.abort(404) - repo_obj = pygit2.Repository(reponame) + + repo_obj = pygit2.Repository(os.path.join(APP.config["GIT_FOLDER"], + repo.path)) try: commit = repo_obj.get(commitid) diff --git a/progit/templates/commit.html b/progit/templates/commit.html index 970123e..bdfbe54 100644 --- a/progit/templates/commit.html +++ b/progit/templates/commit.html @@ -1,6 +1,6 @@ {% extends "master.html" %} -{% block title %}{{ repo }} - {{ commitid }}{% endblock %} +{% block title %}{{ repo.name }} - {{ commitid }}{% endblock %} {%block tag %}home{% endblock %} @@ -8,20 +8,20 @@

{% if '/fork/' in request.url %} - + {% else %} - + {% endif %} - {{ repo.split('.git')[0] }} + {{ repo.name }} {% if '/fork/' in request.url %} (tree) {% else %} (tree) {% endif %} @@ -50,10 +50,10 @@ {% for parent in commit.parents %} {% if '/fork/' in request.url %} + repo=repo.name, commitid=parent.oid.hex) }}"> {% else %} + repo=repo.name, commitid=parent.oid.hex) }}"> {% endif %} {{ parent.oid.hex }}