* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-require_once('pages/shortlog.class.php');
-
class difftree {
+ private $difftree_data = null;
+
+ public function push_difftree_data($data) {
+ $this->difftree_data = $data;
+ }
public function generate_difftree($project, $commit, $patch_link) {
$difftree = new ContentProvider('commit', 'difftree');
- $tree = GitCommand::get_commit_changes($project['path'], $commit['id'], $commit['parent']);
+ if($this->difftree_data)
+ $tree = $this->difftree_data;
+ else
+ $tree = GitCommand::get_commit_changes($project['path'], $commit['id'], $commit['parent']);
$entry_count = 0;
if(count($commit['parent']) > 1)
$difftree->set('class', ' combined');
else
$difftree->set('class', '');
+ $difftree->set('tree_count', '');
foreach($tree as $entry) {
$entry_count++;
$difftree->append('tree', $this->tree_entry($entry_count, (($entry_count % 2) ? 'dark' : 'light'), $commit, $entry, $patch_link));
}
- if(count($tree) == 0)
+ if($entry_count == 0)
$difftree->set('tree', '');
+ else if($entry_count > 10)
+ $difftree->set('tree_count', new ContentProvider('commit', 'tree_count', array('count' => $entry_count)));
return $difftree;
}
}
} else
$tree->set('specials', '');
- if($entry['from_id'] != $entry['to_id'])
+ if(!$patch_link && $entry['from_id'] != $entry['to_id'])
$tree->append('links', new ContentProvider('commit', 'tree_changed_links_diff', $link_placeholders));
$tree->append('links', new ContentProvider('commit', 'tree_changed_links', $link_placeholders));
break;
else
$this->page->set('committer_local_date', gmdate('H:i', $committer_local_time));
$this->page->set('committer_timezone', $commit['committer_timezone']);
- $this->page->set('message', htmlentities(Tools::chop_text($commit['text'], 50, 5)));
+ $this->page->set('message', htmlentities(Tools::chop_text($commit['text'], 80, 5)));
$this->page->set('full_message', htmlentities($commit['text']));
$this->page->set('tree_hash', $commit['tree']);
foreach($commit['parent'] as $parent) {