aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@manus.(none)>2007-02-20 19:53:26 -0800
committerbnewbold <bnewbold@manus.(none)>2007-02-20 19:53:26 -0800
commitcce589d9b309679c8ea0a9bbed88e0093c1927f0 (patch)
tree853a3505741f036c0a7202bb9f144b4f31dddd03
parent7adab6520975d9a8650a214ca519f2357707bd65 (diff)
downloadbnewnet-cce589d9b309679c8ea0a9bbed88e0093c1927f0.tar.gz
bnewnet-cce589d9b309679c8ea0a9bbed88e0093c1927f0.zip
more git_browse files
-rw-r--r--bn_django/git_browse/templates/git_browse/base.html3
-rw-r--r--bn_django/git_browse/templates/git_browse/heads_table23
-rw-r--r--bn_django/git_browse/templates/git_browse/obj.html12
-rw-r--r--bn_django/git_browse/templates/git_browse/repository_info.html2
-rw-r--r--bn_django/git_browse/templates/git_browse/shortlog_table29
-rw-r--r--bn_django/git_browse/templates/git_browse/tags_table23
-rw-r--r--bn_django/git_browse/templates/git_browse/tree.html19
-rw-r--r--bn_django/git_browse/templates/git_browse/tree_table23
-rw-r--r--bn_django/git_browse/urls.py5
-rw-r--r--bn_django/git_browse/views.py2
10 files changed, 123 insertions, 18 deletions
diff --git a/bn_django/git_browse/templates/git_browse/base.html b/bn_django/git_browse/templates/git_browse/base.html
index d23ab55..1656ce0 100644
--- a/bn_django/git_browse/templates/git_browse/base.html
+++ b/bn_django/git_browse/templates/git_browse/base.html
@@ -10,8 +10,9 @@
{% block path %}
{{ block.super }}
+<a href="/code">code</a>
{% if object %}
- <a href="/code/{{ object.slug }}/">{{ object.name }}</a>
+ &raquo; <a href="/code/{{ object.slug }}/">{{ object.name }}</a>
[<a href="/code/{{ object.slug }}/tree/">browse</a>,
<a href="/code/{{ object.slug }}/log/">log</a>]
{% endif %}
diff --git a/bn_django/git_browse/templates/git_browse/heads_table b/bn_django/git_browse/templates/git_browse/heads_table
new file mode 100644
index 0000000..5840db0
--- /dev/null
+++ b/bn_django/git_browse/templates/git_browse/heads_table
@@ -0,0 +1,23 @@
+{% if heads %}
+<table class="gitbrowser">
+{% for h in heads.iteritems %}
+<tr>
+ <td class="head">
+ <a href="/code/{{object.slug}}/commit/{{ h.1 }}" class="subtle">
+ {{ h.0 }}</a></td>
+ <td class="links">
+ <a href="/code/{{object.slug}}/commit/{{ h.1 }}">commit</a> |
+ <a href="/code/{{object.slug}}/commit/{{ h.1 }}/zip"> zip </a></td>
+ <td class="hash">
+ {% if tags %}{% for t in tags.iteritems %}
+ {% ifequal h.1 t.1 %}
+ <a href="/code/{{object.slug}}/tag/{{ t.1 }}/" class="tag">
+ [{{ t.0 }}]</a>
+ {% endifequal %}{% endfor %}{% endif %}
+ <a href="/code/{{object.slug}}/obj/{{ h.1 }}" class="subtle">
+ {{ h.1 }}</a>
+ </td></tr>
+{% endfor %}
+</table>
+{% else %}No heads!{% endif %}
+
diff --git a/bn_django/git_browse/templates/git_browse/obj.html b/bn_django/git_browse/templates/git_browse/obj.html
index 0170eab..669091b 100644
--- a/bn_django/git_browse/templates/git_browse/obj.html
+++ b/bn_django/git_browse/templates/git_browse/obj.html
@@ -2,10 +2,14 @@
{% block gitbrowse %}
{% if contents %}
- <h3>Object sha1 hash: {{ hash }}<br />
- Size: {{ size|filesizeformat }}<br />
- Type: "{{ type }}"</h3>
- <pre>{{ contents }}</pre>
+ <h3>Object sha1 hash</h3>
+ {{ hash }}<br />
+ <h3>Size</h3>
+ {{ size|filesizeformat }}<br />
+ <h3>Type</h3>
+ "{{ type }}"
+ <h3>Raw Description</h3>
+ <pre class="large">{{ contents }}</pre>
{% else %}
<h3>No such object: {{ hash }}</h3>
{% endif %}
diff --git a/bn_django/git_browse/templates/git_browse/repository_info.html b/bn_django/git_browse/templates/git_browse/repository_info.html
index f45eeb8..9be33ee 100644
--- a/bn_django/git_browse/templates/git_browse/repository_info.html
+++ b/bn_django/git_browse/templates/git_browse/repository_info.html
@@ -2,7 +2,7 @@
{% block gitbrowse %}
{{ object.description }}
-<h3>Shortlog (<a href="/code/{{object.slug}}/log/">full log</a>)</h3>
+<h3>Shortlog (<a href="/code/{{object.slug}}/log/">full log</a>) (<a href="/code/{{object.slug}}/commit/">last commit</a>)</h3>
{% include "git_browse/shortlog_table" %}
<h3>Heads (<a href="/code/{{object.slug}}/tree/">browse</a>)</h3>
{% include "git_browse/heads_table" %}
diff --git a/bn_django/git_browse/templates/git_browse/shortlog_table b/bn_django/git_browse/templates/git_browse/shortlog_table
new file mode 100644
index 0000000..8a223ec
--- /dev/null
+++ b/bn_django/git_browse/templates/git_browse/shortlog_table
@@ -0,0 +1,29 @@
+{% if shortlog %}
+<table class="gitbrowser">
+{% for l in shortlog %}
+<tr>
+ <td class="date">
+ {{ l.date }}</td>
+ <td class="author">
+ {{ l.author }}</td>
+ <td class="description">
+ <a href="/code/{{object.slug}}/commit/{{ l.hash }}/" class="description">
+ {{ l.description|truncatewords:10 }}</a></td>
+ <td class="shorthash">
+ {% if heads %}{% for h in heads.iteritems %}
+ {% ifequal h.1 l.hash %}
+ <a href="/code/{{object.slug}}/head/{{ h.1 }}/" class="head">
+ [{{ h.0 }}]</a>
+ {% endifequal %}
+ {% endfor %}{% endif %}
+ {% if tags %}{% for t in tags.iteritems %}
+ {% ifequal l.hash t.1 %}
+ <a href="/code/{{object.slug}}/tag/{{ t.1 }}/" class="tag">
+ [{{ t.0 }}]</a>
+ {% endifequal %}{% endfor %}{% endif %}
+
+ <a href="/code/{{object.slug}}/commit/{{ l.hash }}" class="subtle">
+ <span class="hash">{{ l.shorthash }}</span></a>...</td></tr>
+{% endfor %}
+</table>
+{% else %}No shortlog!{% endif %}
diff --git a/bn_django/git_browse/templates/git_browse/tags_table b/bn_django/git_browse/templates/git_browse/tags_table
new file mode 100644
index 0000000..7df504a
--- /dev/null
+++ b/bn_django/git_browse/templates/git_browse/tags_table
@@ -0,0 +1,23 @@
+{% if tags %}
+<table class="gitbrowser">
+{% for t in tags.iteritems %}
+<tr>
+ <td class="tag">
+ <a href="/code/{{object.slug}}/tag/{{ h.1 }}" class="subtle">
+ {{ t.0 }}</a></td>
+ <td class="links">
+ <a href="/code/{{object.slug}}/tag/{{ t.1 }}">tag</a> |
+ <a href="/code/{{object.slug}}/commit/{{ t.1 }}">commit</a> |
+ <a href="/code/{{object.slug}}/commit/{{ t.1 }}/zip"> zip </a></td>
+ <td class="hash">
+ {% for h in heads.iteritems %}
+ {% ifequal h.1 t.1 %}
+ <a href="/code/{{object.slug}}/head/{{ h.1 }}/" class="head">
+ [{{ h.0 }}]</a>
+ {% endifequal %}
+ {% endfor %}
+ <a href="/code/{{object.slug}}/obj/{{ t.1 }}" class="subtle">
+ <span class="hash">{{ t.1 }}</span></a></td></tr>
+{% endfor %}
+</table>
+{% else %}No tags!{% endif %}
diff --git a/bn_django/git_browse/templates/git_browse/tree.html b/bn_django/git_browse/templates/git_browse/tree.html
index 046d85c..3c8c294 100644
--- a/bn_django/git_browse/templates/git_browse/tree.html
+++ b/bn_django/git_browse/templates/git_browse/tree.html
@@ -2,19 +2,22 @@
{% block gitbrowse %}
- {% if all_objs %}
<h3>Tree sha1 hash:</h3><br /> {{ hash }}<br />
<h3>Directory listing:</h3>
- {% for obj in all_objs %}
-[{{obj.type}}]
- {% ifequal obj.type 'blob'%}
- <a href='/code/{{ object.slug }}/obj/{{ obj.id }}/'>{{obj.name}}</a> {% else %}
- {% ifequal obj.type 'tree'%}
- <a href='/code/{{object.slug}}/tree/{{ obj.id }}/'>{{obj.name}}</a>
+ {% include tree_table %}
+ {% if tree_objs %}
+ {% for o in tree_objs %}
+ [{{o.type}}] {{ o.mode }}
+ {% ifequal o.type 'blob' %}
+ <a href='/code/{{ object.slug }}/blob/{{ o.id }}/'>{{o.name}}</a>
+ {% else %}
+ {% ifequal o.type 'tree' %}
+ <a href='/code/{{object.slug}}/tree/{{ o.id }}/'>{{o.name}}</a>
{% else %}
- <a href='/code/{{object.slug}}/obj/{{ obj.id }}/'>{{obj.name}}</a>
+ <a href='/code/{{object.slug}}/obj/{{ o.id }}/'>{{o.name}}</a>
{% endifequal %}{% endifequal %}
<br />
{% endfor %}
+ {% else %}No contents!
{% endif %}
{% endblock %}
diff --git a/bn_django/git_browse/templates/git_browse/tree_table b/bn_django/git_browse/templates/git_browse/tree_table
new file mode 100644
index 0000000..7df504a
--- /dev/null
+++ b/bn_django/git_browse/templates/git_browse/tree_table
@@ -0,0 +1,23 @@
+{% if tags %}
+<table class="gitbrowser">
+{% for t in tags.iteritems %}
+<tr>
+ <td class="tag">
+ <a href="/code/{{object.slug}}/tag/{{ h.1 }}" class="subtle">
+ {{ t.0 }}</a></td>
+ <td class="links">
+ <a href="/code/{{object.slug}}/tag/{{ t.1 }}">tag</a> |
+ <a href="/code/{{object.slug}}/commit/{{ t.1 }}">commit</a> |
+ <a href="/code/{{object.slug}}/commit/{{ t.1 }}/zip"> zip </a></td>
+ <td class="hash">
+ {% for h in heads.iteritems %}
+ {% ifequal h.1 t.1 %}
+ <a href="/code/{{object.slug}}/head/{{ h.1 }}/" class="head">
+ [{{ h.0 }}]</a>
+ {% endifequal %}
+ {% endfor %}
+ <a href="/code/{{object.slug}}/obj/{{ t.1 }}" class="subtle">
+ <span class="hash">{{ t.1 }}</span></a></td></tr>
+{% endfor %}
+</table>
+{% else %}No tags!{% endif %}
diff --git a/bn_django/git_browse/urls.py b/bn_django/git_browse/urls.py
index 77fabd3..4806f66 100644
--- a/bn_django/git_browse/urls.py
+++ b/bn_django/git_browse/urls.py
@@ -35,9 +35,8 @@ urlpatterns += patterns('bn_django.git_browse.views',
(r'^(?P<repo>[\w\-\_]*)/branches/$', 'view_branches',),
(r'^(?P<repo>[\w\-\_]*)/log/$', 'view_log',),
(r'^(?P<repo>[\w\-\_]*)/obj/(?P<hash>[0-9a-z]{40})/$', 'view_obj',),
- (r'^(?P<repo>[\w\-\_]*)/obj/(?P<hash>[0-9a-z]{40})/log/$', 'view_log',),
- (r'^(?P<repo>[\w\-\_]*)/commit/(?P<hash>[0-9a-z]{40})/$', 'view_commit',),
- (r'^(?P<repo>[\w\-\_]*)/commit/$', 'view_commit',),
+ (r'^(?P<repo>[\w\-\_]*)/commit/(?P<hash>[0-9a-z]{40})/$', 'view_obj',),
+ (r'^(?P<repo>[\w\-\_]*)/commit/$', 'view_obj',),
(r'^(?P<repo>[\w\-\_]*)/tag/(?P<hash>[0-9a-z]{40})/$', 'view_tag',),
(r'^(?P<repo>[\w\-\_]*)/blob/(?P<hash>[0-9a-z]{40})/$', 'view_blob',),
(r'^(?P<repo>[\w\-\_]*)/blob/(?P<hash>[0-9a-z]{40})/raw/$', 'view_blob',),
diff --git a/bn_django/git_browse/views.py b/bn_django/git_browse/views.py
index 3439c35..8a84241 100644
--- a/bn_django/git_browse/views.py
+++ b/bn_django/git_browse/views.py
@@ -57,7 +57,7 @@ def view_tree(request, repo, hash=None,branch=None):
if l[1] == 'tree':
tree_objs.append(tree_from_str(line))
if l[1] == 'blob':
- blob_objs.append(blob_from_str(line))
+ tree_objs.append(blob_from_str(line))
return render_to_response('git_browse/tree.html',
dict(object=therepo,