$output = implode("\n", $output);
$infolist = $this->registry->xml->parse($output);
- // other part of _nodes
+ // other part of _nodes: properties
$output = $this->registry->svn->svn('proplist -v -R ' . ($revision !== null ? ' -r' . $revision . ':HEAD ' : '') . $this->registry->repos->fetch_path($this->registry->paths->repos));
foreach ($output AS $line)
{
}
}
+ // construct _revs inserts and the list of add revisions
foreach ($tree['log']['logentry'] AS $log)
{
$this->registry->xml->unify_node($log['paths']['path']);
foreach ($log['paths']['path'] AS $path)
{
- if ($path['action'] == 'A')
+ if (trim($path['action']) == 'A')
{
- $act = 'addrevs';
+ if (!isset($addlist["$path[value]"]))
+ {
+ $path['value'] = preg_replace('#^/#', '', $path['value']);
+ $addlist["$path[value]"] = $log['revision'];
+ }
}
- else if ($path['action'] == 'D')
- {
- $act = 'delrevs';
- }
- else
- {
- $act = 'revs';
- }
-
- $path['value'] = preg_replace('#^/#', '', $path['value']);
- $pathlist["$path[value]"]["$act"][] = $log['revision'];
}
}
+ // construct list of HEAD nodes for _nodes
foreach ($infolist['info']['entry'] AS $node)
{
- $inserts['nodes'][] = "('$node[path]', '{$node['repository']['uuid']['value']}', '" . implode(',', $pathlist["$node[path]"]['delrevs']) . "', '" . implode(',', $pathlist["$node[path]"]['addrevs']) . "', '" . implode(',', $pathlist["$node[path]"]['revs']) . "', '" . $this->registry->escape(serialize($proplist["$node[path]"])) . "')";
+ $inserts['nodes'][] = "('$node[path]', " . $this->registry->clean($addlist["$node[path]"], TYPE_UINT) . ", " . $node['revision'] . ", '" . $this->registry->escape(serialize($proplist["$node[path]"])) . "')";
}
+ // insert _revs
$this->registry->db->query("
REPLACE INTO {$this->hash}_revs
(revision, author, dateline, message, files)
" . implode(",\n", $inserts['revs'])
);
+ // insert _nodes
$this->registry->db->query("
REPLACE INTO {$this->hash}_nodes
- (name, uuid, delrevs, addrevs, revs, properties)
+ (name, addrevs, revs, properties)
VALUES
" . implode(",\n", $inserts['nodes'])
);
-
- /*
- name VARCHAR(255) NOT NULL DEFAULT '',
- uuid VARCHAR(50) NOT NULL DEFAULT '',
- delrevs MEDIUMTEXT NOT NULL DEFAULT '',
- addrevs MEDIUMTEXT NOT NULL DEFAULT '',
- revs MEDIUMTEXT NOT NULL DEFAULT '',
- properties MEDIUMTEXT NOT NULL DEFAULT '',*/
-
+
$this->registry->debug("TIME TO (RE)BUILD: " . $this->registry->funct->fetch_microtime_diff($start));
}
}