... | ... |
@@ -313,7 +313,7 @@ sub startup { |
313 | 313 |
|
314 | 314 |
# Commit |
315 | 315 |
$r->get('/commit/*diff' => template '/commit'); |
316 |
- |
|
316 |
+ |
|
317 | 317 |
# Commits |
318 | 318 |
$r->get('/commits/*rev_file' => template '/commits'); |
319 | 319 |
|
... | ... |
@@ -9,12 +9,21 @@ |
9 | 9 |
my $user = param('user'); |
10 | 10 |
my $project = param('project'); |
11 | 11 |
my $rev_file = param('rev_file'); |
12 |
+ |
|
13 |
+ my $return_atom = $rev_file =~ s/\.atom$// ? 1 : 0; |
|
14 |
+ |
|
12 | 15 |
my ($rev, $file) = $git->parse_rev_path($user, $project, $rev_file); |
13 | 16 |
my $page = param('page') || 0; |
14 | 17 |
|
15 | 18 |
# Commit |
16 | 19 |
my $commit = $git->get_commit($user, $project, $rev); |
17 |
- |
|
20 |
+ |
|
21 |
+ # Not found |
|
22 |
+ unless ($commit) { |
|
23 |
+ $self->render_not_found; |
|
24 |
+ return; |
|
25 |
+ } |
|
26 |
+ |
|
18 | 27 |
# Commits |
19 | 28 |
my $page_count = 30; |
20 | 29 |
my $commits = $git->get_commits( |
... | ... |
@@ -35,6 +44,28 @@ |
35 | 44 |
|
36 | 45 |
# Global variable |
37 | 46 |
stash(user => $user, project => $project, rev => $rev); |
47 |
+ |
|
48 |
+ if ($return_atom) { |
|
49 |
+ my $url = url_with->to_abs; |
|
50 |
+ |
|
51 |
+ my $xml = <<"EOS"; |
|
52 |
+<?xml version="1.0" encoding="UTF-8"?> |
|
53 |
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US"> |
|
54 |
+ <id>tag:gitprep,2008:/$user/$project/commits/$rev_file</id> |
|
55 |
+ <link type="application/atom+xml" rel="self" href="$url"/> |
|
56 |
+ <title>Recent Commits to $project:$rev</title> |
|
57 |
+ <updated>2013-03-29T22:16:25+09:00</updated> |
|
58 |
+EOS |
|
59 |
+ |
|
60 |
+ $xml .= <<"EOS"; |
|
61 |
+</feed> |
|
62 |
+EOS |
|
63 |
+ |
|
64 |
+ |
|
65 |
+ $self->res->headers->content_type('application/atom+xml'); |
|
66 |
+ $self->render(text => $xml); |
|
67 |
+ return; |
|
68 |
+ } |
|
38 | 69 |
%> |
39 | 70 |
|
40 | 71 |
% layout 'common', title => "Commit History \x{30fb} $user/$project"; |