From 80ef0017d47f536bf2c8c6af4b514efa50071a23 Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Sun, 16 Sep 2012 11:17:56 +0100 Subject: Initial commit Signed-off-by: Alberto Bertogli --- views/blob.html | 50 +++++++++++++++++++++++++++++++ views/branch.html | 42 ++++++++++++++++++++++++++ views/commit-list.html | 47 +++++++++++++++++++++++++++++ views/commit.html | 72 ++++++++++++++++++++++++++++++++++++++++++++ views/index.html | 29 ++++++++++++++++++ views/paginate.html | 15 ++++++++++ views/summary.html | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++ views/tree.html | 54 +++++++++++++++++++++++++++++++++ 8 files changed, 390 insertions(+) create mode 100644 views/blob.html create mode 100644 views/branch.html create mode 100644 views/commit-list.html create mode 100644 views/commit.html create mode 100644 views/index.html create mode 100644 views/paginate.html create mode 100644 views/summary.html create mode 100644 views/tree.html (limited to 'views') diff --git a/views/blob.html b/views/blob.html new file mode 100644 index 0000000..4d5f7d0 --- /dev/null +++ b/views/blob.html @@ -0,0 +1,50 @@ + + + + +% if not dirname.raw: +% relroot = './' +% else: +% relroot = '../' * (len(dirname.split('/')) - 1) +% end + +git » {{repo.name}} » + {{repo.branch}} » {{dirname.unicode}}/{{fname.unicode}} + + + + + + +

git » + {{repo.name}} » + {{repo.branch}} » + tree +

+ +

+ [{{repo.branch}}] / +% base = smstr(relroot) +% for c in dirname.split('/'): +% if not c.raw: continue + {{c.unicode}} / +% base += c + '/' +% end + {{!fname.html}} +

+ +% if has_colorizer(): +{{!colorize_blob(fname.unicode, blob)}} +% else: +
+{{blob}}
+
+% end + +
+ + + diff --git a/views/branch.html b/views/branch.html new file mode 100644 index 0000000..79ea880 --- /dev/null +++ b/views/branch.html @@ -0,0 +1,42 @@ + + + +git » {{repo.name}} » {{repo.branch}} + + + + + +

git » + {{repo.name}} » + {{repo.branch}} +

+ +

+Browse current source tree +

+ +% commits = repo.commits("refs/heads/" + repo.branch, +% limit = repo.info.commits_per_page, +% offset = repo.info.commits_per_page * offset) +% commits = list(commits) + +% if len(commits) == 0: +% abort(404, "No more commits") +% end + + +% include paginate nelem = len(commits), max_per_page = repo.info.commits_per_page, offset = offset + +% kwargs = dict(repo=repo, commits=commits, +% shorten=shorten, repo_root="../..") +% include commit-list **kwargs + +

+ +% include paginate nelem = len(commits), max_per_page = repo.info.commits_per_page, offset = offset + + + + diff --git a/views/commit-list.html b/views/commit-list.html new file mode 100644 index 0000000..3af9838 --- /dev/null +++ b/views/commit-list.html @@ -0,0 +1,47 @@ + +% def refs_to_html(refs): +% for ref in refs: +% c = ref.split('/', 2) +% if len(c) != 3: +% return +% end +% if c[1] == 'heads': +{{c[2]}} +% elif c[1] == 'tags': +% if c[2].endswith('^{}'): +% c[2] = c[2][:-3] +% end +{{c[2]}} +% end +% end +% end + + + +% refs = repo.refs() +% if not defined("commits"): +% commits = repo.commits(start_ref, limit = limit, offset = offset) +% end + +% for c in commits: + + + + + % if c.id in refs: + + % end + +% end +
+ {{c.author_date.utc.date()}} + + + {{shorten(c.subject)}} + + {{shorten(c.author_name, 26)}} + + % refs_to_html(refs[c.id]) +
+ diff --git a/views/commit.html b/views/commit.html new file mode 100644 index 0000000..9a9e99d --- /dev/null +++ b/views/commit.html @@ -0,0 +1,72 @@ + + + +git » {{repo.name}} » commit {{c.id[:7]}} + + + + + + +

git » + {{repo.name}} » commit {{c.id[:7]}} +

+ +

{{c.subject}}

+ + + + + + + +% for p in c.parents: + + +% end +
author{{c.author_name}} +
+ + {{c.author_date.utc}} UTC
committer{{c.author_name}} +
+ + {{c.author_date.utc}} UTC
parent{{p}}
+ +
+ +
+{{c.message.strip()}}
+
+ +
+ +% if c.diff.changes: + + +% for added, deleted, fname in c.diff.changes: + + + + + +% end +
{{!fname.html}}+{{added}}-{{deleted}}
+ +
+ +% if has_colorizer(): +{{!colorize_diff(c.diff.body)}} +% else: +
+{{c.diff.body}}
+
+% end + +
+ +% end + + + + diff --git a/views/index.html b/views/index.html new file mode 100644 index 0000000..b218b8b --- /dev/null +++ b/views/index.html @@ -0,0 +1,29 @@ + + + +git + + + + + +

git

+ + + + + + + + % for repo in sorted(repos.values(), key = lambda r: r.name): + + + + + %end +
projectdescription
{{repo.name}}{{repo.info.desc}}
+ + + + diff --git a/views/paginate.html b/views/paginate.html new file mode 100644 index 0000000..72f3156 --- /dev/null +++ b/views/paginate.html @@ -0,0 +1,15 @@ + +
+% if offset > 0: +← prev +% else: +← prev +% end +| +% if nelem >= max_per_page: +next → +% else: +next → +% end +
+ diff --git a/views/summary.html b/views/summary.html new file mode 100644 index 0000000..ce92a60 --- /dev/null +++ b/views/summary.html @@ -0,0 +1,81 @@ + + + +git » {{repo.name}} + + + + + +

git » {{repo.name}}

+ +

{{repo.info.desc}}

+ + +% if repo.info.web_url or repo.info.git_url: + + +% if repo.info.web_url: + + + + +% end +% if repo.info.git_url: + + + + +% end + +
website + {{repo.info.web_url}}
repository{{! '
'.join(repo.info.git_url.split())}}
+
+% end + +% if "master" in repo.branch_names(): +% kwargs = dict(repo = repo, start_ref = "refs/heads/master", +% limit = repo.info.commits_in_summary, +% shorten = shorten, repo_root = ".", offset = 0) +% include commit-list **kwargs +% end + +
+ + + + + + + % for b in repo.branch_names(): + + + + + + %end +
branches
{{b}}
+ +
+ +% tags = list(repo.tags()) +% if tags: + + + + + + % for name, obj_id in tags: + + + + %end +
tags
{{name}}
+% end + + + + diff --git a/views/tree.html b/views/tree.html new file mode 100644 index 0000000..9682065 --- /dev/null +++ b/views/tree.html @@ -0,0 +1,54 @@ + + + + +% if not dirname.raw: +% relroot = './' +% else: +% relroot = '../' * (len(dirname.split('/')) - 1) +% end + +git » {{repo.name}} » + {{repo.branch}} » {{dirname.unicode}} + + + + + +

git » + {{repo.name}} » + {{repo.branch}} » + tree +

+ +

+ [{{repo.branch}}] / +% base = smstr(relroot) +% for c in dirname.split('/'): +% if not c.raw: continue + {{c.unicode}} / +% base += c + '/' +% end +

+ + +% key_func = lambda (t, n, s): (0 if t == 'tree' else 1, n.raw) +% for type, name, size in sorted(tree.ls(dirname.raw), key = key_func): + +% if type == "blob": + + +% elif type == "tree": + +% end + +% end +
+ {{!name.html}}{{size}} + + {{!name.html}}/
+ + + -- cgit v1.2.3