Showing 3 changed files with 54 additions and 44 deletions
-33
lib/Gitprep/Git.pm
... ...
@@ -767,39 +767,6 @@ 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
-
803 770
 sub is_deleted {
804 771
   my ($self, $diffinfo) = @_;
805 772
   
+3 -2
templates/network.html.ep
... ...
@@ -25,8 +25,9 @@
25 25
   %= javascript begin
26 26
     $(document).ready(function () {
27 27
       // Update user and project hidden field
28
-      $('select[name="branch"]').on('change', function () {
29
-        $('input[name="branch"]').val($(this).val());
28
+      $('[type="submit"]').on('click', function () {
29
+        $('input[name="branch"]').val($('select[name="branch"]').val());
30
+        return true;
30 31
       });
31 32
     });
32 33
   % end
+51 -9
templates/network_graph.html.ep
... ...
@@ -6,17 +6,59 @@
6 6
   my $remote_project = param('remote_project');
7 7
   my $remote_branch = param('remote_branch');
8 8
   
9
-  my $logs = app->git->logs($user, $project, $branch);
10
-  my $remote_logs = app->git->logs(
9
+  my $commits = app->git->parse_commits($user, $project, $branch, 100);
10
+  my $remote_commits = app->git->parse_commits(
11 11
     $remote_user,
12 12
     $remote_project,
13
-    $remote_branch
13
+    $remote_branch,
14
+    100
14 15
   );
16
+  use D;d $commits;
15 17
 %>
16 18
 
17
-layout 'common';
18
-
19
-  % for my $log (@$logs) {
20
-    %= $log->{hash};
21
-    %= $log->{message};
22
-  % }
19
+% layout 'common';
20
+  %= include 'include/header';
21
+  
22
+  <div class="container">
23
+    <div style="margin-bottom:10px">
24
+      <span style="color:blue"><b><big><%= "$user/$project/$branch" %></big></b></span>
25
+      <i class="icon-resize-horizontal"></i>
26
+      <span style="color:green"><b><big><%= "$remote_user/$remote_project/$remote_branch" %></big></b></span>
27
+    </div>
28
+    <div class="well" style="width:800px;overflow:auto;padding-left:10px;padding-right:10px">
29
+      <table>
30
+        <tr>
31
+          % for (my $i = 0; $i < @$commits; $i++) {
32
+            % my $commit = $commits->[$i];
33
+            <td>
34
+              <a style="color:blue" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>" title="<%= $commit->{title} %>">●</a>
35
+            </td>
36
+            <td>
37
+              % if ($i == @$commits - 1) {
38
+                &nbsp;
39
+              % } else {
40
+                -
41
+              % }
42
+            </td>
43
+          % }
44
+        </tr>
45
+        <tr>
46
+          % for (my $i = 0; $i < @$remote_commits; $i++) {
47
+            % my $commit = $remote_commits->[$i];
48
+            <td>
49
+              <a style="color:green" href="<%= url_for("/$remote_user/$remote_project/commit/$commit->{id}") %>" title="<%= $commit->{title} %>">●</a>
50
+            </td>
51
+            <td>
52
+              % if ($i == @$commits - 1) {
53
+                &nbsp;
54
+              % } else {
55
+                -
56
+              % }
57
+            </td>
58
+          % }
59
+        </tr>
60
+      </table>
61
+    </div>
62
+  </div>
63
+  
64
+  %= include '/include/footer';