X-Git-Url: http://git.pk910.de/?p=phpgitweb.git;a=blobdiff_plain;f=htdocs%2Fpages%2Fshortlog.class.php;fp=htdocs%2Fpages%2Fshortlog.class.php;h=34cfa8042f35aa6a8108e6c900a979fda062501d;hp=a7293c80c5c2444197beb3c4648b125f0c14c417;hb=bb1fc2c20c1ec39257c6e89cae030636c15edad3;hpb=0a6d29345b57ef71b076003e18d13efd3478764c diff --git a/htdocs/pages/shortlog.class.php b/htdocs/pages/shortlog.class.php index a7293c8..34cfa80 100644 --- a/htdocs/pages/shortlog.class.php +++ b/htdocs/pages/shortlog.class.php @@ -21,29 +21,46 @@ require_once('lib/graph.class.php'); class shortlog { private $project; private $graph_data; + private $first_commit; public function generate_shortlog($project, $head, $max, $skip, $file = null, $pages = true, $next_page = 0) { $this->project = $project; $content = new ContentProvider('shortlog', 'shortlog'); - $commits = GitCommand::get_commits($project['path'], $head, $max+$skip+1, 0, $file); - $this->graph_data = new graph_data_generator(); - if($head == null) { - //add all refs to the graph - foreach($this->project['refs'] as $ref => $rhash) { - if(preg_match('#^refs/heads/#i', $ref) && preg_match('/^[a-f0-9]*$/i', $rhash)) { - $this->graph_data->add_branch($rhash, $ref); + if(GitConfig::GITGRAPH_ENABLE) { + if($max+$skip >= 2000) { //only load the last 2k commits + $real_skip = ($max+$skip) - 2000; + $skip -= $real_skip; + } else + $real_skip = 0; + } else { + $real_skip = $skip; + $skip = 0; + } + + $commits = GitCommand::get_commits($project['path'], $head, $max+$skip+1, $real_skip, $file); + + if(GitConfig::GITGRAPH_ENABLE) { + $this->graph_data = new graph_data_generator(); + if($head == null) { + //add all refs to the graph + foreach($this->project['refs'] as $ref => $rhash) { + if(preg_match('#^refs/heads/#i', $ref) && preg_match('/^[a-f0-9]*$/i', $rhash)) { + $this->graph_data->add_branch($rhash, $ref); + } } - } - foreach($this->project['refs'] as $ref => $rhash) { - if(preg_match('#^refs/remotes/#i', $ref) && preg_match('/^[a-f0-9]*$/i', $rhash)) { - $this->graph_data->add_branch($rhash, $ref); + foreach($this->project['refs'] as $ref => $rhash) { + if(preg_match('#^refs/remotes/#i', $ref) && preg_match('/^[a-f0-9]*$/i', $rhash)) { + $this->graph_data->add_branch($rhash, $ref); + } } } + $this->graph_data->parse($commits); + $content->set('graph_data', $this->graph_data->get_header_graph()); } - $this->graph_data->parse($commits); $commit_counter = 0; + $this->first_commit = $commits[0]; foreach($commits as $commit) { $commit_counter++; if($commit_counter < $skip) @@ -60,6 +77,10 @@ class shortlog { return $content; } + public function get_first_commit() { + return $this->first_commit; + } + private function shortlog_entry($class, $commit) { $entry = new ContentProvider('shortlog', 'shortlog_entry'); $entry->set('class', $class); @@ -77,7 +98,8 @@ class shortlog { $entry->set('date', $date_str); $entry->set('age', $age_str); } - $entry->set('graph_data', $this->graph_data->get_graph($commit['id'])); + if(GitConfig::GITGRAPH_ENABLE) + $entry->set('graph_data', $this->graph_data->get_graph($commit['id'])); $entry->set('refs', $this->shortlog_commit_refs($commit['id'])); @@ -118,6 +140,8 @@ class page_shortlog { if(!$this->project) return; $project['refs'] = $phpgitweb->get_project_loader()->getProjectRefs($project); + $phpgitweb->append_header_nav("shortlog", null, true); + $this->page = new ContentProvider('shortlog', 'main'); //pages