Merge branch 'release-1.1' of projects.ceondo.com:indefero into release-1.1
This commit is contained in:
@@ -35,7 +35,9 @@ class IDF_Diff
|
||||
public function __construct($diff, $path_strip_level = 0)
|
||||
{
|
||||
$this->path_strip_level = $path_strip_level;
|
||||
$this->lines = preg_split("/\015\012|\015|\012/", $diff);
|
||||
// this works because in unified diff format even empty lines are
|
||||
// either prefixed with a '+', '-' or ' '
|
||||
$this->lines = preg_split("/\015\012|\015|\012/", $diff, -1, PREG_SPLIT_NO_EMPTY);
|
||||
}
|
||||
|
||||
public function parse()
|
||||
@@ -92,13 +94,13 @@ class IDF_Diff
|
||||
$dellines = $results[2] === '' ? 1 : $results[2];
|
||||
$addstart = $results[3];
|
||||
$addlines = $results[4] === '' ? 1 : $results[4];
|
||||
$chunks_def = array(array($delstart), array($addstart));
|
||||
if ($results[2] != '') $chunks_def[0][] = $dellines;
|
||||
if ($results[4] != '') $chunks_def[1][] = $addlines;
|
||||
$files[$current_file]['chunks_def'][] = $chunks_def;
|
||||
|
||||
$files[$current_file]['chunks_def'][] = array(
|
||||
array($delstart, $dellines), array($addstart, $addlines)
|
||||
);
|
||||
$files[$current_file]['chunks'][] = array();
|
||||
|
||||
while ($addlines >= 0 || $dellines >= 0) {
|
||||
while ($i < $diffsize && ($addlines >= 0 || $dellines >= 0)) {
|
||||
$linetype = $this->lines[$i] != '' ? $this->lines[$i][0] : ' ';
|
||||
switch ($linetype) {
|
||||
case ' ':
|
||||
@@ -121,6 +123,10 @@ class IDF_Diff
|
||||
$dellines--;
|
||||
$delstart++;
|
||||
break;
|
||||
case '\\':
|
||||
// ignore newline handling for now, see issue 636
|
||||
$i++;
|
||||
continue;
|
||||
default:
|
||||
break 2;
|
||||
}
|
||||
|
@@ -248,10 +248,14 @@ class IDF_Scm_Git extends IDF_Scm
|
||||
Pluf::f('git_path', 'git'),
|
||||
escapeshellarg($commit));
|
||||
self::exec('IDF_Scm_Git::inTags', $cmd, $out, $return);
|
||||
if (0 != $return) {
|
||||
$this->cache['tags'] = array();
|
||||
// `git tag` gained the `--contains` option in 1.6.2, earlier
|
||||
// versions report a bad usage error (129) which we ignore here
|
||||
if (129 == $return) {
|
||||
$this->cache['inTags'][$commit] = array();
|
||||
return array();
|
||||
// Ugly emergency fix, needs to be cleaned.
|
||||
}
|
||||
// any other error should of course get noted
|
||||
if (0 != $return) {
|
||||
throw new IDF_Scm_Exception(sprintf($this->error_tpl,
|
||||
$cmd, $return,
|
||||
implode("\n", $out)));
|
||||
@@ -654,7 +658,7 @@ class IDF_Scm_Git extends IDF_Scm
|
||||
|
||||
/**
|
||||
* @see IDF_Scm::getDiffPathStripLevel()
|
||||
*/
|
||||
*/
|
||||
public function getDiffPathStripLevel()
|
||||
{
|
||||
return 1;
|
||||
|
@@ -27,10 +27,13 @@
|
||||
*/
|
||||
class IDF_Scm_Mercurial extends IDF_Scm
|
||||
{
|
||||
protected $hg_log_template;
|
||||
|
||||
public function __construct($repo, $project=null)
|
||||
{
|
||||
$this->repo = $repo;
|
||||
$this->project = $project;
|
||||
$this->hg_log_template = "'".'changeset: {rev}:{node|short}\nauthor: {author}\ndate: {date|isodate}\nfiles: {files}\n{desc}\n'."'";
|
||||
}
|
||||
|
||||
public function getRepositorySize()
|
||||
@@ -336,10 +339,14 @@ class IDF_Scm_Mercurial extends IDF_Scm
|
||||
if (!$this->isValidRevision($commit)) {
|
||||
return false;
|
||||
}
|
||||
$tmpl = ($getdiff) ?
|
||||
Pluf::f('hg_path', 'hg').' log -p -r %s -R %s' : Pluf::f('hg_path', 'hg').' log -r %s -R %s';
|
||||
$tmpl = ($getdiff)
|
||||
? Pluf::f('hg_path', 'hg').' log -p -r %s -R %s --template %s'
|
||||
: Pluf::f('hg_path', 'hg').' log -r %s -R %s --template %s';
|
||||
$cmd = sprintf($tmpl,
|
||||
escapeshellarg($commit), escapeshellarg($this->repo));
|
||||
escapeshellarg($commit),
|
||||
escapeshellarg($this->repo),
|
||||
$this->hg_log_template);
|
||||
|
||||
$out = array();
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
self::exec('IDF_Scm_Mercurial::getCommit', $cmd, $out);
|
||||
@@ -356,7 +363,7 @@ class IDF_Scm_Mercurial extends IDF_Scm
|
||||
$log[] = $line;
|
||||
}
|
||||
}
|
||||
$out = self::parseLog($log, 6);
|
||||
$out = self::parseLog($log, 4);
|
||||
$out[0]->diff = implode("\n", $change);
|
||||
return $out[0];
|
||||
}
|
||||
@@ -381,11 +388,11 @@ class IDF_Scm_Mercurial extends IDF_Scm
|
||||
*/
|
||||
public function getChangeLog($commit='tip', $n=10)
|
||||
{
|
||||
$cmd = sprintf(Pluf::f('hg_path', 'hg').' log -R %s -l%s ', escapeshellarg($this->repo), $n, $commit);
|
||||
$cmd = sprintf(Pluf::f('hg_path', 'hg').' log -R %s -l%s --template %s', escapeshellarg($this->repo), $n, $this->hg_log_template, $commit);
|
||||
$out = array();
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
self::exec('IDF_Scm_Mercurial::getChangeLog', $cmd, $out);
|
||||
return self::parseLog($out, 6);
|
||||
return self::parseLog($out, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -421,7 +428,7 @@ class IDF_Scm_Mercurial extends IDF_Scm
|
||||
continue;
|
||||
}
|
||||
$match = array();
|
||||
if (preg_match('/(\S+)\s*:\s*(.*)/', $line, $match)) {
|
||||
if (preg_match('/^(\S+):\s*(.*)/', $line, $match)) {
|
||||
$match[1] = strtolower($match[1]);
|
||||
if ($match[1] == 'user') {
|
||||
$c['author'] = $match[2];
|
||||
|
@@ -266,8 +266,13 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
escapeshellarg($this->repo),
|
||||
escapeshellarg($rev));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$xml = simplexml_load_string(self::shell_exec('IDF_Scm_Svn::getCommitMessage', $cmd));
|
||||
$this->cache['commitmess'][$rev] = (string) $xml->logentry->msg;
|
||||
try {
|
||||
$xml = simplexml_load_string(self::shell_exec('IDF_Scm_Svn::getCommitMessage', $cmd));
|
||||
$this->cache['commitmess'][$rev] = (string) $xml->logentry->msg;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->cache['commitmess'][$rev] = '';
|
||||
}
|
||||
return $this->cache['commitmess'][$rev];
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{extends "idf/issues/base.html"}
|
||||
{block titleicon}{if $form}<form class="star" method="post" action="{url 'IDF_Views_Issue::star', array($project.shortname, $issue.id)}"><input type="image" src="{if $starred}{media '/idf/img/star.png'}{else}{media '/idf/img/star-grey.png'}{/if}" name="submit" title="{if $starred}{trans 'Remove this issue from your watch list'}{else}{trans 'Add this issue to your watch list'}{/if}" /></form> {/if}{/block}
|
||||
{block body}
|
||||
<div style="float:right;">
|
||||
<div class="issue-prev-next">
|
||||
{if $previous_issue_id}
|
||||
<a href="{url 'IDF_Views_Issue::view', array($project.shortname, $previous_issue_id)}" title="{if $closed}{trans 'Click here to view the previous closed issue'}{else}{trans 'Click here to view the previous open issue'}{/if}">Previous issue</a>
|
||||
{/if}
|
||||
|
Reference in New Issue
Block a user