MTrack/SCM.php
[web.mtrack] / MTrack / SCM.php
index 8630401..1cd4551 100644 (file)
@@ -46,12 +46,16 @@ abstract class MTrackSCM
     {
         global $FORKS; //??? why?
         
-        static $tools; // we cache the lookups... - we could use the config for this... (as per original..)
-                        // but that would only be needed or realy heavily loaded sites.
+        static $tools; // we cache the lookups...
+                //- we could use the config for this... (as per original..)
+                // but that would only be needed or realy heavily loaded sites.
+                
         
         require_once 'System.php';
         $tool = isset($tools[$toolname]) ? $tools[$toolname] :  System::which($toolname);
         $tools[$toolname] = $tool;
+        
+        
         if (empty($tool)) {
             throw new Exception("Could not find '$toolname'");
         }
@@ -74,9 +78,9 @@ abstract class MTrackSCM
             $FORKS[$cmd] = 0;
         }
         $FORKS[$cmd]++;
-        
+        //echo  $cmd;
         // debugging....
-        if (false) {
+        if (true) {
             if (php_sapi_name() == 'cli') {
                 echo $cmd, "\n";
             } else {
@@ -102,7 +106,6 @@ abstract class MTrackSCM
     
     
     
-    
     public $repopath = '';
     /*
     static function factory(&$repopath) {
@@ -116,7 +119,7 @@ abstract class MTrackSCM
         list($owner, $type) = $bits;
         $repo = "$owner/$type";
         
-        $r = MTrackRepo::loadByName($repo);
+        $r = MTrack_Repo::loadByName($repo);
         if (!$r) {
           throw new Exception("invalid repo $repo");
         }
@@ -232,8 +235,8 @@ abstract class MTrackSCM
     
   
   /* takes an MTrackSCM as a parameter because in some bootstrapping
-   * cases, we're actually MTrackRepo and not the end-class.
-   * MTrackRepo calls the end-class method and passes itself in for
+   * cases, we're actually MTrack_Repo and not the end-class.
+   * MTrack_Repo calls the end-class method and passes itself in for
    * context */
   public function reconcileRepoSettings(MTrackSCM $r) {
     throw new Exception(
@@ -247,32 +250,37 @@ abstract class MTrackSCM
     return self::makeDisplayName($this);
   }
 
-  public function resolveRevision($rev, $object, $ident) {
-      if ($rev !== null) {
-        return $rev;
-      }
-      if ($object === null) {
-        return null;
-      }
-      switch ($object) {
-        case 'rev':
-          $rev = $ident;
-          break;
-        case 'branch':
-          $branches = $this->getBranches();
-           $rev = isset($branches[$ident]) ? $branches[$ident] : null;
-          break;
-        case 'tag':
-          $tags = $this->getTags();
-          $rev = isset($tags[$ident]) ? $tags[$ident] : null;
-          break;
-      }
-      if ($rev === null) {
-        throw new Exception(
-          "don't know which revision to use ($rev,$object,$ident)");
-      }
-    return $rev;
-  }
+    public function resolveRevision($rev, $object, $ident)
+    {
+        if ($rev !== null) {
+          return $rev;
+        }
+        
+        if ($object === null) {
+          return null;
+        }
+        
+        switch ($object) {
+            case 'rev':
+                $rev = $ident;
+                break;
+            
+            case 'branch':
+                $branches = $this->getBranches();
+                $rev = isset($branches[$ident]) ? $branches[$ident] : null;
+                break;
+            
+            case 'tag':
+              $tags = $this->getTags();
+              $rev = isset($tags[$ident]) ? $tags[$ident] : null;
+              break;
+        }
+        if ($rev === null) {
+          throw new Exception(
+            "don't know which revision to use ($rev,$object,$ident)");
+        }
+      return $rev;
+    }
 
      
 }