php8
[web.mtrack] / MTrack / SCM / Git / Event.php
index 467ff53..4990c98 100644 (file)
@@ -13,7 +13,9 @@ class MTrack_SCM_Git_Event extends MTrackSCMEvent
 
     /** who committed this revision */
     public $changeby;
-
+    
+    /** branch for this revision */
+    public $branch;
     /** when this revision was committed */
     public $ctime;
 
@@ -22,6 +24,14 @@ class MTrack_SCM_Git_Event extends MTrackSCMEvent
     public $files;
 
     public $commit;
+    var $tags;
+    var $files_array;
+    
+    var $utime;
+    var $commitday;
+    var $committime;
+    var $commitby;
+    
     /**
      * this is based on the output from git --raw --numstat
      */
@@ -34,12 +44,11 @@ class MTrack_SCM_Git_Event extends MTrackSCMEvent
         $lines = explode("\n", $commit);
         $line = array_shift($lines);
 
-        if (!preg_match("/^commit\s+(\S+)$/", $line, $M)) {
+        if (!preg_match("/^commit\s+(\S+)\s+(\S+)$/", $line, $M)) {
             return false;
         }
         $ent->rev = $M[1];
-
-        $ent->branches = array(); // FIXME
+        $ent->branch = $M[2] ;
         $ent->tags = array(); // FIXME
         $ent->files = array();
 
@@ -110,15 +119,18 @@ class MTrack_SCM_Git_Event extends MTrackSCMEvent
             $info = preg_split('#\s+#', substr($line ,1), 3);
            //print_r($info);
             $name = $info[2];
+            if (!isset($ent->files[$name])) {
+                $ent->files[$name] = new stdClass; // ??
+            }
+            
             $ent->files[$name]->added = $info[0];            
             $ent->files[$name]->removed = $info[1];
-            
         }
         // fixme..
-        if (!count($ent->branches)) {
-            $ent->branches[] = 'master';
-        }
-
+        //if (!count($ent->branches)) {
+        //    $ent->branches[] = $this->branch; //'master';
+        //}
+        $ent->files_array = array_values($ent->files);
         return $ent;
     }