added feature that get branc...
|
1 |
<% |
2 |
# API |
|
added compare branch popup t...
|
3 |
my $api = gitprep_api; |
added feature that get branc...
|
4 | |
5 |
# Parameters |
|
fix pull_request table bug
|
6 |
my $base_user_id = param('user'); |
7 |
my $base_project_id = param('project'); |
|
8 |
my $base_branch = param('rev1'); |
|
9 |
my $user_id_and_target_branch = param('rev2'); |
|
added feature that get branc...
|
10 |
my $page = param('page') || 0; |
add pull request form
|
11 |
my $expand = param('expand'); |
added feature that get branc...
|
12 |
|
fix pull_request table bug
|
13 |
# Default base branch |
14 |
$base_branch //= app->manager->default_branch($base_user_id, $base_project_id); |
|
15 |
|
|
16 |
# Base project |
|
17 |
my $base_project = app->dbi->model('project')->select( |
|
improve compare page popup
|
18 |
[ |
19 |
{__MY__ => '*'}, |
|
remove table __ prefix
|
20 |
{user => ['id']} |
improve compare page popup
|
21 |
], |
remove table __ prefix
|
22 |
where => {'project.id' => $base_project_id, 'user.id' => $base_user_id} |
fix pull_request table bug
|
23 |
)->one; |
24 |
|
|
get target branch logic
|
25 |
# Get target user, project, branch |
26 |
my $target_user_id; |
|
27 |
my $target_branch; |
|
28 |
my $target_project; |
|
fix pull_request table bug
|
29 |
if ($user_id_and_target_branch =~ /^([^:]+):(.+)/) { |
get target branch logic
|
30 |
$target_user_id = $1; |
31 |
$target_branch = $2; |
|
fix pull_request table bug
|
32 |
$target_project = $self->app->manager->child_project($base_user_id, $base_project_id, $target_user_id); |
get target branch logic
|
33 |
} |
fix pull_request table bug
|
34 |
else { |
35 |
$target_user_id = $base_user_id; |
|
36 |
$target_branch = $user_id_and_target_branch; |
|
37 |
$target_project = $base_project |
|
cleanup branch
|
38 |
} |
39 |
|
|
added feature that get branc...
|
40 |
# Git |
revert encoding support
|
41 |
my $git = $self->app->git; |
added feature that get branc...
|
42 |
|
add compare validation
|
43 |
my $errors; |
add create pull request logi...
|
44 |
if (lc $self->req->method eq 'post') { |
45 |
my $op = param('op'); |
|
46 |
|
|
47 |
if ($op eq 'create-pull-request') { |
|
add compare validation
|
48 |
|
49 |
# Parameters |
|
add create pull request logi...
|
50 |
my $title = param('title'); |
51 |
my $message = param('message'); |
|
52 |
|
|
add compare validation
|
53 |
# Validation |
54 |
my $vc = app->vc; |
|
55 |
my $validation = $vc->validation; |
|
add create pull request logi...
|
56 |
|
add compare validation
|
57 |
# Check title |
58 |
if (!(defined $title && length $title)) { |
|
59 |
$validation->add_failed(title => 'title is empty'); |
|
60 |
} |
|
61 |
elsif (length $title > 300) { |
|
62 |
$validation->add_failed(title => 'title is too long'); |
|
63 |
} |
|
add create pull request logi...
|
64 |
|
add compare validation
|
65 |
# Message |
66 |
if (!(defined $message && length $message)) { |
|
67 |
$message = ''; |
|
68 |
if (length $message > 1000) { |
|
69 |
$validation->add_failed(message => 'message is too long'); |
|
70 |
} |
|
add create pull request logi...
|
71 |
} |
add compare validation
|
72 |
|
73 |
if ($validation->is_valid) { |
|
74 |
|
|
75 |
my $project_row_id = app->dbi->model('project')->select( |
|
76 |
'project.row_id', |
|
remove table __ prefix
|
77 |
where => {'user.id' => $base_user_id, 'project.id' => $base_project_id} |
add pulls description
|
78 |
)->value; |
79 |
|
|
add compare validation
|
80 |
my $pull_request = app->dbi->model('pull_request')->select( |
81 |
where => { |
|
fix pull_request table bug
|
82 |
base_project => $project_row_id, |
83 |
base_branch => $base_branch, |
|
add compare validation
|
84 |
target_project => $target_project->{id}, |
85 |
target_branch => $target_branch |
|
86 |
} |
|
87 |
)->one; |
|
88 |
|
|
fix branches page
|
89 |
my $issue; |
add compare validation
|
90 |
if ($pull_request) { |
fix branches page
|
91 |
$issue = app->dbi->model('issue')->select( |
92 |
where => {pull_request => $pull_request->{row_id}} |
|
93 |
)->one; |
|
94 |
$self->redirect_to("/$base_user_id/$base_project_id/pull/$issue->{row_id}"); |
|
add compare validation
|
95 |
return; |
96 |
} |
|
97 |
else { |
|
98 |
my $now_tm = Time::Moment->now_utc; |
|
99 |
my $now_epoch = $now_tm->epoch; |
|
100 |
my $session_user_row_id = $api->session_user_row_id; |
|
fix compare page
|
101 |
my $new_issue_row_id; |
add compare validation
|
102 |
app->dbi->connector->txn(sub { |
fix compare page
|
103 |
|
add compare validation
|
104 |
# New pull request |
fix compare page
|
105 |
my $new_pull_request = { |
fix pull_request table bug
|
106 |
base_project => $project_row_id, |
107 |
base_branch => $base_branch, |
|
108 |
target_project => $target_project->{row_id}, |
|
add compare validation
|
109 |
target_branch => $target_branch, |
fix compare page
|
110 |
}; |
111 |
|
|
112 |
app->dbi->model('pull_request')->insert($new_pull_request); |
|
113 |
my $new_pull_request_row_id = app->dbi->execute("select LAST_INSERT_ROWID()")->value; |
|
114 |
|
|
115 |
# New issue |
|
116 |
my $new_issue = { |
|
add compare validation
|
117 |
title => $title, |
118 |
open => 1, |
|
119 |
open_time => $now_epoch, |
|
fix compare page
|
120 |
open_user => $session_user_row_id, |
121 |
pull_request => $new_pull_request_row_id |
|
add compare validation
|
122 |
}; |
fix compare page
|
123 |
app->dbi->model('issue')->insert($new_issue); |
124 |
$new_issue_row_id = app->dbi->execute("select LAST_INSERT_ROWID()")->value; |
|
add compare validation
|
125 |
|
fix compare page
|
126 |
# New issue message |
127 |
my $new_issue_message = { |
|
fix pulls page
|
128 |
issue => $new_issue_row_id, |
fix compare page
|
129 |
number => 1, |
add compare validation
|
130 |
message => $message, |
131 |
create_time => $now_epoch, |
|
132 |
update_time => $now_epoch, |
|
133 |
user => $session_user_row_id |
|
134 |
}; |
|
135 |
|
|
fix compare page
|
136 |
app->dbi->model('issue_message')->insert($new_issue_message); |
add compare validation
|
137 |
}); |
fix create pull request logi...
|
138 |
|
fix pulls page
|
139 |
$self->redirect_to("/$base_user_id/$base_project_id/pull/$new_issue_row_id"); |
add compare validation
|
140 |
return; |
141 |
} |
|
142 |
} |
|
143 |
else { |
|
144 |
$errors = $validation->messages; |
|
add create pull request logi...
|
145 |
} |
146 |
} |
|
147 |
} |
|
cleanup comapre
|
148 | |
149 |
# Can merge |
|
fix compare branch link
|
150 |
my $base_rep_info = app->rep_info($base_user_id, $base_project_id); |
cleanup comapre
|
151 |
my $merge_success; |
fix compare branch link
|
152 |
my $target_rep_info; |
cleanup comapre
|
153 |
if ($target_project) { |
fix compare branch link
|
154 |
$target_rep_info = app->rep_info($target_user_id, $target_project->{id}); |
cleanup comapre
|
155 |
} |
156 |
else { |
|
fix compare branch link
|
157 |
$target_rep_info = $base_rep_info; |
cleanup comapre
|
158 |
} |
159 |
|
|
160 |
# Create working repository if it don't exist |
|
fix pull_request table bug
|
161 |
$self->app->manager->create_work_rep($base_user_id, $base_project_id); |
cleanup comapre
|
162 |
|
163 |
# Lock working repository |
|
fix pull_request table bug
|
164 |
my $work_rep_info = app->work_rep_info($base_user_id, $base_project_id); |
cleanup comapre
|
165 |
{ |
166 |
my $lock_fh = $self->app->manager->lock_rep($work_rep_info); |
|
167 |
|
|
168 |
# Prepare merge |
|
169 |
$self->app->manager->prepare_merge( |
|
170 |
$work_rep_info, |
|
fix compare branch link
|
171 |
$base_rep_info, |
fix pull_request table bug
|
172 |
$base_branch, |
fix compare branch link
|
173 |
$target_rep_info, |
fix pull_request table bug
|
174 |
$target_branch |
cleanup comapre
|
175 |
); |
176 |
|
|
177 |
# Check merge automatically |
|
178 |
$merge_success = $self->app->manager->merge( |
|
179 |
$work_rep_info, |
|
fix compare branch link
|
180 |
$target_rep_info, |
fix pull_request table bug
|
181 |
$target_branch |
cleanup comapre
|
182 |
); |
183 |
} |
|
add create pull request logi...
|
184 |
|
added feature that get branc...
|
185 |
# Commits |
fix compare branch link
|
186 |
my $commits = $git->forward_commits($base_rep_info, $base_branch, $target_branch); |
added feature that get branc...
|
187 |
my $commits_count = @$commits; |
188 |
my $commits_date = {}; |
|
improved compare page commit...
|
189 |
my $authors = {}; |
added feature that get branc...
|
190 |
for my $commit (@$commits) { |
support time zone
|
191 |
my $date = $commit->{age_string_date_local}; |
added feature that get branc...
|
192 |
$commits_date->{$date} ||= []; |
improved compare page commit...
|
193 |
$authors->{$commit->{author}} = 1; |
added feature that get branc...
|
194 |
push @{$commits_date->{$date}}, $commit; |
195 |
} |
|
improved compare page commit...
|
196 |
my $authors_count = keys %$authors; |
added compare page file chan...
|
197 | |
198 |
# Start commit |
|
fix compare branch link
|
199 |
my $start_commit = $git->separated_commit($base_rep_info, $base_branch, $target_branch); |
added compare page file chan...
|
200 | |
201 |
# End commit |
|
fix compare branch link
|
202 |
my $end_commit = $git->get_commit($target_rep_info, $target_branch); |
cleanup
|
203 |
|
204 |
if (!$start_commit || !$end_commit) { |
|
do success xt tests
|
205 |
$self->reply->not_found; |
cleanup
|
206 |
return; |
207 |
} |
|
added compare page file chan...
|
208 |
|
fix compare base and head fo...
|
209 |
# Member projects |
210 |
my $member_projects = app->manager->member_projects($base_user_id, $base_project_id); |
|
211 |
unshift @$member_projects, $base_project; |
|
212 |
|
|
fix compare branch link
|
213 |
# Base branches |
214 |
my $base_branches = $git->branches($base_rep_info); |
|
215 |
@$base_branches = sort { $a->{commit}{age} <=> $b->{commit}{age} } @$base_branches; |
|
216 | ||
217 |
# Target branches |
|
218 |
my $target_branches = $git->branches($target_rep_info); |
|
219 |
@$target_branches = sort { $a->{commit}{age} <=> $b->{commit}{age} } @$target_branches; |
|
added base branch selection ...
|
220 |
|
add pull request form
|
221 |
# Can open pull request |
222 |
my $can_open_pull_request; |
|
223 |
if (keys %$commits_date && $expand) { |
|
224 |
$can_open_pull_request = 1; |
|
225 |
} |
|
226 |
|
|
cleanup merge and push logic
|
227 |
# commit_body args |
228 |
my %commit_body_args = ( |
|
229 |
id => $end_commit->{id}, |
|
230 |
from_id => $start_commit->{id}, |
|
231 |
rev => $end_commit->{id}, |
|
232 |
from_rev => $start_commit->{id} |
|
233 |
); |
|
234 | ||
fix pull_request table bug
|
235 |
layout 'common', title => "Comparing $base_branch...$target_branch \x{30fb} $base_user_id/$base_project_id"; |
added feature that get branc...
|
236 |
%> |
237 | ||
cleanup compare page
|
238 | |
improve compare page design
|
239 |
%= javascript begin |
240 |
$(document).ready(function () { |
|
fix compare base and head fo...
|
241 | |
242 |
// Change base fork |
|
243 |
$('#base-fork-btn').on('click', function () { |
|
244 |
$('#base-fork-popup') |
|
245 |
.css('display', 'block') |
|
246 |
.css('top', '40px') |
|
247 |
.css('left', '10px') |
|
248 |
; |
|
249 |
}); |
|
250 |
$('#base-fork-popup').on('click', function () { |
|
251 |
$('#base-fork-popup').css('display', 'none'); |
|
252 |
}); |
|
253 |
// close popup |
|
254 |
$(document).click(function() { $('#base-fork-popup').hide(); }); |
|
255 |
$('#base-fork-btn').click(function() { event.stopPropagation(); }); |
|
256 |
$('#base-fork-popup').click(function() { event.stopPropagation(); }); |
|
257 | ||
258 | ||
259 |
// Change head fork |
|
260 |
$('#head-fork-btn').on('click', function () { |
|
261 |
$('#head-fork-popup') |
|
262 |
.css('display', 'block') |
|
263 |
.css('top', '40px') |
|
264 |
.css('left', '10px') |
|
265 |
; |
|
266 |
}); |
|
267 |
$('#head-fork-popup').on('click', function () { |
|
268 |
$('#head-fork-popup').css('display', 'none'); |
|
269 |
}); |
|
270 |
// close popup |
|
271 |
$(document).click(function() { $('#head-fork-popup').hide(); }); |
|
272 |
$('#head-fork-btn').click(function() { event.stopPropagation(); }); |
|
273 |
$('#head-fork-popup').click(function() { event.stopPropagation(); }); |
|
274 | ||
improve compare page design
|
275 |
// Change base branch |
276 |
$('#base-branch-btn').on('click', function () { |
|
277 |
$('#base-branch-popup') |
|
278 |
.css('display', 'block') |
|
279 |
.css('top', '40px') |
|
280 |
.css('left', '10px') |
|
281 |
; |
|
282 |
}); |
|
283 |
$('#base-branch-close').on('click', function () { |
|
284 |
$('#base-branch-popup').css('display', 'none'); |
|
285 |
}); |
|
286 |
$('[name=base-branch]').on('keypress', function (e) { |
|
287 |
// Enter |
|
288 |
if (e.which == 13) { |
|
fix compare branch link
|
289 |
var href; |
improve compare page popup
|
290 |
% if ($base_user_id eq $target_user_id) { |
fix compare branch link
|
291 |
href = '<%= url_for("/$base_user_id/$base_project_id/compare/") %>' + $(this).val() + '...<%= $target_branch %>'; |
improve compare page popup
|
292 |
% } else { |
fix compare branch link
|
293 |
href = '<%= url_for("/$base_user_id/$base_project_id/compare/") %>' + $(this).val() + '...<%= $target_user_id %>:<%= $target_branch %>'; |
improve compare page popup
|
294 |
% } |
295 |
|
|
show not able to merge
|
296 |
if (<%= $expand ? 1 : 0 %>) { |
297 |
href = href + '?expand=1'; |
|
298 |
} |
|
fix compare branch link
|
299 |
|
show not able to merge
|
300 |
location.href = href; |
improve compare page design
|
301 |
} |
302 |
}); |
|
fix compare base and head fo...
|
303 |
// close popup |
improve compare page popup
|
304 |
$(document).click(function() { $('#base-branch-popup').hide(); }); |
305 |
$('#base-branch-btn').click(function() { event.stopPropagation(); }); |
|
306 |
$('#base-branch-popup').click(function() { event.stopPropagation(); }); |
|
show not able to merge
|
307 |
|
improve compare page design
|
308 |
// Change compare branch |
fix compare branch link
|
309 |
$('#target-branch-btn').on('click', function () { |
310 |
$('#target-branch-popup') |
|
improve compare page design
|
311 |
.css('display', 'block') |
312 |
.css('top', '40px') |
|
313 |
.css('left', '96px') |
|
314 |
; |
|
315 |
}); |
|
fix compare branch link
|
316 |
$('#target-branch-close').on('click', function () { |
317 |
$('#target-branch-popup').css('display', 'none'); |
|
improve compare page design
|
318 |
}); |
fix compare branch link
|
319 |
$('[name=target-branch]').on('keypress', function (e) { |
improve compare page design
|
320 |
// Enter |
321 |
if (e.which == 13) { |
|
fix pull_request table bug
|
322 |
var href = '<%= url_for("/$base_user_id/$base_project_id/compare/") %>' + '<%= $base_branch %>...' + $(this).val(); |
show not able to merge
|
323 |
if (<%= $expand ? 1 : 0 %>) { |
324 |
href = href + '?expand=1'; |
|
325 |
} |
|
326 |
location.href = href; |
|
improve compare page design
|
327 |
} |
improved compare page design
|
328 |
}); |
fix compare base and head fo...
|
329 |
// close popup |
fix compare branch link
|
330 |
$(document).click(function() { $('#target-branch-popup').hide(); }); |
331 |
$('#target-branch-btn').click(function() { event.stopPropagation(); }); |
|
332 |
$('#target-branch-popup').click(function() { event.stopPropagation(); }); |
|
improve compare page popup
|
333 | |
improve compare page design
|
334 |
}); |
335 |
% end |
|
cleanup
|
336 | |
improve compare page design
|
337 |
%= include '/include/header'; |
cleanup
|
338 | |
improve compare page design
|
339 |
<div class="container"> |
add compare validation
|
340 |
%= include '/include/errors', errors => $errors; |
341 |
|
|
add pull request form
|
342 |
<div class="topic1"> |
343 |
% if ($can_open_pull_request) { |
|
344 |
Open a pull request |
|
345 |
% } else { |
|
346 |
Comparing changes |
|
347 |
% } |
|
348 |
</div> |
|
improve compare page design
|
349 |
<div class="compare-select"> |
350 |
<div> |
|
351 |
<div> |
|
improve compare page popup
|
352 |
<div style="display:inline-block"> |
353 |
% if ($base_user_id ne $target_user_id) { |
|
354 |
<button id="base-fork-btn" class="btn btn-small"> |
|
remove table __ prefix
|
355 |
<span>base fork:</span><b> <%= $base_project->{'user.id'} %>/<%= $base_project->{id} %></b><i class="icon-arrow-down"></i> |
improve compare page popup
|
356 |
</button> |
357 |
% } |
|
358 |
<button id="base-branch-btn" class="btn btn-small"> |
|
359 |
<span>base:</span><b> <%= $base_branch %></b><i class="icon-arrow-down"></i> |
|
360 |
</button> |
|
361 |
... |
|
362 |
</div> |
|
complete pull request logic
|
363 |
<div style="display:inline-block;margin-top:10px;"> |
improve compare page popup
|
364 |
% if ($base_user_id ne $target_user_id) { |
365 |
<button id="head-fork-btn" class="btn btn-small"> |
|
remove table __ prefix
|
366 |
<span>head fork:</span><b> <%= $target_project->{'user.id'} %>/<%= $target_project->{id} %></b><i class="icon-arrow-down"></i> |
improve compare page popup
|
367 |
</button> |
368 |
% } |
|
fix compare branch link
|
369 |
<button id="target-branch-btn" class="btn btn-small"> |
improve compare page popup
|
370 |
<span>compare:</span> <b><%= $target_branch %></b><i class="icon-arrow-down"></i> |
371 |
</button> |
|
add automatical merge checki...
|
372 |
|
improve compare page popup
|
373 |
% if ($can_open_pull_request) { |
374 |
% if ($merge_success) { |
|
375 |
<span style="margin-left:10px"> |
|
376 |
<span style="color:green;font-weight:bold"><%= "\x{2714}" %>Able to merge.</span> These branches can be automatically merged. |
|
377 |
</span> |
|
378 |
% } else { |
|
379 |
<span style="margin-left:10px"> |
|
issue belong to project
|
380 |
<span style="color:red;font-weight:bold">Not able to merge.</span> These branches can't be automatically merged. |
improve compare page popup
|
381 |
</span> |
382 |
% } |
|
show not able to merge
|
383 |
% } |
improve compare page popup
|
384 |
</div> |
cleanup
|
385 |
</div> |
improve compare page design
|
386 |
</div> |
show not able to merge
|
387 | |
388 |
<div id="base-branch-popup" style="display:none;width:330px;position:absolute"> |
|
389 |
<div class="radius-top border-gray" style="background:#E6E6FA;padding:10px"> |
|
390 |
<div style="overflow:hidden"> |
|
391 |
<div style="float:left;width:90%;"> |
|
392 |
<b>Choose a base branch</b> |
|
393 |
</div> |
|
394 |
<div style="float:left:width:10%;text-align:right;"> |
|
395 |
<i id="base-branch-close" class="icon-remove-circle"></i> |
|
added base branch selection ...
|
396 |
</div> |
show pull request only when ...
|
397 |
</div> |
improve compare page design
|
398 |
</div> |
show not able to merge
|
399 |
<div class="border-gray" style="background:#F5F5F5;border-top:none;border-bottom:none;text-align:center;padding:10px 0"> |
400 |
%= text_field 'base-branch', style => 'margin-bottom:0;width:270px', placeholder => 'Branch, tag, commit, or history marker'; |
|
401 |
</div> |
|
402 |
<div style="background:white;max-height:500px;overflow:auto;"> |
|
403 |
<ul class="nav nav-tabs nav-stacked"> |
|
fix compare branch link
|
404 |
% for (my $i = 0; $i < @$base_branches; $i++) { |
405 |
% my $branch = $base_branches->[$i]; |
|
show not able to merge
|
406 |
<li> |
fix compare branch link
|
407 |
<% |
408 |
my $url; |
|
409 |
if ($base_user_id eq $target_user_id) { |
|
410 |
$url = url_with("/$base_user_id/$base_project_id/compare/$branch->{name}...$target_branch"); |
|
411 |
} |
|
412 |
else { |
|
413 |
$url = url_with("/$base_user_id/$base_project_id/compare/$branch->{name}...$target_user_id:$target_branch"); |
|
414 |
} |
|
415 |
%> |
|
show not able to merge
|
416 |
<a style="border-top-left-radius:0px;border-top-right-radius:0px;" |
fix compare branch link
|
417 |
href="<%= $url %>"> |
show not able to merge
|
418 |
<%= $branch->{name} %> |
419 |
</a> |
|
420 |
</li> |
|
421 |
% } |
|
422 |
</ul> |
|
423 |
</div> |
|
424 |
</div> |
|
425 | ||
fix compare branch link
|
426 |
<div id="target-branch-popup" style="display:none;width:330px;position:absolute"> |
improve compare page design
|
427 |
<div class="radius-top border-gray" style="background:#E6E6FA;padding:10px"> |
428 |
<div style="overflow:hidden"> |
|
429 |
<div style="float:left;width:90%;"> |
|
430 |
<b>Choose a compare branch</b> |
|
431 |
</div> |
|
432 |
<div style="float:left:width:10%;text-align:right;"> |
|
fix compare branch link
|
433 |
<i id="target-branch-close" class="icon-remove-circle"></i> |
added compare branch popup t...
|
434 |
</div> |
435 |
</div> |
|
436 |
</div> |
|
improve compare page design
|
437 |
<div class="border-gray" style="background:#F5F5F5;border-top:none;border-bottom:none;text-align:center;padding:10px 0"> |
fix compare branch link
|
438 |
%= text_field 'target-branch', style => 'margin-bottom:0;width:270px', placeholder => 'Branch, tag, commit, or history marker'; |
improve compare page design
|
439 |
</div> |
440 |
<div style="background:white;max-height:500px;overflow:auto;"> |
|
fix compare base and head fo...
|
441 |
<ul class="nav nav-tabs nav-stacked"> |
442 |
% for (my $i = 0; $i < @$target_branches; $i++) { |
|
443 |
% my $target_branch = $target_branches->[$i]; |
|
444 |
<li> |
|
445 |
<% |
|
446 |
my $url; |
|
447 |
if ($base_user_id eq $target_user_id) { |
|
448 |
$url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$target_branch->{name}"); |
|
449 |
} |
|
450 |
else { |
|
451 |
$url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$target_user_id:$target_branch->{name}"); |
|
452 |
} |
|
453 |
%> |
|
454 |
<a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= $url %>"> |
|
455 |
<%= $target_branch->{name} %> |
|
456 |
</a> |
|
457 |
</li> |
|
458 |
% } |
|
459 |
</ul> |
|
460 |
</div> |
|
461 |
</div> |
|
462 | ||
463 | ||
464 |
<div id="base-fork-popup" style="display:none;width:330px;position:absolute"> |
|
465 |
<div class="radius-top border-gray" style="background:#E6E6FA;padding:10px"> |
|
466 |
<div style="overflow:hidden"> |
|
467 |
<div style="float:left;width:90%;"> |
|
468 |
<b>Choose a base fork</b> |
|
469 |
</div> |
|
470 |
<div style="float:left:width:10%;text-align:right;"> |
|
471 |
<i id="member-project-close" class="icon-remove-circle"></i> |
|
472 |
</div> |
|
473 |
</div> |
|
474 |
</div> |
|
475 |
<div style="background:white;max-height:500px;overflow:auto;"> |
|
476 |
<ul class="nav nav-tabs nav-stacked"> |
|
477 |
% for (my $i = 0; $i < @$member_projects; $i++) { |
|
478 |
% my $member_project = $member_projects->[$i]; |
|
fix compare branch link
|
479 |
<% |
remove table __ prefix
|
480 |
my $member_user_id = $member_project->{'user.id'}; |
fix compare base and head fo...
|
481 |
my $member_project_id = $member_project->{id}; |
fix compare branch link
|
482 |
%> |
fix compare base and head fo...
|
483 |
<li> |
484 |
<% |
|
485 |
my $url; |
|
486 |
if ($member_user_id eq $target_user_id) { |
|
487 |
$url = url_with("/$member_user_id/$member_project_id/compare/$base_branch...$target_branch"); |
|
488 |
} |
|
489 |
else { |
|
490 |
$url = url_with("/$member_user_id/$member_project_id/compare/$base_branch...$target_user_id:$target_branch"); |
|
491 |
} |
|
492 |
%> |
|
493 |
<a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= $url %>"> |
|
494 |
<%= $member_user_id %>/<%= $member_project_id %> |
|
495 |
</a> |
|
496 |
</li> |
|
497 |
% } |
|
498 |
</ul> |
|
499 |
</div> |
|
500 |
</div> |
|
501 | ||
502 | ||
503 | ||
504 | ||
505 |
<div id="head-fork-popup" style="display:none;width:330px;position:absolute"> |
|
506 |
<div class="radius-top border-gray" style="background:#E6E6FA;padding:10px"> |
|
507 |
<div style="overflow:hidden"> |
|
508 |
<div style="float:left;width:90%;"> |
|
509 |
<b>Choose a head fork</b> |
|
510 |
</div> |
|
511 |
<div style="float:left:width:10%;text-align:right;"> |
|
512 |
<i id="member-project-close" class="icon-remove-circle"></i> |
|
513 |
</div> |
|
514 |
</div> |
|
515 |
</div> |
|
516 |
<div style="background:white;max-height:500px;overflow:auto;"> |
|
517 |
<ul class="nav nav-tabs nav-stacked"> |
|
518 |
% for (my $i = 0; $i < @$member_projects; $i++) { |
|
519 |
% my $member_project = $member_projects->[$i]; |
|
520 |
<% |
|
remove table __ prefix
|
521 |
my $member_user_id = $member_project->{'user.id'}; |
fix compare base and head fo...
|
522 |
my $member_project_id = $member_project->{id}; |
523 |
%> |
|
524 |
<li> |
|
525 |
<% |
|
526 |
my $url; |
|
527 |
if ($member_user_id eq $base_user_id) { |
|
528 |
$url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$target_branch"); |
|
529 |
} |
|
530 |
else { |
|
531 |
$url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$member_user_id:$target_branch"); |
|
532 |
} |
|
533 |
%> |
|
534 |
<a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= $url %>"> |
|
535 |
<%= $member_user_id %>/<%= $member_project_id %> |
|
536 |
</a> |
|
537 |
</li> |
|
538 |
% } |
|
539 |
</ul> |
|
improve compare page design
|
540 |
</div> |
added base branch selection ...
|
541 |
</div> |
improve compare page design
|
542 |
</div> |
fix compare base and head fo...
|
543 |
|
complete pull request logic
|
544 |
% if (keys %$commits_date && $merge_success) { |
add pull request form
|
545 |
<div class="compare-open-pull-request"> |
add create pull request logi...
|
546 |
<form action="<%= url_for %>" method="post"> |
547 |
<%= hidden_field op => 'create-pull-request' %> |
|
add pull request form
|
548 |
<div class="compare-open-pull-request-title"> |
cleanup methods
|
549 |
<%= text_field 'title' => $commits->[0]{title_short} %> |
add pull request form
|
550 |
</div> |
551 |
<div class="compare-open-pull-request-message"> |
|
552 |
<%= text_area 'message' %> |
|
553 |
</div> |
|
554 |
<div class="compare-open-pull-request-button"> |
|
555 |
<%= submit_button 'Create pull request', class => 'btn btn-success' %> |
|
556 |
</div> |
|
557 |
</form> |
|
558 |
</div> |
|
559 |
% } |
|
added base branch popup to c...
|
560 | |
improve compare page design
|
561 |
% if (keys %$commits_date) { |
562 |
<ul class="compare-header"> |
|
563 |
<li> |
|
564 |
<b><%= @$commits %></b> <span>commit</span> |
|
565 |
</li> |
|
566 |
<li> |
|
567 |
<b><%= $authors_count %></b> <span>contributor</span> |
|
568 |
</li> |
|
569 |
<li> |
|
570 |
|
|
571 |
</li> |
|
572 |
<li> |
|
573 |
|
|
574 |
</li> |
|
575 |
</ul> |
|
improved compare page design
|
576 |
|
improve compare page design
|
577 |
<div class="commits"> |
expand compare page tabs
|
578 |
% for my $date (reverse sort keys %$commits_date) { |
579 |
% my $commits = $commits_date->{$date}; |
|
580 |
|
|
improve compare page design
|
581 |
<div class="commit-date"> |
582 |
<i class="icon-off"></i><span>Commits on <%= $date %></span> |
|
expand compare page tabs
|
583 |
</div> |
584 |
|
|
improve compare page design
|
585 |
<ul class="compare-commits-date-container"> |
expand compare page tabs
|
586 |
% for my $commit (sort {$b->{author_epoch} <=> $a->{author_epoch}} @$commits) { |
add user page link from user...
|
587 |
<% |
fix mail bug
|
588 |
my $commit_author_email = $commit->{author_email}; |
add user page link from user...
|
589 |
my $commit_author_id = app->dbi->model('user')->select( |
590 |
'id', |
|
fix mail bug
|
591 |
where => {email => $commit_author_email} |
add user page link from user...
|
592 |
)->value; |
593 |
%> |
|
improve compare page design
|
594 |
<li> |
595 |
<div class="compare-commits-author"> |
|
add user page link from user...
|
596 |
<span title="<%= $commit->{author_email} %>"> |
597 |
% if (defined $commit_author_id) { |
|
598 |
<a href="<%= url_for("/$commit_author_id") %>"><%= $commit_author_id %></a> |
|
599 |
% } else { |
|
600 |
<%= $commit->{author_name} %> |
|
601 |
% } |
|
602 |
</span> |
|
expand compare page tabs
|
603 |
</div> |
improve compare page design
|
604 |
<div class="compare-commits-commit-title"> |
fix pull_request table bug
|
605 |
<a style="color:#333" href="<%= url_for("/$base_user_id/$base_project_id/commit/$commit->{id}") %>"> |
improve compare page design
|
606 |
<%= $commit->{title_short} %> |
607 |
</a> |
|
608 |
</div> |
|
609 |
<div class="compare-commits-commit-id"> |
|
fix pull_request table bug
|
610 |
<a href="<%= url_for("/$base_user_id/$base_project_id/commit/$commit->{id}") %>"> |
improve compare page design
|
611 |
<%= substr($commit->{id}, 0, 7) %> |
612 |
</a> |
|
613 |
</div> |
|
614 |
</li> |
|
improved branches page and c...
|
615 |
% } |
improve compare page design
|
616 |
</ul> |
expand compare page tabs
|
617 |
% } |
improve compare page design
|
618 |
</div> |
619 |
|
|
cleanup merge and push logic
|
620 |
%= include '/include/commit_body', %commit_body_args; |
improve compare page design
|
621 |
% } else { |
improve compare page
|
622 |
<div class="compare-nothing"> |
623 |
<div> |
|
624 |
<b><big>There isn't anything to compare.</big></b> |
|
625 |
</div> |
|
626 |
<div> |
|
show not able to merge
|
627 |
<b> |
fix pull_request table bug
|
628 |
<%= $base_branch %></b> is up to date with all commits from |
629 |
<b><%= $target_branch %></b>. |
|
630 |
Try <a href="<%= url_for("/$base_user_id/$base_project_id/compare/$target_branch...$base_branch") %>">switching the base</a> for your comparison. |
|
improve compare page
|
631 |
</div> |
improve compare page design
|
632 |
</div> |
633 |
% } |
|
634 |
</div> |
|
635 |
%= include '/include/footer'; |