Indefero

Indefero Commit Details


Date:2009-04-19 07:33:12 (15 years 8 months ago)
Author:Mehdi Kabab
Branch:dev, develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3
Commit:b94934eafb72072900e934901b5b7328f10af2c3
Parents: bf5eba2eccc8ae84e00b4b83044f0ac4582d58b8
Message:Fixed issue 195, added parsing of the commit plural forms.

Changes:

File differences

src/IDF/Template/IssueComment.php
4848
4949
5050
51
52
51
52
5353
5454
5555
......
9696
9797
9898
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
99127
100128
101
102
129
130
131
132
133
134
103135
104
105
136
137
138
139
106140
107141
108142
array($this, 'callbackIssues'), $text);
}
if ($request->rights['hasSourceAccess']) {
$text = preg_replace_callback('#(commit\s+)([0-9a-f]{1,40})#im',
array($this, 'callbackCommit'), $text);
$text = preg_replace_callback('#(commits?\s+)([0-9a-f]{1,40}(?:(?:\s+and|\s+or|,)\s+[0-9a-f]{1,40})*)\b#i',
array($this, 'callbackCommits'), $text);
$text = preg_replace_callback('#(src:)([^\s\(\)]+)#im',
array($this, 'callbackSource'), $text);
}
}
}
/**
* General call back to convert commits to HTML links.
*
* @param array $m Single regex match.
* @return string Content with converted commits.
*/
function callbackCommits($m)
{
$keyword = rtrim($m[1]);
if ('commits' === $keyword) {
// Multiple commits like 'commits 6e030e6, a25bfc1 and
// 3c094f8'.
return $m[1].preg_replace_callback('#\b[0-9a-f]{4,40}\b#i', array($this, 'callbackCommit'), $m[2]);
} else if ('commit' === $keyword) {
// Single commit like 'commit 6e030e6'.
return $m[1].call_user_func(array($this, 'callbackCommit'), array($m[2]));
}
return $m[0];
}
/**
* Convert plaintext commit to HTML link. Called from callbackCommits.
*
* Regex callback for {@link IDF_Template_IssueComment::callbackCommits()}.
*
* @param array Single regex match.
* @return string HTML A element with commit.
*/
function callbackCommit($m)
{
if ($this->scm->testHash($m[2]) != 'commit') {
return $m[0];
try {
if ('commit' != $this->scm->testHash($m[0])) {
return $m[0]; // not a commit.
}
} catch (IDF_Scm_Exception $e) {
return $m[0]; // commit not found.
}
$co = $this->scm->getCommit($m[2]);
return '<a href="'.Pluf_HTTP_URL_urlForView('IDF_Views_Source::commit', array($this->project->shortname, $co->commit)).'">'.$m[1].$m[2].'</a>';
$co = $this->scm->getCommit($m[0]);
return '<a href="'
.Pluf_HTTP_URL_urlForView('IDF_Views_Source::commit', array($this->project->shortname, $co->commit))
.'">'.$m[0].'</a>';
}
function callbackSource($m)

Archive Download the corresponding diff file

Page rendered in 0.07444s using 14 queries.