Renamed getRepository() in gitter Client, to avoid method name collision; some code cleanup.

This commit is contained in:
Wim Rijnders
2012-12-04 06:29:10 +01:00
parent 875d3c9661
commit b644610438
3 changed files with 15 additions and 36 deletions

View File

@@ -1,5 +1,6 @@
<?php
#WRI DEBUG
echo "<pre>";
/**
@@ -19,6 +20,7 @@ $config = GitList\Config::fromFile('config.ini');
$app = require 'boot.php';
#WRI DEBUG
echo "</pre>";
$app->run();

View File

@@ -13,20 +13,7 @@ class MainController implements ControllerProviderInterface
$route = $app['controllers_factory'];
$route->get('/', function() use ($app) {
/*
$repositories = array_map(
function ($repo) use ($app) {
$repo['relativePath'] = $app['util.routing']->getRelativePath($repo['path']);
return $repo;
},
$app['git']->getRepositories($app['git.repos'])
);
*/
$repositories = $app['git']->getRepositories($app['git.repos']);
echo "Doing that\n";
#$repositories = $app['git.repos'];
print_r( $repositories );
return $app['twig']->render('index.twig', array(
'repositories' => $repositories,
@@ -35,13 +22,8 @@ print_r( $repositories );
$route->get('{repo}/stats/{branch}', function($repo, $branch) use ($app) {
#$repository = $app['git']->getRepository($app['git.repos'][$repo]);
# NOTE: this call is to the ONE Client!
$repositories = $app['git']->getRepositories($app['git.repos']);
$path = $repositories[ $repo ]['path'];
# NOTE: this call is to the OTHER Client!
$repository = $app['git']->getRepository($path);
echo "branches\n";
$repository = $app['git']->getRepositoryCached($app['git.repos'], $repo);
$stats = $repository->getStatistics($branch);
$authors = $repository->getAuthorStatistics();
@@ -60,14 +42,8 @@ print_r( $repositories );
->bind('stats');
$route->get('{repo}/{branch}/rss/', function($repo, $branch) use ($app) {
#$repository = $app['git']->getRepository($app['git.repos'] );
# NOTE: this call is to the ONE Client!
$repositories = $app['git']->getRepositories($app['git.repos']);
$path = $repositories[ $repo ]['path'];
# NOTE: this call is to the OTHER Client!
$repository = $app['git']->getRepository($path);
echo "rss\n";
$repository = $app['git']->getRepositoryCached($app['git.repos'], $repo);
$commits = $repository->getPaginatedCommits($branch);

View File

@@ -15,12 +15,7 @@ class TreeController implements ControllerProviderInterface
$route->get('{repo}/tree/{branch}/{tree}/', $treeController = function($repo, $branch = '', $tree = '') use ($app) {
# NOTE: this call is to the ONE Client!
$repositories = $app['git']->getRepositories($app['git.repos']);
$path = $repositories[ $repo ]['path'];
# NOTE: this call is to the OTHER Client!
$repository = $app['git']->getRepository($path);
$repository = $app['git']->getRepositoryCached($app['git.repos'], $repo);
if (!$branch) {
$branch = $repository->getHead();
@@ -54,8 +49,12 @@ class TreeController implements ControllerProviderInterface
->bind('tree');
$route->post('{repo}/tree/{branch}/search', function(Request $request, $repo, $branch = '', $tree = '') use ($app) {
$repository = $app['git']->getRepository($app['git.repos'][ $repo ]);
echo "searc\n";
$repository = $app['git']->getRepositoryCached($app['git.repos'], $repo);
$path = $repository->getPath();
$repository = $app['git']->getRepository($path );
if (!$branch) {
$branch = $repository->getHead();
}
@@ -88,7 +87,9 @@ class TreeController implements ControllerProviderInterface
->bind('repository');
$route->get('{repo}/{format}ball/{branch}', function($repo, $format, $branch) use ($app) {
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
$repository = $app['git']->getRepositoryCached($app['git.repos'], $repo);
$path = $repository->getPath();
$tree = $repository->getBranchTree($branch);
if (false === $tree) {