* task#646.

This commit is contained in:
wangchunsheng
2011-12-24 02:17:10 +00:00
parent 50e1738ff1
commit f68964e699
2 changed files with 29 additions and 2 deletions

View File

@@ -1,8 +1,10 @@
<?php
/**
* encodings: 提交日志的编码比如GBK可以用逗号连接起来的多个。
* client: svn客户端执行文件的路径windows下面考虑安装Slik-Subversion然后找到svn.exe的路径。linux下面比如/usr/bin/svn
* repos可以是多个需要设定某一个库的访问路径已经用户名和密码。
*
* encodeings: the encoding of the commentcan be a list.
* client: the svn client binary path. You can install Slik-Subversion unser windows, then find the path of svn.exe. under linux, try /usr/bin/svn
* Can set multi repos, ervery one should set the path, username and password.
*
@@ -13,7 +15,8 @@
* $config->svn->repos['pms']['password'] = 'pass';
*
*/
$config->svn->client = '';
$config->svn->encodings = 'utf-8, gbk';
$config->svn->client = '';
$i = 1;
$config->svn->repos[$i]['path'] = '';

View File

@@ -320,6 +320,30 @@ class svnModel extends model
return array('stories' => $stories, 'tasks' => $tasks, 'bugs' => $bugs);
}
/**
* Convert the comment to uft-8.
*
* @param string $comment
* @access public
* @return string
*/
public function iconvComment($comment)
{
/* Get encodings. */
$encodings = str_replace(' ', '', trim($comment));
if($encodings == '') return $comment;
$encodings = explode(',', $encodings);
/* Try convert. */
foreach($encodings as $encoding)
{
$result = @iconv($encoding, 'utf-8', $comment);
if($result) return $result;
}
return $comment;
}
/**
* Diff a url.
*
@@ -388,7 +412,7 @@ class svnModel extends model
$action->actor = $log->author;
$action->action = 'svncommited';
$action->date = $log->date;
$action->comment = $log->msg;
$action->comment = $this->iconvComment($log->msg);
$action->extra = $log->revision;
$changes = $this->createActionChanges($log, $repoRoot);