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