MTrack/SCM/Git/CommitHookBridge.php
[web.mtrack] / MTrack / SCM / Git / CommitHookBridge.php
index fc73eb2..399abe4 100644 (file)
@@ -1,36 +1,35 @@
-<?php  
-require_once 'Interface/CommitHookBridge.php';
-require_once 'Repo.php';
+<?php
 
+require_once 'MTrack/Interface/CommitHookBridge.php';
+require_once 'MTrack/Repo.php';
 
 // needs to be run from git-recieve (and it has to be the only thing run.
 
 class MTrack_SCM_Git_CommitHookBridge extends  IMTrackCommitHookBridge 
 {
-    static public $GIT;
+    
     var $repo;
+    
     var $files = array();
     var $log = array();
     var $commits = array();
     var $fileActions = array(); // file=> delete / modify etc..
+    
+    
     /**
     * fills up repo, files, log, commits by running log on the STDIN
     */
     
-    
-    
-    function __construct(MTrack_Repo $repo, $hooks) 
+    function __construct($repo) 
     {
-        
-        
-        
-        $this->repo = $repo;
+        $this->repo = $repo->impl();
         while (($line = fgets(STDIN)) !== false) {
-          
+            echo "got: $line\n";
             list($old, $new, $ref) = explode(' ', trim($line), 3);
             $this->commits[] = $new;
   
-            $fp = $this->repo->git('log', '--no-color', '--name-status',
+            $fp = $this->repo->git(
+                'log', '--no-color', '--name-status',
                 '--date=rfc', $ref, "$old..$new");
                 
                 
@@ -59,15 +58,16 @@ class MTrack_SCM_Git_CommitHookBridge extends  IMTrackCommitHookBridge
             
             
             do {
-            if (preg_match("/^(.+)\s+(\S+)\s*$/", $line, $M)) {
-                $st = $M[1];
-                $file = $M[2];
-                $this->files[$file] = $new;
-                $this->fileActions[$file] = $st;
-            }
+                if (preg_match("/^(.+)\s+(\S+)\s*$/", $line, $M)) {
+                    $st = $M[1];
+                    $file = $M[2];
+                    $this->files[$file] = $new;
+                    $this->fileActions[$file] = $st;
+                }
               
             } while (($line = fgets($fp)) !== false);
         }
+        print_r($this);exit;
     }