... | ... |
@@ -9,6 +9,16 @@ use Encode 'encode'; |
9 | 9 |
|
10 | 10 |
has 'app'; |
11 | 11 |
|
12 |
+sub default_branch { |
|
13 |
+ my ($self, $user, $project) = @_; |
|
14 |
+ |
|
15 |
+ my $default_branch = $self->app->dbi->model('project') |
|
16 |
+ ->select('default_branch', id => [$user, $project]) |
|
17 |
+ ->value; |
|
18 |
+ |
|
19 |
+ return $default_branch; |
|
20 |
+} |
|
21 |
+ |
|
12 | 22 |
sub members { |
13 | 23 |
my ($self, $user, $project_name) = @_; |
14 | 24 |
|
... | ... |
@@ -223,41 +233,6 @@ sub _fork_rep { |
223 | 233 |
system(@git_clone_cmd) == 0 |
224 | 234 |
or croak "Can't execute git clone"; |
225 | 235 |
|
226 |
- # Add remote branch |
|
227 |
- { |
|
228 |
- my @git_remote_cmd = $git->cmd( |
|
229 |
- $user, |
|
230 |
- $project, |
|
231 |
- 'remote' |
|
232 |
- ); |
|
233 |
- open my $fh, "-|", @git_remote_cmd |
|
234 |
- or croak "Can't execute git remote"; |
|
235 |
- |
|
236 |
- my $exists; |
|
237 |
- while (my $remote = $git->dec(scalar <$fh>)) { |
|
238 |
- chomp $remote; |
|
239 |
- if ($remote eq $to_user) { |
|
240 |
- $exists = 1; |
|
241 |
- last; |
|
242 |
- } |
|
243 |
- } |
|
244 |
- close $fh; |
|
245 |
- |
|
246 |
- unless ($exists) { |
|
247 |
- my $rep_home = $git->rep_home; |
|
248 |
- my @git_remote_add_cmd = $git->cmd( |
|
249 |
- $user, |
|
250 |
- $project, |
|
251 |
- 'remote', |
|
252 |
- 'add', |
|
253 |
- $to_user, |
|
254 |
- "file://$rep_home/$to_user/$to_project.git" |
|
255 |
- ); |
|
256 |
- system(@git_remote_add_cmd) == 0 |
|
257 |
- or croak "Can't execute remote add"; |
|
258 |
- } |
|
259 |
- } |
|
260 |
- |
|
261 | 236 |
# Move temp rep to rep |
262 | 237 |
my $to_rep = $git->rep($to_user, $to_project); |
263 | 238 |
move $temp_rep, $to_rep |
... | ... |
@@ -11,7 +11,7 @@ |
11 | 11 |
|
12 | 12 |
# Default branch |
13 | 13 |
my $default_branch = {}; |
14 |
- $default_branch->{name} = 'master'; |
|
14 |
+ $default_branch->{name} = app->manager->default_branch($user, $project); |
|
15 | 15 |
$default_branch->{commit} = $git->parse_commit($user, $project, $default_branch->{name}); |
16 | 16 |
|
17 | 17 |
# No merged branches |
... | ... |
@@ -51,13 +51,14 @@ |
51 | 51 |
</div> |
52 | 52 |
% for (my $i = 0; $i < @$branches; $i++) { |
53 | 53 |
% my $branch = $branches->[$i]; |
54 |
- % my $name = $branch->{name}; |
|
54 |
+ % my $bname = $branch->{name}; |
|
55 |
+ % next if $bname eq $default_branch->{name}; |
|
55 | 56 |
<div class="padding5 border-bottom-gray"> |
56 | 57 |
<div class="row"> |
57 | 58 |
<div class="span8"> |
58 | 59 |
<div> |
59 |
- <a href="<%= url_for("/$user/$project/tree/$name") %>"> |
|
60 |
- <%= $name %> |
|
60 |
+ <a href="<%= url_for("/$user/$project/tree/$bname") %>"> |
|
61 |
+ <%= $bname %> |
|
61 | 62 |
</a> |
62 | 63 |
</div> |
63 | 64 |
<div class="muted"> |
... | ... |
@@ -68,7 +69,7 @@ |
68 | 69 |
</div> |
69 | 70 |
</div> |
70 | 71 |
<div class="span3 offset1-mini text-right" style="padding-top:5px"> |
71 |
- <a class="btn" href="<%= url_for("/$user/$project/compare/$default_branch->{name}...$name") %>"> |
|
72 |
+ <a class="btn" href="<%= url_for("/$user/$project/compare/$default_branch->{name}...$bname") %>"> |
|
72 | 73 |
Compare |
73 | 74 |
</a> |
74 | 75 |
</div> |
... | ... |
@@ -2,10 +2,12 @@ |
2 | 2 |
my $tags_count = stash('tags_count') || 0; |
3 | 3 |
my $branches_count = stash('branches_count') || 0; |
4 | 4 |
my $display = stash('display') || ''; |
5 |
+ my $rev = stash('rev'); |
|
6 |
+ $rev = app->manager->default_branch($user, $project); |
|
5 | 7 |
%> |
6 | 8 |
|
7 | 9 |
<ul class="nav nav-tabs" style="margin-bottom:10px"> |
8 |
- % if (defined(my $rev = stash('rev'))) { |
|
10 |
+ % if (defined $rev) { |
|
9 | 11 |
<li style="padding-right:10px"> |
10 | 12 |
<button class="btn"> |
11 | 13 |
<i class="icon-share-alt"></i><span class="muted">branch</span> <b><%= $rev %></b> |
... | ... |
@@ -16,7 +18,7 @@ |
16 | 18 |
<a href="<%= url_for("/$user/$project") %>">Files</a> |
17 | 19 |
</li> |
18 | 20 |
<li class="<%= $display eq 'commits' ? 'active' : '' %>"> |
19 |
- <a href="<%= url_for("/$user/$project/commits/master") %>">Commits</a> |
|
21 |
+ <a href="<%= url_for("/$user/$project/commits/$rev") %>">Commits</a> |
|
20 | 22 |
</li> |
21 | 23 |
<li class="<%= $display eq 'branches' ? 'active' : '' %>"> |
22 | 24 |
<a href="<%= url_for("/$user/$project/branches") %>"> |
... | ... |
@@ -23,6 +23,10 @@ |
23 | 23 |
|
24 | 24 |
<div class="container" style="min-heigth:500px"> |
25 | 25 |
<h3>Members of the <%= $project %> Network</h3> |
26 |
+ <div style="padding-left:10px"> |
|
27 |
+ <%= "$user / $project" %> / |
|
28 |
+ %= select_field 'branch' => $branches, style => 'margin-top:5px;width:150px'; |
|
29 |
+ </div> |
|
26 | 30 |
<table class="table" style="font-size:130%"> |
27 | 31 |
% for my $member (@$members) { |
28 | 32 |
<form action="<%= url_for("/$user/$project/network/graph") %>" method="get"> |
... | ... |
@@ -40,14 +44,9 @@ |
40 | 44 |
</a> |
41 | 45 |
<span>/</span> |
42 | 46 |
%= select_field 'remote_branch' => $mbranches, style => 'margin-top:5px;margin-bottom:7px;width:150px'; |
43 |
- <span> |
|
44 |
- <i class="icon-resize-horizontal" style="margin-left:10px;margin-right:10px"></i> |
|
45 |
- my |
|
46 |
- %= select_field 'branch' => $branches, style => 'margin-top:5px;width:150px'; |
|
47 |
- </span> |
|
48 | 47 |
</td> |
49 | 48 |
<td style="text-align:right"> |
50 |
- <input class="btn" type="submit" value="Graph" style="margin-top:5px"> |
|
49 |
+ <input class="btn" type="submit" value="Compare" style="margin-top:5px"> |
|
51 | 50 |
</td> |
52 | 51 |
</tr> |
53 | 52 |
%= hidden_field user => $user; |