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