if (!$this->repo->id) {
$this->repo = false;
}
+ // if we have an active project.. enforce it..
+ if ($this->currentProject() && $this->repo && $this->repo->project_id != $this->currentProject()) {
+ $this->repo = false; // no repo..
+ }
+
$this->object = null;
$this->ident = null;
} else {
$do->orderBy("shortname ASC");
}
+
+ if ($this->currentProject()) {
+ $do->project_id = $this->currentProject();
+ }
// FIXME -> permissions on repositories goes here..
//$do->ensurePerm($this->authUser);
//$do->fetchAll();
$map = array();
foreach($ar as $e) {
$e->basename = basename($e->name);
+ // remove e->rev as it's not valid..
+ $e->rev = false;
$map[$e->hash] = $e;
+
}
$q = DB_DataObject::factory('mtrack_clcache');
foreach($revs as $hash => $sobject) {
$event = $impl->commitLogToEvent($sobject);
- // add something???
- $event->is_dir = $map[$hash]->is_dir;
- $event->name = $map[$hash]->name;
- $event->basename = $map[$hash]->basename;
+ // add something???
+ if (isset($map[$hash])) {
+ $event->is_dir = $map[$hash]->is_dir;
+ $event->name = $map[$hash]->name;
+ $event->basename = $map[$hash]->basename;
+ }
$map[$hash] = $event; // this was previous only done for directories??? why???
}
return array_values($map);
$q->repo_id = $this->repo->id;
if ($q->find(true)) {
- $event = $impl->commitLogToEvent($sobject);
+ $event = $impl->commitLogToEvent($q->sobject);
+ } else {
+ $ent = $this->repo->history($e->name, 1, 'rev', $e->rev);
+
+ if (!$ent) {
+ continue;
+ }
+ $event = $ent[0];
+ // cache it..
+ $q = DB_DataObject::factory('mtrack_clcache');
+ $q->rev = $e->hash;
+ $q->repo_id = $this->repo->id;
+ $q->sobject = $event->commit;
+ $q->insert();
}
- $ent = $this->repo->history($e->name, 1, 'rev', $e->rev);
-
- if (!$ent) {
- continue;
- }
- $q = DB_DataObject::factory('mtrack_clcache');
- $q->rev = $e->hash;
- $q->repo_id = $this->repo->id;
- $q->sobject = $ent[0]->commit;
- $q->insert();
// only copy a few essentials from ent, as we will send it back via json.
// these all need escaoing..
$add = new stdClass;
- $add->changelog = $ent[0]->changelogOneToHtml($this->link);
- $add->age = $ent[0]->ctimeToHtml($this->link);
+ $add->changelog = $event->changelogOneToHtml($this->link);
+ $add->age = $event->ctimeToHtml($this->link);
$add->basename = basename($e->name);
- $add->changeby = htmlspecialchars($ent[0]->changeby);
+ $add->changeby = htmlspecialchars($event->changeby);
+ $add->rev = '<a class="changesetlink browse-link" href="'.
+ htmlspecialchars($this->baseURL) .
+ '/Changeset/' .
+ htmlspecialchars($this->repo->displayName()).
+ '/'.
+ htmlspecialchars($event->rev) .
+ '">'.
+ htmlspecialchars($event->rev) .
+ '</a>';
$map[$e->hash] = $add;