DataObjects/Mtrack_repos.php
authorAlan Knowles <alan@roojs.com>
Tue, 15 Jan 2019 05:48:04 +0000 (13:48 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 15 Jan 2019 05:48:04 +0000 (13:48 +0800)
DataObjects/Mtrack_repos.php

index ffc0beb..450e14b 100644 (file)
@@ -843,23 +843,39 @@ class Pman_MTrack_DataObjects_Mtrack_repos extends DB_DataObject
         //print_r(array('since'=> '{'.$start.'}' , 'before' => '{'.$end .'}'));
         $res = $this->impl()->history('.', array('since'=> '{'.$start.'}' , 'before' => '{'.$end .'}'), 'rev', '--all');
         
-        $res = $this->impl()->history('.', array('since'=> '{'.$start.'}' , 'before' => '{'.$end .'}'), $object, $branch);
-         
-        // find the last rev the day before...
-        
-        
+        $branches = array();
+        foreach($res as $r) {
+            if (!preg_match('#^refs/heads/.*$#', $r->branch)) {
+                continue;
+            }
+            $br = preg_replace('#^refs/heads/.*$#', $r->branch, '');
+            $branches[$br] = 1;
+                
+        }
+        $objs = array();
+        foreach($branches as $branch=>$one) {
+            
+            
+            $res = $this->impl()->history('.', array('since'=> '{'.$start.'}' , 'before' => '{'.$end .'}'), $object, $branch);
+             
+            // find the last rev the day before...
+            
+            
+             
+            $obj = $this->historyToSummary($res, $notify->act_start);
+            if (!$obj) {
+               // echo "History returned nothing";
+                return true;
+            }
+            $obj->from_dt = $start;
+            $obj->to_dt = $end;
+            $obj->branch = $br;
+            //print_r($obj);exit; 
          
-        $obj = $this->historyToSummary($res, $notify->act_start);
-        if (!$obj) {
-           // echo "History returned nothing";
-            return true;
+            $objs[] = $obj;
         }
-        $obj->from_dt = $start;
-        $obj->to_dt = $end;
-        
-        //print_r($obj);exit; 
         $ret =   $rcpt->buildMail('repo_daily_changes', $obj);
-        //print_r($ret);exit;
+        
         return $ret;