forked from yuki-kimoto/gitprep
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
394bada
commit 871dba1
Showing
4 changed files
with
102 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<% | ||
my $user = param('user'); | ||
my $project = param('project'); | ||
my $branch = param('rev1'); | ||
my $rev2_abs = param('rev2_abs'); | ||
my ($remote_user, $remote_project, $remote_branch) = split /\//, $rev2_abs, 3; | ||
|
||
my $commits = app->git->get_commits($user, $project, $branch, 100); | ||
my $remote_commits = app->git->get_commits( | ||
$remote_user, | ||
$remote_project, | ||
$remote_branch, | ||
100 | ||
); | ||
|
||
my $merged_commits_h = {}; | ||
for my $commit (@$commits) { | ||
my $id = $commit->{id}; | ||
$merged_commits_h->{$id} ||= {}; | ||
$merged_commits_h->{$id}{age} = $commit->{age}; | ||
$merged_commits_h->{$id}{age_string_date} = $commit->{age_string_date}; | ||
$merged_commits_h->{$id}{title} = $commit->{title}; | ||
$merged_commits_h->{$id}{type} = 'local'; | ||
} | ||
for my $commit (@$remote_commits) { | ||
my $id = $commit->{id}; | ||
if ($merged_commits_h->{$id}) { | ||
$merged_commits_h->{$id}{type} = 'same'; | ||
} | ||
else { | ||
$merged_commits_h->{$id} ||= {}; | ||
$merged_commits_h->{$id}{age} = $commit->{age}; | ||
$merged_commits_h->{$id}{age_string_date} = $commit->{age_string_date}; | ||
$merged_commits_h->{$id}{title} = $commit->{title}; | ||
$merged_commits_h->{$id}{type} = 'remote'; | ||
} | ||
} | ||
|
||
my $merged_commits = []; | ||
for my $id ( | ||
sort { $merged_commits_h->{$b}{age} <=> $merged_commits_h->{$a}{age}} | ||
keys %$merged_commits_h) | ||
{ | ||
my $commit = {%{$merged_commits_h->{$id}}}; | ||
$commit->{id} = $id; | ||
push @$merged_commits, $commit; | ||
} | ||
%> | ||
|
||
% layout 'common', title => "Pull $user/$project/$branch...$rev2_abs"; | ||
%= include 'include/header'; | ||
|
||
%= javascript begin | ||
$('document').ready(function () { | ||
// Scroll to right | ||
$('#graph').scrollLeft(1000); | ||
}); | ||
% end | ||
|
||
<div class="container"> | ||
<h3>Pull</h3> | ||
<div class="row" style="font-size:22px"> | ||
<div class="span5"> | ||
<div class="well" style="text-align:center"> | ||
<span style="color:blue;"><%= "$user / $project / $branch" %></span> | ||
</div> | ||
</div> | ||
<div class="span2"> | ||
<div style="padding: 19px;text-align:center;font-size:26px"> | ||
⇐ | ||
</div> | ||
</div> | ||
<div class="span5"> | ||
<div class="well" style="text-align:center"> | ||
<span style="color:green;"><%= "$remote_user / $remote_project / $remote_branch" %></span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
%= include '/include/footer'; |