php8
[web.mtrack] / MTrackWeb / Merger.php
index 02a4462..f8c9636 100644 (file)
@@ -39,12 +39,25 @@ class MTrackWeb_Merger extends MTrackWeb_Log {
             return HTML_FlexyFramework::run('Noperm');  // noperm = loggedin -> need more perms / not.. try loggin in..
         }
           
-         
+        $this->tree();
+        
+        
+        exit;
+        
+    }
+    function tree()
+    {
+        
         $live = 'master';
         $release = 'github';
          
         $this->repo->debug = 1;
         $ar = $this->repo->history("/", null, "rev",  "$release..$live");
+        
+        // the point of this is to extract all the revisions, and group them.
+        
+        
+        
         //echo '<PRE>';print_R($ar);
         
         // need to get a 2 dimensional array of
@@ -52,26 +65,33 @@ class MTrackWeb_Merger extends MTrackWeb_Log {
         $cfiles = array();
         $rows = array();
         foreach($ar as $commit) {
+            
             $files = $commit->files;
-            $id = date("Y-m-d H", strtotime($commit->ctime));
-            if (!isset($row[$id])) { 
-                $rows[$id] =   array(
-                    'commit' => $id,
-                    'desc' => $commit->changelog
+            $day = date("Y-m-d", strtotime($commit->ctime));
+            if (!isset($days[$day])) { 
+                $days[$day] = array(
+                    'title' => $day,
+                    'rev' => $day,
+                    'children' => array()
                 );
             }
-            
-            foreach($files as $f=>$data) {
-                $rows[$id][$f] = $commit->rev;
-                $cfiles[$f] = isset($cfiles[$f]) ? $cfiles[$f] +1 : 1;
+            $time= date("H:i:s", strtotime($commit->ctime));
+            if (!isset($days[$day]['children'][$time])) { 
+                $days[$day]['children'][$time] = array(
+                    'title' => $time,
+                    'rev' => $day . ' ' . $time,
+                    'commits' =>array(),
+                );
             }
-             
+            $days[$day]['children'][$time]['children'][] = array(
+                'title'=> $commit->changelog,
+                'rev' => $commit->rev
+            );
         }
         // this might result in alot of white boxes where you can
         // let's see what it looks like..
-        echo '<PRE>';print_R($cfiles);
-        echo '<PRE>';print_R($rows);
-        die("done");
+        echo '<PRE>';print_R($days);
+        
         
         
         
@@ -79,5 +99,4 @@ class MTrackWeb_Merger extends MTrackWeb_Log {
     }
     
     
-    
 }