MTrack/Repo.php
authorAlan Knowles <alan@akkbhome.com>
Wed, 16 Mar 2011 23:27:52 +0000 (07:27 +0800)
committerAlan Knowles <alan@akkbhome.com>
Wed, 16 Mar 2011 23:27:52 +0000 (07:27 +0800)
MTrack/Repo.php

index f0f9b30..a7b3e4d 100644 (file)
@@ -64,108 +64,7 @@ class MTrack_Repo extends MTrackSCM
         }
         return $ret;
     }  
-    
-    
-    /*static function loadById($id) {
-        list($row) = MTrackDB::q(
-          'select repoid, scmtype from repos where repoid = ?',
-          $id)->fetchAll();
-        if (isset($row[0])) {
-          $type = $row[1];
-          if (isset(self::$scms[$type])) {
-            $class = self::$scms[$type];
-            return new $class($row[0]);
-          }
-          throw new Exception("unsupported repo type $type");
-        }
-        return null;
-    }
-    static function loadByName($name) {
-        $bits = explode('/', $name);
-        if (count($bits) > 1 && $bits[0] == 'default') {
-          array_shift($bits);
-          $name = $bits[0];
-        }
-        if (count($bits) > 1) {
-          // wez/reponame -> per user repo 
-          $u = "user:$bits[0]";
-          $p = "project:$bits[0]";
-          $rows = MTrackDB::q(
-            'select repoid, scmtype from repos where shortname = ? and (parent = ? OR parent = ?)',
-            $bits[1], $u, $p)->fetchAll();
-        } else {
-          $rows = MTrackDB::q(
-            "select repoid, scmtype from repos where shortname = ? and parent =''",
-            $name)->fetchAll();
-        }
-        if (is_array($rows) && isset($rows[0])) {
-          $row = $rows[0];
-          if (isset($row[0])) {
-            $type = $row[1];
-            if (isset(self::$scms[$type])) {
-              $class = self::$scms[$type];
-              return new $class($row[0]);
-            }
-            throw new Exception("unsupported repo type $type");
-          }
-        }
-        return null;
-    }
-    static function loadByLocation($path) 
-    {
-          
-        // we have magic configuration - end users commit into SVN
-        // backend is really git... - so pre-commit hooks have to be from svn
-        list($row) = MTrackDB::q('select repoid, scmtype from repos where repopath = ?', $path)->fetchAll();
-        if (isset($row[0])) {
-          $type = $row[1];
-          if (isset(self::$scms[$type])) {
-            $class = self::$scms[$type];
-            return new $class($row[0]);
-          }
-          throw new Exception("unsupported repo type $type");
-        }
-        return null;
-      }
-  
-    static function loadByChangeSet($cs)
-    {
-        
-        static $re = array();
-        if (isset($re[$cs])) {
-            return $re[$cs];
-        }
-        //using (repoid)  ??
-        $q = MTrackDB::q("
-            select 
-                r.shortname as repo, 
-                p.shortname as proj 
-            from 
-                repos r 
-            left join 
-                project_repo_link l on r.repoid = l.repoid
-            left join 
-                projects p on p.projid = r.projectid
-            where 
-                (parent is null  or length(parent) = 0)
-            AND
-                (
-                    ( ? like CONCAT(proj), '%') 
-                OR
-                    ( ? like CONCAT(repo), '%')
-                )                    
-                ");
-        $ar = $q->fetchAll(PDO::FETCH_ASSOC);
-        if ($ar) {
-            $re[$cs] = self::loadByName($ar['repo']);
-            return $re[$cs];
-        } 
-        $re[$cs] = false;
-        return $re[$cs];
-    }
-    */
-    // methods 
-  
+     
     function __construct($ar = null) {
         
         if (!is_array($ar)) {