<?php
require_once 'MTrack/SCMEvent.php';
-
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;
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
*/
$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();
$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;
}