MTrack/SCM.php
[web.mtrack] / MTrack / CommitChecker.php
index e5746b4..469f17c 100644 (file)
@@ -32,6 +32,7 @@ class MTrack_CommitChecker {
     var $authUser;
     
     var $checks = array();
+    
     function __construct($ar) {
         foreach($ar as $k=>$v) {
             $this->$k = $v;
@@ -42,6 +43,7 @@ class MTrack_CommitChecker {
         
         
     }
+    
 
     function checkVeto()
     {
@@ -190,11 +192,12 @@ class MTrack_CommitChecker {
         } else {
             require_once 'MTrack/CommitHookChangeEvent.php';
             $c = new MTrackCommitHookChangeEvent;
-            $c->rev = $bridge->getChangesetDescriptor();
-            $c->changelog = $bridge->getCommitMessage();
-            $c->changeby = $this->authUser->email; //???
+            $c->rev         = $bridge->getChangesetDescriptor();
+            $c->changelog   = $bridge->getCommitMessage();
+            $c->changeby    = $this->authUser->email; //???
             $c->changeby_id = $this->authUser->id; //???
-            $c->ctime = time();
+            $c->ctime       = time();
+            $c->fileActions = $bridge->fileActions;
             $changes[] = $c;
         }
         return $changes;
@@ -202,6 +205,14 @@ class MTrack_CommitChecker {
 
     function postCommit(IMTrackCommitHookBridge $bridge)
     {
+       
+        // this might be run on multiple commits (big push...)
+        
+        
+        // in our system, we not only log commits that are against a
+        // ticket, but also ones that are not..
+        
+        
         $files = $bridge->enumChangedOrModifiedFileNames();
         
         $fqfiles = array();
@@ -211,6 +222,10 @@ class MTrack_CommitChecker {
 
         // build up overall picture of what needs to be applied to tickets
         $changes = $this->_getChanges($bridge);
+        
+        
+        print_R($changes);
+        
 
         // Deferred by tid
         $deferred = array();
@@ -226,6 +241,9 @@ class MTrack_CommitChecker {
         
         $me = $this->authUser;
 
+
+
+
         foreach ($changes as $c) {
             $tickets = array();
             $log = $c->changelog;
@@ -241,6 +259,7 @@ class MTrack_CommitChecker {
             }
             if (count($tickets) == 0) {
                 $no_ticket[] = $c;
+                
                 continue;
             }
             
@@ -303,15 +322,15 @@ class MTrack_CommitChecker {
                 unset($act['spent']);
             }
             $deferred[$T->tid]['act'][] = $act;
-
-        
             //??? 
             $this->checkVeto('postCommit', $log, $fqfiles, $actions);
         }
         
-        // defered is a list of actions...
         
-        $this->defered = $defered;
+        // defered is a list of actions...
+        $this->no_ticket = $no_ticket;
+        $this->deferred = $deferred;
         $this->spent_by_tid_by_user = $spent_by_tid_by_user;