cleanup
|
1 |
<% |
2 |
# API |
|
cleanup
|
3 |
my $api = gitprep_api; |
cleanup
|
4 |
|
cleanup
|
5 |
# Paramters |
cleanup, rename repository t...
|
6 |
my $project = param('project'); |
cleanup
|
7 |
my $diff = param('diff'); |
cleanup
|
8 |
my ($from_rev, $rev) = $diff =~ /(.+)\.\.(.+)/; |
9 |
$rev = $diff unless defined $rev; |
|
cleanup
|
10 |
|
11 |
# Git |
|
revert encoding support
|
12 |
my $git = app->git; |
cleanup
|
13 |
|
cleanup
|
14 |
# Commit |
cleanup
|
15 |
my $commit = $git->get_commit($user, $project, $rev); |
remove warning
|
16 |
|
cleanup
|
17 |
unless ($commit) { |
do success xt tests
|
18 |
$self->reply->not_found; |
cleanup
|
19 |
return; |
20 |
} |
|
cleanup
|
21 |
my $author_date |
22 |
= $git->parse_date($commit->{author_epoch}, $commit->{author_tz}); |
|
cleanup
|
23 |
my $committer_date |
24 |
= $git->parse_date($commit->{committer_epoch}, $commit->{committer_tz}); |
|
cleanup
|
25 |
$commit->{author_date} = $git->timestamp($author_date); |
26 |
$commit->{committer_date} = $git->timestamp($committer_date); |
|
cleanup
|
27 |
$from_rev = $commit->{parent} unless defined $from_rev; |
add title
|
28 |
my $commit_short_id = substr($commit->{id}, 0, 7, ); |
add user page link from user...
|
29 |
my $commit_author_mail = $commit->{author_email}; |
30 |
my $commit_author_id = app->dbi->model('user')->select( |
|
31 |
'id', |
|
32 |
where => {mail => $commit_author_mail} |
|
33 |
)->value; |
|
impved merge commit logic
|
34 |
|
added branch and tag refs to...
|
35 |
# Branches |
cleanup tags
|
36 |
my $branch_refs = $git->references(app->rep_info($user, $project), 'heads'); |
added branch and tag refs to...
|
37 |
my $branches = $branch_refs->{$commit->{id}} || []; |
38 |
|
|
39 |
# Tags |
|
cleanup tags
|
40 |
my $tag_refs = $git->references(app->rep_info($user, $project), 'tags'); |
improved commit page design
|
41 |
my $tags = $tag_refs->{$commit->{id}} || []; |
added branch and tag refs to...
|
42 |
|
cleanup
|
43 |
# Global variable for included template |
improved commit page blobdif...
|
44 |
stash( |
cleanup
|
45 |
rev => $rev, |
46 |
from_rev => $from_rev, |
|
add diff status bar to commi...
|
47 |
commit => $commit, |
48 |
parents => $commit->{parents} |
|
improved commit page blobdif...
|
49 |
); |
cleanup
|
50 | |
improve commits page design
|
51 |
layout 'common', title => "$commit->{title_short} \x{30fb} $commit_short_id"; |
52 |
%> |
|
add diff status bar to commi...
|
53 | |
improve commits page design
|
54 |
%= include '/include/header'; |
copy gitweblite soruce code
|
55 | |
improve commits page design
|
56 |
<div class="container"> |
57 |
<ul class="commits-summary"> |
|
58 |
<li> |
|
59 |
<ul class="commits-summary-header"> |
|
60 |
<li> |
|
61 |
<div> |
|
fixed commit page comment bu...
|
62 |
% if ($commit->{title_short} eq $commit->{title}) { |
63 |
<b><%= $commit->{title_short} %></b>; |
|
64 |
% } else { |
|
65 |
<% |
|
66 |
my $title_short = $commit->{title_short}; |
|
67 |
$title_short =~ s/\.\.\.\s*$//; |
|
68 |
my $title_tail = $commit->{title}; |
|
69 |
$title_tail =~ s/^\Q$title_short//; |
|
70 |
$title_tail =~ s/^\s+//; |
|
71 |
%> |
|
improve commits page design
|
72 |
<p><b><%= $title_short %>...</b></p> |
73 |
<p>...<%= $title_tail %></p> |
|
cleanup
|
74 |
% } |
improve commits page design
|
75 |
</div> |
76 | ||
77 |
% if (@{$commit->{comment}} > 1) { |
|
fixed commit page comment bu...
|
78 |
<div> |
improve commits page design
|
79 |
% for (my $i = 1; $i < @{$commit->{comment}}; $i++) { |
80 |
<div> |
|
81 |
<%= $commit->{comment}[$i] %> |
|
82 |
</div> |
|
83 |
% } |
|
fixed commit page comment bu...
|
84 |
</div> |
85 |
% } |
|
improve commits page design
|
86 |
% if (@$branches || @$tags) { |
improved commit page parents...
|
87 |
<div> |
improve commits page design
|
88 |
% for my $branch (@$branches) { |
89 |
<i class="icon-share-alt" style="padding-right:1px"></i><a href="<%= url_for("/$user/$project/tree/$branch") %>"><%= $branch %></a> |
|
90 |
% } |
|
improved commit page parents...
|
91 |
|
improve commits page design
|
92 |
% for my $tag (@$tags) { |
93 |
<span style="padding-left:5px"> |
|
94 |
<i class="icon-tag" style="padding-right:2px"></i><a href="<%= url_for("/$user/$project/tree/$tag") %>"><%= $tag %></a> |
|
95 |
</span> |
|
96 |
% } |
|
improved commit page parents...
|
97 |
</div> |
fixed commit page comment bu...
|
98 |
% } |
improve commits page design
|
99 |
</li> |
100 |
<li class="last-child"> |
|
101 |
<a class="btn btn-primary" href="<%= url_for("/$user/$project/tree/$commit->{id}") %>"> |
|
102 |
Browse files |
|
103 |
</a> |
|
104 |
</li> |
|
105 |
</ul> |
|
106 |
</li> |
|
107 |
<li class="last-child"> |
|
improve commit page design
|
108 |
<ul class="commits-summary-body"> |
109 |
<li> |
|
add user page link from user...
|
110 |
<span class="commits-summary-author"> |
111 |
% if (defined $commit_author_id) { |
|
112 |
<a href="<%= url_for("/$commit_author_id") %>"><%= $commit_author_id %></a> |
|
113 |
% } else { |
|
114 |
<%= $commit->{author_name} %> |
|
115 |
% } |
|
116 |
</span> |
|
improve commit page design
|
117 |
<span>commited on <span title="<%= $commit->{age_string_datetime_local} %>"><%= $commit->{age_string_date_local} %></span> |
118 |
</li> |
|
119 |
<li class="last-child"> |
|
120 |
% my $parents = $commit->{parents}; |
|
121 |
|
|
122 |
% if (@$parents == 0) { |
|
123 |
<div class="commits-summary-parent"> |
|
124 |
<span>0 parent</span> |
|
125 |
</div> |
|
126 |
% } elsif (@$parents == 1) { |
|
127 |
<div class="commits-summary-parent"> |
|
128 |
<span>1 parent</span> |
|
129 |
<a href="<%= url_for("/$user/$project/commit/$parents->[0]") %>"> |
|
130 |
<%= substr($parents->[0], 0, 7) %> |
|
131 |
</a> |
|
132 |
</div> |
|
133 |
% } else { |
|
134 |
<div class="commits-summary-parent"> |
|
135 |
<span>2 parents</span>: |
|
136 |
|
|
137 |
<a class="font-black" href="<%= url_for("/$user/$project/commit/$parents->[0]") %>"> |
|
138 |
<%= substr($parents->[0], 0, 7) %> |
|
139 |
</a> |
|
140 |
+ |
|
141 |
<a class="font-black" href="<%= url_for("/$user/$project/commit/$parents->[1]") %>"> |
|
142 |
<%= substr($parents->[1], 0, 7) %> |
|
143 |
</a> |
|
144 |
</div> |
|
145 |
% } |
|
146 |
<div class="commits-summary-commit-id"> |
|
147 |
commit <span><%= $commit->{id} %></span> |
|
improve commits page design
|
148 |
</div> |
improve commit page design
|
149 |
</li> |
150 |
</ul> |
|
improve commits page design
|
151 |
</li> |
152 |
</ul> |
|
153 | ||
add diff status bar to commi...
|
154 |
%= include '/include/commit_body'; |
improve commits page design
|
155 |
</div> |
156 | ||
157 |
%= include '/include/footer'; |