* code for task#1365.
This commit is contained in:
+18
-6
@@ -32,7 +32,7 @@ class git extends control
|
||||
*/
|
||||
public function diff($path, $revision)
|
||||
{
|
||||
$url = helper::safe64Decode($path);
|
||||
$path = helper::safe64Decode($path);
|
||||
$this->view->url = $path;
|
||||
$this->view->revision = $revision;
|
||||
$this->view->diff = $this->git->diff($path, $revision);
|
||||
@@ -50,7 +50,7 @@ class git extends control
|
||||
*/
|
||||
public function cat($path, $revision)
|
||||
{
|
||||
$url = helper::safe64Decode($url);
|
||||
$path = helper::safe64Decode($path);
|
||||
$this->view->path = $path;
|
||||
$this->view->revision = $revision;
|
||||
$this->view->code = $this->git->cat($path, $revision);
|
||||
@@ -69,12 +69,24 @@ class git extends control
|
||||
if($this->post->logs)
|
||||
{
|
||||
$repoRoot = $this->post->repoRoot;
|
||||
$logs = stripslashes($this->post->logs);
|
||||
$logs = simplexml_load_string($logs);
|
||||
foreach($logs->logentry as $entry)
|
||||
$list = json_decode($this->post->logs);
|
||||
|
||||
$logs = array();
|
||||
$i = 0;
|
||||
foreach($list as $line)
|
||||
{
|
||||
$parsedLogs[] = $this->git->convertLog($entry);
|
||||
if(!$line)
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
$logs[$i][] = $line;
|
||||
}
|
||||
foreach($logs as $log)
|
||||
{
|
||||
$parsedLogs[] = $this->convertLog($log);
|
||||
}
|
||||
|
||||
$parsedObjects = array('stories' => array(), 'tasks' => array(), 'bugs' => array());
|
||||
foreach($parsedLogs as $log)
|
||||
{
|
||||
|
||||
+16
-13
@@ -98,6 +98,7 @@ class gitModel extends model
|
||||
$this->printLog("get " . count($logs) . " logs");
|
||||
|
||||
$this->printLog('begin parsing logs');
|
||||
$latestRevision = $logs[0]->revision;
|
||||
foreach($logs as $log)
|
||||
{
|
||||
$this->printLog("parsing log {$log->revision}");
|
||||
@@ -112,7 +113,7 @@ class gitModel extends model
|
||||
if($objects)
|
||||
{
|
||||
$this->printLog('extract' .
|
||||
'story:' . join(' ', $objects['stories']) .
|
||||
' story:' . join(' ', $objects['stories']) .
|
||||
' task:' . join(' ', $objects['tasks']) .
|
||||
' bug:' . join(',', $objects['bugs']));
|
||||
|
||||
@@ -122,10 +123,10 @@ class gitModel extends model
|
||||
{
|
||||
$this->printLog('no objects found' . "\n");
|
||||
}
|
||||
if($log->revision > $savedRevision) $savedRevision = $log->revision;
|
||||
}
|
||||
$this->saveLastRevision($savedRevision);
|
||||
$this->printLog("save revision $savedRevision");
|
||||
|
||||
$this->saveLastRevision($latestRevision);
|
||||
$this->printLog("save revision $latestRevision");
|
||||
$this->deleteRestartFile();
|
||||
$this->printLog("\n\nrepo $name finished");
|
||||
}
|
||||
@@ -243,15 +244,16 @@ class gitModel extends model
|
||||
/* The git log command. */
|
||||
if($fromRevision)
|
||||
{
|
||||
$cmd = "cd $this->repoRoot; $this->client log --stat -r $fromRevision:HEAD --pretty=format:%an*_*%cd*_*%H*_*%s";
|
||||
$cmd = "cd $this->repoRoot; $this->client log --stat $fromRevision..HEAD --pretty=format:%an*_*%cd*_*%H*_*%s";
|
||||
}
|
||||
else
|
||||
{
|
||||
$cmd = "cd $this->repoRoot; $this->client log --stat --pretty=format:%an*_*%cd*_*%H*_*%s";
|
||||
}
|
||||
exec($cmd, $list);
|
||||
exec($cmd, $list, $return);
|
||||
|
||||
if(!$list) die("Some error occers: \nThe command is $cmd\n");
|
||||
if(!$list and $return) die("Some error occers: \nThe command is $cmd\n");
|
||||
if(!$list and !$return) exit;
|
||||
|
||||
/* Process logs. */
|
||||
$logs = array();
|
||||
@@ -296,7 +298,7 @@ class gitModel extends model
|
||||
{
|
||||
if(strpos($change, '|') === false) continue;
|
||||
list($entry, $modify) = explode('|', $change);
|
||||
$entry = trim($entry);
|
||||
$entry = '/' . trim($entry);
|
||||
$parsedLog->files['M'][] = $entry;
|
||||
}
|
||||
|
||||
@@ -378,7 +380,7 @@ class gitModel extends model
|
||||
$path = str_replace('%2F', '/', urlencode($path));
|
||||
$path = str_replace('%3A', ':', $path);
|
||||
|
||||
$cmd = $this->client . " diff $revision^ $revision $url";
|
||||
$cmd = "cd $repo->path;$this->client diff $revision^ $revision $path";
|
||||
$diff = `$cmd`;
|
||||
return $diff;
|
||||
}
|
||||
@@ -403,7 +405,8 @@ class gitModel extends model
|
||||
$path = str_replace('%2F', '/', urlencode($path));
|
||||
$path = str_replace('%3A', ':', $path);
|
||||
|
||||
$cmd = $this->client . " show -r $revision $path";
|
||||
$subPath = substr($path, strlen($repo->path) + 1);
|
||||
$cmd = "cd $repo->path;$this->client show $revision:$subPath";
|
||||
$code = `$cmd`;
|
||||
return $code;
|
||||
}
|
||||
@@ -437,7 +440,7 @@ class gitModel extends model
|
||||
$action->action = 'gitcommited';
|
||||
$action->date = $log->date;
|
||||
$action->comment = $this->iconvComment($log->msg);
|
||||
$action->extra = $log->revision;
|
||||
$action->extra = substr($log->revision, 0, 10);
|
||||
|
||||
$changes = $this->createActionChanges($log, $repoRoot);
|
||||
|
||||
@@ -559,7 +562,7 @@ class gitModel extends model
|
||||
$diff .= $action == 'M' ? "$diffLink\n" : "\n" ;
|
||||
}
|
||||
}
|
||||
$changes->field = 'subversion';
|
||||
$changes->field = 'git';
|
||||
$changes->old = '';
|
||||
$changes->new = '';
|
||||
$changes->diff = trim($diff);
|
||||
@@ -629,7 +632,7 @@ class gitModel extends model
|
||||
{
|
||||
if(!file_exists($this->logFile)) return 0;
|
||||
if(file_exists($this->restartFile)) return 0;
|
||||
return (int)trim(file_get_contents($this->logFile));
|
||||
return trim(file_get_contents($this->logFile));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user