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 'Pman.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 'text'=> $commit->changelog,
97 'rev' => $commit->rev,
103 foreach($days as $d=>$do) {
104 $dcn = $do['children'];
105 $do['children'] = array();
106 foreach($dcn as $t=>$to) {
107 $to['rev'] = $to['children'][0]['rev'];
108 $do['children'][] = $to;
110 $do['rev'] = $do['children'][0]['rev'];
124 function changedFiles()
126 // list the files that have changed..
127 // in theory you could click a number of them and only merge those changes..