Showing 4 changed files with 58 additions and 3 deletions
+33
lib/Gitprep/Git.pm
... ...
@@ -767,6 +767,39 @@ sub tags {
767 767
   return \@tags;
768 768
 }
769 769
 
770
+sub logs {
771
+  my ($self, $user, $project, $branch) = @_;
772
+
773
+  # Get bramcj commits
774
+  my @cmd = $self->cmd(
775
+    $user,
776
+    $project,
777
+    '--no-pager',
778
+    'log',
779
+    '-n',
780
+    '100',
781
+    '--pretty=format:%H %s',
782
+    $branch
783
+  );
784
+  open my $fh, "-|", @cmd
785
+    or croak "Open git log failed: @cmd";
786
+  
787
+  my $logs = [];
788
+  while (my $line = $self->dec(scalar <$fh>)) {
789
+    chomp $line;
790
+    
791
+    warn $line;
792
+    
793
+    my ($hash, $message) = $line =~ /^(.*?) (.+)/;
794
+    
795
+    push @$logs, {hash => $hash, message => $message};
796
+  }
797
+  
798
+  close $fh or croak 'Reading git log failed';
799
+  
800
+  return $logs;
801
+}
802
+
770 803
 sub is_deleted {
771 804
   my ($self, $diffinfo) = @_;
772 805
   
+2 -1
templates/include/code_menu.html.ep
... ...
@@ -3,7 +3,8 @@
3 3
   my $branches_count = stash('branches_count') || 0;
4 4
   my $display = stash('display') || '';
5 5
   my $rev = stash('rev');
6
-  $rev = app->manager->default_branch($user, $project);
6
+  $rev = app->manager->default_branch($user, $project)
7
+    unless defined $rev;
7 8
   my $no_merged_branch = app->git->no_merged_branches($user, $project);
8 9
   my $tags = app->git->tags($user, $project);
9 10
 %>
+1 -1
templates/network.html.ep
... ...
@@ -60,7 +60,7 @@
60 60
                 %= select_field 'remote_branch' => $mbranches, style => 'margin-top:5px;margin-bottom:7px;width:150px';
61 61
               </td>
62 62
               <td style="text-align:right">
63
-                <input class="btn" type="submit" value="Compare" style="margin-top:5px">
63
+                <input class="btn" type="submit" value="Graph" style="margin-top:5px">
64 64
               </td>
65 65
             </tr>
66 66
             %= hidden_field user => $user;
+22 -1
templates/network_graph.html.ep
... ...
@@ -1 +1,22 @@
1
-aaaa
1
+<%
2
+  my $user = param('user');
3
+  my $project = param('project');
4
+  my $branch = param('branch');
5
+  my $remote_user = param('remote_user');
6
+  my $remote_project = param('remote_project');
7
+  my $remote_branch = param('remote_branch');
8
+  
9
+  my $logs = app->git->logs($user, $project, $branch);
10
+  my $remote_logs = app->git->logs(
11
+    $remote_user,
12
+    $remote_project,
13
+    $remote_branch
14
+  );
15
+%>
16
+
17
+layout 'common';
18
+
19
+  % for my $log (@$logs) {
20
+    %= $log->{hash};
21
+    %= $log->{message};
22
+  % }