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 ");
50 if (isset($_REQUEST['_tree'])) {
54 if (isset($_REQUEST['_changedFiles'])) {
55 $this->changedFiles($_REQUEST['_changedFiles']);
57 $this->jerr("invalid url");
67 $this->repo->debug = 1;
68 $ar = $this->repo->history("/", null, "rev", "$release..$live");
70 // the point of this is to extract all the revisions, and group them.
74 //echo '<PRE>';print_R($ar);
76 // need to get a 2 dimensional array of
77 // files along top, and commints down.
80 foreach($ar as $commit) {
82 $files = $commit->files;
83 $day = date("Y-m-d", strtotime($commit->ctime));
84 if (!isset($days[$day])) {
91 $time= date("H:i:s", strtotime($commit->ctime));
92 if (!isset($days[$day]['children'][$time])) {
93 $days[$day]['children'][$time] = array(
95 'rev' => $day . ' ' . $time,
99 $days[$day]['children'][$time]['children'][] = array(
100 'text'=> $commit->changelog,
101 'rev' => $commit->rev,
107 foreach($days as $d=>$do) {
108 $dcn = $do['children'];
109 $do['children'] = array();
110 foreach($dcn as $t=>$to) {
111 $to['rev'] = $to['children'][0]['rev'];
112 $do['children'][] = $to;
114 $do['rev'] = $do['children'][0]['rev'];
128 function changedFiles()
130 // list the files that have changed..
131 // in theory you could click a number of them and only merge those changes..
132 // need to do a git diff.. and just get a list of files..