<% # API my $api = gitprep_api; # Parameters my $user = param('user'); my $project = param('project'); my $row_id = param('row_id'); my $user_row_id = app->dbi->model('user')->select('row_id', where => {id => $user})->value; # Git my $git = $self->app->git; # Pull requests my $pull_request = app->dbi->model('pull_request')->select( [ {__MY__ => '*'}, {user => ['id']} ], where => {'pull_request.row_id' => $row_id} )->one; my $from_rev = $pull_request->{branch1}; my $rev = $pull_request->{branch2}; # Commits my $commits = $git->forward_commits(app->rep_info($user, $project), $from_rev, $rev); my $commits_count = @$commits; my $commits_date = {}; my $authors = {}; for my $commit (@$commits) { my $date = $commit->{age_string_date_local}; $commits_date->{$date} ||= []; $authors->{$commit->{author}} = 1; push @{$commits_date->{$date}}, $commit; } my $authors_count = keys %$authors; # Start commit my $start_commit = $git->separated_commit(app->rep_info($user, $project), $from_rev, $rev); # End commit my $end_commit = $git->get_commit(app->rep_info($user, $project), $rev); # Variables stash id => $end_commit->{id}; stash from_id => $start_commit->{id}; stash rev => $end_commit->{id}; stash from_rev => $start_commit->{id}; # Allow pull request %> % layout 'common', title => "Pull Requests Tags \x{30fb} $user/$project"; %= include '/include/header';
<% my $pull_title = $pull_request->{branch2}; $pull_title =~ s/_/ /g; $pull_title = ucfirst $pull_title; %> <%= $pull_title %> #<%= $pull_request->{row_id} %>
% if ($pull_request->{open}) {
Open
% } else {
Closed
% }
% my $open_user_id = $pull_request->{'user.id'}; "><%= $open_user_id %> wants to merge <%= $commits_count %> commits into <%= $pull_request->{branch1} %> from <%= $pull_request->{branch2} %>
% for my $date (reverse sort keys %$commits_date) { % my $commits = $commits_date->{$date};
Commits on <%= $date %>
% }
%= include '/include/commit_body'; % if (session('user_row_id') eq $user_row_id) {
<%= "\x{2714}" %>
This branch has no conflicts with the base branch
Merging can be performed automatically.
<%= submit_button 'Merge pull request', class => "btn btn-success" %>
% }
%= include '/include/footer';