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, ); |
impved merge commit logic
|
29 |
|
added branch and tag refs to...
|
30 |
# Branches |
improved commit page design
|
31 |
my $branch_refs = $git->references($user, $project, 'heads'); |
added branch and tag refs to...
|
32 |
my $branches = $branch_refs->{$commit->{id}} || []; |
33 |
|
|
34 |
# Tags |
|
35 |
my $tag_refs = $git->references($user, $project, 'tags'); |
|
improved commit page design
|
36 |
my $tags = $tag_refs->{$commit->{id}} || []; |
added branch and tag refs to...
|
37 |
|
cleanup
|
38 |
# Global variable for included template |
improved commit page blobdif...
|
39 |
stash( |
cleanup
|
40 |
rev => $rev, |
41 |
from_rev => $from_rev, |
|
add diff status bar to commi...
|
42 |
commit => $commit, |
43 |
parents => $commit->{parents} |
|
improved commit page blobdif...
|
44 |
); |
cleanup
|
45 | |
improve commits page design
|
46 |
layout 'common', title => "$commit->{title_short} \x{30fb} $commit_short_id"; |
47 |
%> |
|
add diff status bar to commi...
|
48 | |
improve commits page design
|
49 |
%= include '/include/header'; |
copy gitweblite soruce code
|
50 | |
improve commits page design
|
51 |
<div class="container"> |
52 |
<ul class="commits-summary"> |
|
53 |
<li> |
|
54 |
<ul class="commits-summary-header"> |
|
55 |
<li> |
|
56 |
<div> |
|
fixed commit page comment bu...
|
57 |
% if ($commit->{title_short} eq $commit->{title}) { |
58 |
<b><%= $commit->{title_short} %></b>; |
|
59 |
% } else { |
|
60 |
<% |
|
61 |
my $title_short = $commit->{title_short}; |
|
62 |
$title_short =~ s/\.\.\.\s*$//; |
|
63 |
my $title_tail = $commit->{title}; |
|
64 |
$title_tail =~ s/^\Q$title_short//; |
|
65 |
$title_tail =~ s/^\s+//; |
|
66 |
%> |
|
improve commits page design
|
67 |
<p><b><%= $title_short %>...</b></p> |
68 |
<p>...<%= $title_tail %></p> |
|
cleanup
|
69 |
% } |
improve commits page design
|
70 |
</div> |
71 | ||
72 |
% if (@{$commit->{comment}} > 1) { |
|
fixed commit page comment bu...
|
73 |
<div> |
improve commits page design
|
74 |
% for (my $i = 1; $i < @{$commit->{comment}}; $i++) { |
75 |
<div> |
|
improve commit page design
|
76 |
% warn $commit->{comment}[$i]; |
improve commits page design
|
77 |
<%= $commit->{comment}[$i] %> |
78 |
</div> |
|
79 |
% } |
|
fixed commit page comment bu...
|
80 |
</div> |
81 |
% } |
|
improve commits page design
|
82 |
% if (@$branches || @$tags) { |
improved commit page parents...
|
83 |
<div> |
improve commits page design
|
84 |
% for my $branch (@$branches) { |
85 |
<i class="icon-share-alt" style="padding-right:1px"></i><a href="<%= url_for("/$user/$project/tree/$branch") %>"><%= $branch %></a> |
|
86 |
% } |
|
improved commit page parents...
|
87 |
|
improve commits page design
|
88 |
% for my $tag (@$tags) { |
89 |
<span style="padding-left:5px"> |
|
90 |
<i class="icon-tag" style="padding-right:2px"></i><a href="<%= url_for("/$user/$project/tree/$tag") %>"><%= $tag %></a> |
|
91 |
</span> |
|
92 |
% } |
|
improved commit page parents...
|
93 |
</div> |
fixed commit page comment bu...
|
94 |
% } |
improve commits page design
|
95 |
</li> |
96 |
<li class="last-child"> |
|
97 |
<a class="btn btn-primary" href="<%= url_for("/$user/$project/tree/$commit->{id}") %>"> |
|
98 |
Browse files |
|
99 |
</a> |
|
100 |
</li> |
|
101 |
</ul> |
|
102 |
</li> |
|
103 |
<li class="last-child"> |
|
improve commit page design
|
104 |
<ul class="commits-summary-body"> |
105 |
<li> |
|
106 |
<span class="commits-summary-author"><%= $commit->{author_name} %></span> |
|
107 |
<span>commited on <span title="<%= $commit->{age_string_datetime_local} %>"><%= $commit->{age_string_date_local} %></span> |
|
108 |
</li> |
|
109 |
<li class="last-child"> |
|
110 |
% my $parents = $commit->{parents}; |
|
111 |
|
|
112 |
% if (@$parents == 0) { |
|
113 |
<div class="commits-summary-parent"> |
|
114 |
<span>0 parent</span> |
|
115 |
</div> |
|
116 |
% } elsif (@$parents == 1) { |
|
117 |
<div class="commits-summary-parent"> |
|
118 |
<span>1 parent</span> |
|
119 |
<a href="<%= url_for("/$user/$project/commit/$parents->[0]") %>"> |
|
120 |
<%= substr($parents->[0], 0, 7) %> |
|
121 |
</a> |
|
122 |
</div> |
|
123 |
% } else { |
|
124 |
<div class="commits-summary-parent"> |
|
125 |
<span>2 parents</span>: |
|
126 |
|
|
127 |
<a class="font-black" href="<%= url_for("/$user/$project/commit/$parents->[0]") %>"> |
|
128 |
<%= substr($parents->[0], 0, 7) %> |
|
129 |
</a> |
|
130 |
+ |
|
131 |
<a class="font-black" href="<%= url_for("/$user/$project/commit/$parents->[1]") %>"> |
|
132 |
<%= substr($parents->[1], 0, 7) %> |
|
133 |
</a> |
|
134 |
</div> |
|
135 |
% } |
|
136 |
<div class="commits-summary-commit-id"> |
|
137 |
commit <span><%= $commit->{id} %></span> |
|
improve commits page design
|
138 |
</div> |
improve commit page design
|
139 |
</li> |
140 |
</ul> |
|
improve commits page design
|
141 |
</li> |
142 |
</ul> |
|
143 | ||
add diff status bar to commi...
|
144 |
%= include '/include/commit_body'; |
improve commits page design
|
145 |
</div> |
146 | ||
147 |
%= include '/include/footer'; |