gitprep / templates / network / graph.html.ep /
Newer Older
123 lines | 4.151kb
added network graph page
Yuki Kimoto authored on 2013-04-18
1
<%
2
  my $user = param('user');
3
  my $project = param('project');
improved network graph page ...
Yuki Kimoto authored on 2013-05-13
4
  my $branch = param('rev1');
5
  my $rev2_abs = param('rev2_abs');
6
  my ($remote_user, $remote_project, $remote_branch) = split /\//, $rev2_abs, 3;
added network graph page
Yuki Kimoto authored on 2013-04-18
7
  
cleanup import_branch
Yuki Kimoto authored on 2016-04-16
8
  my $commits = app->git->get_commits(app->rep_info($user, $project), $branch, 100);
revert encoding support
Yuki Kimoto authored on 2013-11-22
9
  my $remote_commits = app->git->get_commits(
cleanup import_branch
Yuki Kimoto authored on 2016-04-16
10
    app->rep_info($remote_user, $remote_project),
improved network graph page ...
Yuki Kimoto authored on 2013-04-18
11
    $remote_branch,
12
    100
added network graph page
Yuki Kimoto authored on 2013-04-18
13
  );
improved network page design
Yuki Kimoto authored on 2013-04-18
14
  
15
  my $merged_commits_h = {};
16
  for my $commit (@$commits) {
17
    my $id = $commit->{id};
18
    $merged_commits_h->{$id} ||= {};
19
    $merged_commits_h->{$id}{age} = $commit->{age};
support time zone
Yuki Kimoto authored on 2014-03-08
20
    $merged_commits_h->{$id}{age_string_date_local} = $commit->{age_string_date_local};
improved network page design
Yuki Kimoto authored on 2013-04-18
21
    $merged_commits_h->{$id}{title} = $commit->{title};
complete network graph
Yuki Kimoto authored on 2013-04-18
22
    $merged_commits_h->{$id}{type} = 'local';
improved network page design
Yuki Kimoto authored on 2013-04-18
23
  }
24
  for my $commit (@$remote_commits) {
25
    my $id = $commit->{id};
26
    if ($merged_commits_h->{$id}) {
complete network graph
Yuki Kimoto authored on 2013-04-18
27
      $merged_commits_h->{$id}{type} = 'same';
improved network page design
Yuki Kimoto authored on 2013-04-18
28
    }
29
    else {
30
      $merged_commits_h->{$id} ||= {};
31
      $merged_commits_h->{$id}{age} = $commit->{age};
support time zone
Yuki Kimoto authored on 2014-03-08
32
      $merged_commits_h->{$id}{age_string_date_local} = $commit->{age_string_date_local};
improved network page design
Yuki Kimoto authored on 2013-04-18
33
      $merged_commits_h->{$id}{title} = $commit->{title};
complete network graph
Yuki Kimoto authored on 2013-04-18
34
      $merged_commits_h->{$id}{type} = 'remote';
improved network page design
Yuki Kimoto authored on 2013-04-18
35
    }
36
  }
37
  
38
  my $merged_commits = [];
39
  for my $id (
40
    sort { $merged_commits_h->{$b}{age} <=> $merged_commits_h->{$a}{age}}
41
    keys %$merged_commits_h)
42
  {
43
    my $commit = {%{$merged_commits_h->{$id}}};
44
    $commit->{id} = $id;
45
    push @$merged_commits, $commit;
46
  }
improve graph page design
Yuki Kimoto authored on 2016-02-06
47

            
48
  layout 'common', title => "Network Graph $user/$project/$branch...$rev2_abs";
added network graph page
Yuki Kimoto authored on 2013-04-18
49
%>
50

            
improved network graph page ...
Yuki Kimoto authored on 2013-04-18
51
  %= include 'include/header';
52
  
complete network graph
Yuki Kimoto authored on 2013-04-18
53
  %= javascript begin
54
    $('document').ready(function () {
55
      // Scroll to right
56
      $('#graph').scrollLeft(1000);
57
    });
58
  % end
59
  
improved network graph page ...
Yuki Kimoto authored on 2013-04-18
60
  <div class="container">
improve graph page design
Yuki Kimoto authored on 2016-02-06
61
    <h3 class="topic1">Graph</h3>
improved network graph page ...
Yuki Kimoto authored on 2013-05-13
62
    <div style="margin-bottom:20px">Compare 100 commits.</div>
improved network graph page ...
Yuki Kimoto authored on 2013-04-18
63
    <div style="margin-bottom:10px">
add pull page design
Yuki Kimoto authored on 2013-08-13
64
      <span style="color:blue;font-size:22px"><%= "$user / $project / $branch" %></span>
improved network graph page ...
Yuki Kimoto authored on 2013-04-18
65
    </div>
improve graph page design
Yuki Kimoto authored on 2016-02-06
66
    <div id="graph" class="graph-diff">
improved network graph page ...
Yuki Kimoto authored on 2013-04-18
67
      <table>
complete network graph
Yuki Kimoto authored on 2013-04-18
68
        % for my $type (qw/local same remote/) {
69
          <tr style="height:40px">
70
            % for (my $i = 0; $i < @$merged_commits; $i++) {
71
              % my $commit = $merged_commits->[$i];
72
              % my $color
73
              %   = $type eq 'local' ? 'blue'
74
              %   : $type eq 'same' ? 'gray'
75
              %   : 'green';
76

            
77
              % if ($commit->{type} eq $type) {
78
                <td>
support time zone
Yuki Kimoto authored on 2014-03-08
79
                  <a style="color:<%= $color %>" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>" title="<%= "$commit->{title}($commit->{age_string_date_local})" %>">●</a>
complete network graph
Yuki Kimoto authored on 2013-04-18
80
                </td>
81
              % } else {
82
                <td></td>
83
              % }
84
              <td style="color:#ddd">-</td>
improved network page design
Yuki Kimoto authored on 2013-04-18
85
            % }
complete network graph
Yuki Kimoto authored on 2013-04-18
86
          </tr>
87
        % }
improved network graph page ...
Yuki Kimoto authored on 2013-04-18
88
      </table>
89
    </div>
improve graph page design
Yuki Kimoto authored on 2016-02-06
90
    
91
    <div class="graph-document">
92
      <div style="margin-bottom:30px">
93
        <span style="color:green;font-size:22px"><%= "$remote_user / $remote_project / $remote_branch" %></span>
94
      </div>
95
      <hr>
96
      <div style="margin-bottom:15px">
97
        <h4 class="topic1">Merging via command line</h4>
98
        you can perform a manual merge on the command line.
99
      </div>
add the way to merge other u...
Yuki Kimoto authored on 2014-03-18
100

            
improve graph page design
Yuki Kimoto authored on 2016-02-06
101
      <b>Step 1:</b> If you don't add user remote repository, add it.
102
      <pre>
add the way to merge other u...
Yuki Kimoto authored on 2014-03-18
103
git remote add <%= $remote_user %> <%= url_for("/$remote_user/$remote_project.git")->to_abs %>
improve graph page design
Yuki Kimoto authored on 2016-02-06
104
      </pre>
add the way to merge other u...
Yuki Kimoto authored on 2014-03-18
105

            
improve graph page design
Yuki Kimoto authored on 2016-02-06
106
      <b>Step 2:</b> From your project repository, bring in the changes and test.
107
      <pre class="well" style="background:#333333;color:white;padding:20px 20px 0px 20px;">
add the way to merge other u...
Yuki Kimoto authored on 2014-03-18
108
git remote update
109
git fetch
110
git checkout -b <%= "$remote_user-$remote_branch" %> <%= "$remote_user/$remote_branch" %>
111
git merge <%= $branch %>
improve graph page design
Yuki Kimoto authored on 2016-02-06
112
      </pre>
113
      
114
      <b>Step 3:</b> Merge the changes and update on GitHub.
115
      <pre class="well" style="background:#333333;color:white;padding:20px 20px 0px 20px;">
add the way to merge other u...
Yuki Kimoto authored on 2014-03-18
116
git checkout <%= $branch %>
117
git merge <%= "$remote_user-$remote_branch" %>
118
git push origin <%= $branch %>
improve graph page design
Yuki Kimoto authored on 2016-02-06
119
      </pre>
120
    </div>
improved network graph page ...
Yuki Kimoto authored on 2013-04-18
121
  </div>
122
  
123
  %= include '/include/footer';