... | ... |
@@ -5,46 +5,12 @@ |
5 | 5 |
my $rev2_abs = param('rev2_abs'); |
6 | 6 |
my ($remote_user, $remote_project, $remote_branch) = split /\//, $rev2_abs, 3; |
7 | 7 |
|
8 |
- my $commits = app->git->get_commits($user, $project, $branch, 100); |
|
9 |
- my $remote_commits = app->git->get_commits( |
|
10 |
- $remote_user, |
|
11 |
- $remote_project, |
|
12 |
- $remote_branch, |
|
13 |
- 100 |
|
14 |
- ); |
|
15 |
- |
|
16 |
- my $merged_commits_h = {}; |
|
17 |
- for my $commit (@$commits) { |
|
18 |
- my $id = $commit->{id}; |
|
19 |
- $merged_commits_h->{$id} ||= {}; |
|
20 |
- $merged_commits_h->{$id}{age} = $commit->{age}; |
|
21 |
- $merged_commits_h->{$id}{age_string_date} = $commit->{age_string_date}; |
|
22 |
- $merged_commits_h->{$id}{title} = $commit->{title}; |
|
23 |
- $merged_commits_h->{$id}{type} = 'local'; |
|
24 |
- } |
|
25 |
- for my $commit (@$remote_commits) { |
|
26 |
- my $id = $commit->{id}; |
|
27 |
- if ($merged_commits_h->{$id}) { |
|
28 |
- $merged_commits_h->{$id}{type} = 'same'; |
|
29 |
- } |
|
30 |
- else { |
|
31 |
- $merged_commits_h->{$id} ||= {}; |
|
32 |
- $merged_commits_h->{$id}{age} = $commit->{age}; |
|
33 |
- $merged_commits_h->{$id}{age_string_date} = $commit->{age_string_date}; |
|
34 |
- $merged_commits_h->{$id}{title} = $commit->{title}; |
|
35 |
- $merged_commits_h->{$id}{type} = 'remote'; |
|
36 |
- } |
|
37 |
- } |
|
38 |
- |
|
39 |
- my $merged_commits = []; |
|
40 |
- for my $id ( |
|
41 |
- sort { $merged_commits_h->{$b}{age} <=> $merged_commits_h->{$a}{age}} |
|
42 |
- keys %$merged_commits_h) |
|
43 |
- { |
|
44 |
- my $commit = {%{$merged_commits_h->{$id}}}; |
|
45 |
- $commit->{id} = $id; |
|
46 |
- push @$merged_commits, $commit; |
|
47 |
- } |
|
8 |
+ # Branches |
|
9 |
+ my $git = app->git; |
|
10 |
+ my $branches = $git->branches($user, $project); |
|
11 |
+ my $branch_names = [map { $_->{name} } @$branches]; |
|
12 |
+ my $remote_branches = $git->branches($remote_user, $remote_project); |
|
13 |
+ my $remote_branch_names = [map { $_->{name} } @$remote_branches]; |
|
48 | 14 |
%> |
49 | 15 |
|
50 | 16 |
% layout 'common', title => "Pull $user/$project/$branch...$rev2_abs"; |
... | ... |
@@ -66,11 +32,14 @@ |
66 | 32 |
<div style="color:blue;margin-bottom:15px"> |
67 | 33 |
%= "$user / $project"; |
68 | 34 |
</div> |
69 |
- %= select_field 'local_branch_select'; |
|
35 |
+ % param(branch_select => $rev1); |
|
36 |
+ %= select_field 'branch_select' => ['-' => '', @$branch_names]; |
|
70 | 37 |
<div> |
71 |
- %= text_field 'local_branch_input'; |
|
38 |
+ % param(branch => $rev1); |
|
39 |
+ %= text_field 'branch'; |
|
72 | 40 |
</div> |
73 |
- %= submit_button 'Pull', style => "width:100px"; |
|
41 |
+ %= submit_button 'Pull', style => "width:100px", class => "btn", ; |
|
42 |
+ <button class="btn" style="width:100px">Clear</button> |
|
74 | 43 |
</div> |
75 | 44 |
</div> |
76 | 45 |
<div class="span2"> |
... | ... |
@@ -83,7 +52,8 @@ |
83 | 52 |
<div style="color:green;margin-bottom:15px"> |
84 | 53 |
%= "$remote_user / $remote_project"; |
85 | 54 |
</div> |
86 |
- %= select_field 'remote_branch'; |
|
55 |
+ % param(remote_branch => $remote_branch); |
|
56 |
+ %= select_field 'remote_branch' => $remote_branch_names; |
|
87 | 57 |
</div> |
88 | 58 |
</div> |
89 | 59 |
</div> |