$data = $this->fetch_node();
$data = $data['history'];
- return max(array_keys($data));
+ if (is_array($data))
+ {
+ return max(array_keys($data));
+ }
+ else
+ {
+ return 0;
+ }
}
// ###################################################################
return $this->fetch_revision($target);
}
- $keys = array_keys($data);
+ if (is_array($data))
+ {
+ $keys = array_keys($data);
+ }
+ else
+ {
+ return 0;
+ }
$prev = 0;
foreach ($keys AS $id => $revnum)
$output = implode("\n", $output);
$tree = $this->controller->registry->xml->parse($output);
+ // construct _revs inserts and the list of add revisions
+ foreach ($tree['log']['logentry'] AS $log)
+ {
+ XML::unify_node($log['paths']['path']);
+
+ $inserts['revs'][] = "($log[revision], '{$log['author']['value']}', '{$log['date']['value']}', '" . $this->controller->registry->escape($log['msg']['value']) . "', '" . $this->controller->registry->escape(serialize($log['paths']['path'])) . "')";
+
+ foreach ($log['paths']['path'] AS $path)
+ {
+ if (trim($path['action']) == 'A')
+ {
+ $path['value'] = preg_replace('#^/#', '', $path['value']);
+ $addlist["$path[value]"] = $log['revision'];
+ }
+
+ $filelist[] = $this->controller->repospath . $path['value'] . '@' . $log['revision'];
+ }
+ }
+
+ $newfilelist = array();
+ foreach ($filelist AS $item)
+ {
+
+ }
+
// get _nodes
- $output = $this->controller->library->svn('info --xml -R ' . $this->controller->repospath);
+ $output = $this->controller->library->svn('info --xml ' . implode(' ', $filelist));
$output = implode("\n", $output);
$infolist = $this->controller->registry->xml->parse($output);
-
+
// other part of _nodes: properties
- $output = $this->controller->library->svn('proplist -v -R ' . $this->controller->repospath);
+ $output = $this->controller->library->svn('proplist -v ' . implode(' ', $filelist));
$init = false;
foreach ($output AS $line)
{
}
}
- // construct _revs inserts and the list of add revisions
- foreach ($tree['log']['logentry'] AS $log)
- {
- $this->controller->registry->xml->unify_node($log['paths']['path']);
-
- $inserts['revs'][] = "($log[revision], '{$log['author']['value']}', '{$log['date']['value']}', '" . $this->controller->registry->escape($log['msg']['value']) . "', '" . $this->controller->registry->escape(serialize($log['paths']['path'])) . "')";
-
- foreach ($log['paths']['path'] AS $path)
- {
- if (trim($path['action']) == 'A')
- {
- $path['value'] = preg_replace('#^/#', '', $path['value']);
- $addlist["$path[value]"] = $log['revision'];
- }
- }
- }
+ XML::unify_node($infolist['info']['entry']);
+ $nodeindex = 0;
+ $nodesat = array();
// construct list of HEAD nodes for _nodes
foreach ($infolist['info']['entry'] AS $node)
{
$path = str_replace($this->controller->repospath, '', $node['url']['value']);
$path = ($path == '' ? '/' : $path);
- $inserts['nodes'][] = "('$path', '" . $node['kind'] . "', " . $node['commit']['revision'] . ", '" . $this->controller->registry->escape(serialize($loglist)) . "', '" . $this->controller->registry->escape(serialize($proplist["$path"])) . "')";
+ $nodesat["$path"][ $node['commit']['revision'] ] = $nodeindex;
+ $max = max(array_keys($nodesat["$path"]));
+ if ($max < $node['commit']['revision'])
+ {
+ continue;
+ }
+ else if ($max >= $node['commit']['revision'])
+ {
+ foreach ($nodesat["$path"] AS $rev => $ind)
+ {
+ if ($rev != $node['commit']['revision'])
+ {
+ unset($inserts['nodes'][ $nodesat["$path"]["$rev"] ]);
+ }
+ }
+ }
+
+ $inserts['nodes']["$nodeindex"] = "('$path', '" . $node['kind'] . "', " . $node['commit']['revision'] . ", '" . $this->controller->registry->escape(serialize($loglist)) . "', '" . $this->controller->registry->escape(serialize($proplist["$path"])) . "')";
+
+ $nodeindex++;
}
if ($seps == false)
{
// insert _revs
- $this->controller->registry->db->query("
+ var_dump("
REPLACE INTO c{$this->hash}_revs
(revision, author, dateline, message, files)
VALUES
);
// insert _nodes
- $this->controller->registry->db->query("
+ var_dump("
REPLACE INTO c{$this->hash}_nodes
(name, node, revision, history, properties)
VALUES