3 * concept is to merge commits from a live or working tree
4 * into the 'release tree'
7 * step 1 = render the log of differences..
11 * -- our doc commit changes loads of files.. and makes the layout pointless.
12 * -- ?? grouping by day??? // expand/collapse..
17 require_once 'MTrackWeb/Log.php';
19 class Pman_MTrack_Merger extends Pman {
22 // function getAuth() - from log..
26 $au = $this->getAuthUser();
27 if (!$au || $au->company()->comptype != 'OWNER') {
30 $this->authUser = $au;
38 $this->pi = 'default/roojs1'; // fixme..
40 $this->repo = DB_DataObject::factory('mtrack_repos');
41 $this->filename = $this->repo->loadFromPath($this->pi);
43 if (!$this->repo->id) {
44 $this->err("invalid repo");
47 //if (!$this->projectPerm($this->repo->project_id, 'MTrack.Repos', 'S')) {
48 // $this->err("no perm for this repo ");
63 $this->repo->debug = 1;
64 $ar = $this->repo->history("/", null, "rev", "$release..$live");
66 // the point of this is to extract all the revisions, and group them.
70 //echo '<PRE>';print_R($ar);
72 // need to get a 2 dimensional array of
73 // files along top, and commints down.
76 foreach($ar as $commit) {
78 $files = $commit->files;
79 $day = date("Y-m-d", strtotime($commit->ctime));
80 if (!isset($days[$day])) {
87 $time= date("H:i:s", strtotime($commit->ctime));
88 if (!isset($days[$day]['children'][$time])) {
89 $days[$day]['children'][$time] = array(
91 'rev' => $day . ' ' . $time,
95 $days[$day]['children'][$time]['children'][] = array(
96 'title'=> $commit->changelog,
101 foreach($days as $d=>$do) {
103 $cn = $do['children'];
104 $do['children'] = array();
105 foreach($do['children'] as $c=>$co) {
106 $do['children'] = $co;
112 // convert our into a tree..
114 // this might result in alot of white boxes where you can
115 // let's see what it looks like..
116 echo '<PRE>';print_R($days);