#17881936 : remove diff-related codes

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5975 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
haneul 2009-03-25 15:21:01 +00:00
parent 11e362bf7f
commit e9e5f91119
5 changed files with 3 additions and 113 deletions

View file

@ -9,7 +9,6 @@
var $url = null;
var $svn_cmd = null;
var $diff_cmd = null;
var $tmp_dir = '/tmp';
@ -17,13 +16,12 @@
var $userid = null;
var $passwd = null;
function Svn($url, $svn_cmd='/usr/bin/svn', $diff_cmd='/usr/bin/diff', $userid=null, $passwd=null) {
function Svn($url, $svn_cmd='/usr/bin/svn', $userid=null, $passwd=null) {
if(substr($url,-1)!='/') $url .= '/';
$this->url = $url;
if(strstr($svn_cmd, " ") != FALSE) $this->svn_cmd = '"'.$svn_cmd.'"' ;
else $this->svn_cmd = $svn_cmd;
$this->diff_cmd = $diff_cmd;
$this->tmp_dir = _XE_PATH_.'files/cache/tmp';
if(!is_dir($this->tmp_dir)) FileHandler::makeDir($this->tmp_dir);
@ -134,67 +132,6 @@
return $output;
}
function getDiff($path, $brev = null, $erev = null) {
$eContent = $this->getFileContent($path, $erev);
$bContent = $this->getFileContent($path, $brev);
if(!$eContent||!$bContent) return;
$eFile = sprintf('%s/tmp.%s',$this->tmp_dir, md5($eContent->revision."\n".$eContent->content));
$bFile = sprintf('%s/tmp.%s',$this->tmp_dir, md5($bContent->revision."\n".$bContent->content));
$f = fopen($eFile,'w');
fwrite($f, $eContent->content);
fclose($f);
$f = fopen($bFile,'w');
fwrite($f, $bContent->content);
fclose($f);
$command = sprintf('%s %s %s', $this->diff_cmd, $bFile, $eFile);
$output = $this->execCmd($command, $error);
$list = explode("\n", $output);
$cnt = count($list);
$output = array();
$obj = null;
for($i=0;$i<$cnt;$i++) {
$line = $list[$i];
if(preg_match('/^([0-9,]+)(d|c|a)([0-9,]+)$/',$line, $mat)) {
if($obj!==null) $output[] = $obj;
$obj = null;
$before = $mat[1];
switch($mat[2]) {
case 'c' : $type = 'modified'; break;
case 'd' : $type = 'deleted'; break;
case 'a' : $type = 'added'; break;
}
$t = explode(',',$after);
$after = $mat[3];
$obj->before_line = $before;
$obj->after_line = $after;
$obj->diff_type = $type;
$obj->before_code = '';
$obj->after_code = '';
}
if($obj!==null&&preg_match('/^</',$line)) {
$str = substr($line,1);
$obj->before_code .= $str."\n";
}
if($obj!==null&&preg_match('/^>/',$line)) {
$str = substr($line,1);
$obj->after_code .= $str."\n";
}
}
if($obj!==null) $output[] = $obj;
return $output;
}
function parseComp(&$list)
{
$cnt = count($list);

View file

@ -427,7 +427,7 @@
{
if(!$module_info->svn_url || !$module_info->svn_cmd) return;
require_once($this->module_path.'classes/svn.class.php');
$oSvn = new Svn($module_info->svn_url, $module_info->svn_cmd, $module_info->diff_cmd, $module_info->svn_userid, $module_info->svn_passwd);
$oSvn = new Svn($module_info->svn_url, $module_info->svn_cmd, $module_info->svn_userid, $module_info->svn_passwd);
$oModel = &getModel('issuetracker');
$status = $oSvn->getStatus();
if(!$status || !$status->revision) return;

View file

@ -170,7 +170,7 @@
$erev = Context::get('erev');
$brev = Context::get('brev');
$oSvn = new Svn($this->module_info->svn_url, $this->module_info->svn_cmd, $this->module_info->diff_cmd);
$oSvn = new Svn($this->module_info->svn_url, $this->module_info->svn_cmd);
$current = $oSvn->getStatus($path);
Context::set('current', $current);

View file

@ -1,40 +0,0 @@
<!--#include("source_header.html")-->
<h3>Diff between revs {$brev} to revs {$erev}</h3>
<h1>{$path}</h1>
<ol>
<li>[<a href="{getUrl('type','log','path',urlencode($path),'erev',$erev,'brev',$brev)}">view log</a>]</li>
<li>[<a href="{getUrl('type','file','path',urlencode($path),'revs',$erev)}">view code</a>]</li>
</ol>
<!--@if($diff)-->
<table>
<col width="80" />
<col width="*" />
<col width="*" />
<thead>
<tr>
<th>Status</th>
<th class="before">Rev. {$brev}</th>
<th class="after">Rev. {$erev}</th>
</tr>
</thead>
<tbody>
<!--@foreach($diff as $item)-->
<tr class="line">
<td rowspan="2" class="tCenter {$item->diff_type}">{$item->diff_type}</td>
<td class="before">line {$item->before_line}</td>
<td class="after">line {$item->after_line}</td>
</tr>
<tr class="code">
<td>{nl2br(htmlspecialchars($item->before_code))}</td>
<td>{nl2br(htmlspecialchars($item->after_code))}</td>
</tr>
<!--@end-->
</tbody>
</table>
<!--@end-->
<!--#include("source_footer.html")-->

View file

@ -90,13 +90,6 @@
<p>{$lang->about_svn_cmd}</p>
</td>
</tr>
<tr class="row2">
<th scope="row"><div>{$lang->diff_cmd}</div></th>
<td>
<input type="text" name="diff_cmd" value="{$module_info->diff_cmd}" class="inputTypeText w300" />
<p>{$lang->about_diff_cmd}</p>
</td>
</tr>
<tr>
<th scope="row"><div>{$lang->svn_userid}</div></th>
<td>