Cosmetic changes.

svn
Loic d'Anterroches 2008-08-29 20:38:13 +02:00
parent 2c7b3e1e1a
commit fad12e17c7
5 changed files with 43 additions and 41 deletions

View File

@ -43,6 +43,7 @@ class IDF_ScmFactory
case 'git': case 'git':
default: default:
return new IDF_Git($request->project->getGitRepository()); return new IDF_Git($request->project->getGitRepository());
}
} }
} }

View File

@ -101,29 +101,27 @@ class IDF_Svn
escapeshellarg($rev)); escapeshellarg($rev));
$xmlLs = shell_exec($cmd); $xmlLs = shell_exec($cmd);
$xml = simplexml_load_string($xmlLs); $xml = simplexml_load_string($xmlLs);
$res = array(); $res = array();
foreach ($xml->list->entry as $entry) { foreach ($xml->list->entry as $entry) {
$file = array(); $file = array();
$file['type'] = $this->assoc[(String) $entry['kind']]; $file['type'] = $this->assoc[(string) $entry['kind']];
$file['file'] = (String) $entry->name; $file['file'] = (string) $entry->name;
$file['fullpath'] = $folder.'/'.((String) $entry->name); $file['fullpath'] = $folder.'/'.((string) $entry->name);
$file['date'] = gmdate('Y-m-d H:i:s', $file['date'] = gmdate('Y-m-d H:i:s',
strtotime((String) $entry->commit->date)); strtotime((string) $entry->commit->date));
$file['rev'] = (String) $entry->commit['revision']; $file['rev'] = (string) $entry->commit['revision'];
// Get commit message // Get commit message
$currentReposFile = $this->repo.'/'.$folder.'/'.$file['file']; $currentReposFile = $this->repo.'/'.$folder.'/'.$file['file'];
$file['log'] = $this->getCommitMessage($currentReposFile, $rev); $file['log'] = $this->getCommitMessage($currentReposFile, $rev);
// Get the size if the type is blob // Get the size if the type is blob
if ($file['type'] == 'blob') { if ($file['type'] == 'blob') {
$file['size'] = (String) $entry->size; $file['size'] = (string) $entry->size;
} }
$file['perm'] = ''; $file['perm'] = '';
$res[] = (Object) $file; $res[] = (object) $file;
} }
return $res; return $res;
@ -147,7 +145,7 @@ class IDF_Svn
escapeshellarg($rev)); escapeshellarg($rev));
$xmlLog = shell_exec($cmd); $xmlLog = shell_exec($cmd);
$xml = simplexml_load_string($xmlLog); $xml = simplexml_load_string($xmlLog);
return (String) $xml->logentry->msg; return (string) $xml->logentry->msg;
} }
@ -171,16 +169,16 @@ class IDF_Svn
$file = array(); $file = array();
$file['fullpath'] = $totest; $file['fullpath'] = $totest;
$file['hash'] = (String) $entry->repository->uuid; $file['hash'] = (string) $entry->repository->uuid;
$file['type'] = $this->assoc[(String) $entry['kind']]; $file['type'] = $this->assoc[(string) $entry['kind']];
$file['file'] = $totest; $file['file'] = $totest;
$file['rev'] = (String) $entry->commit['revision']; $file['rev'] = (string) $entry->commit['revision'];
$file['author'] = (String) $entry->author; $file['author'] = (string) $entry->author;
$file['date'] = gmdate('Y-m-d H:i:s', strtotime((String) $entry->commit->date)); $file['date'] = gmdate('Y-m-d H:i:s', strtotime((string) $entry->commit->date));
$file['size'] = (String) $entry->size; $file['size'] = (string) $entry->size;
$file['log'] = ''; $file['log'] = '';
return (Object) $file; return (object) $file;
} }
@ -230,15 +228,15 @@ class IDF_Svn
$xmlRes = shell_exec($cmd); $xmlRes = shell_exec($cmd);
$xml = simplexml_load_string($xmlRes); $xml = simplexml_load_string($xmlRes);
$res['author'] = (String) $xml->logentry->author; $res['author'] = (string) $xml->logentry->author;
$res['date'] = gmdate('Y-m-d H:i:s', strtotime((String) $xml->logentry->date)); $res['date'] = gmdate('Y-m-d H:i:s', strtotime((string) $xml->logentry->date));
$res['title'] = (String) $xml->logentry->msg; $res['title'] = (string) $xml->logentry->msg;
$res['commit'] = (String) $xml->logentry['revision']; $res['commit'] = (string) $xml->logentry['revision'];
$res['changes'] = $this->getDiff($rev); $res['changes'] = $this->getDiff($rev);
$res['tree'] = ''; $res['tree'] = '';
return (Object) $res; return (object) $res;
} }
private function getDiff($rev='HEAD') private function getDiff($rev='HEAD')
@ -276,13 +274,13 @@ class IDF_Svn
$res = array(); $res = array();
foreach ($xml->logentry as $entry) { foreach ($xml->logentry as $entry) {
$log = array(); $log = array();
$log['author'] = (String) $entry->author; $log['author'] = (string) $entry->author;
$log['date'] = gmdate('Y-m-d H:i:s', strtotime((String) $entry->date)); $log['date'] = gmdate('Y-m-d H:i:s', strtotime((string) $entry->date));
$log['title'] = (String) $entry->msg; $log['title'] = (string) $entry->msg;
$log['commit'] = (String) $entry['revision']; $log['commit'] = (string) $entry['revision'];
$log['full_message'] = ''; $log['full_message'] = '';
$res[] = (Object) $log; $res[] = (object) $log;
} }
return $res; return $res;
@ -328,7 +326,7 @@ class IDF_Svn
// Get the value of each property // Get the value of each property
foreach ($props->target->property as $prop) { foreach ($props->target->property as $prop) {
$key = (String) $prop['name']; $key = (string) $prop['name'];
$res[$key] = $this->getProperty($key, $rev, $path); $res[$key] = $this->getProperty($key, $rev, $path);
} }
@ -356,7 +354,7 @@ class IDF_Svn
$xmlProp = shell_exec($cmd); $xmlProp = shell_exec($cmd);
$prop = simplexml_load_string($xmlProp); $prop = simplexml_load_string($xmlProp);
return (String) $prop->target->property; return (string) $prop->target->property;
} }
@ -378,7 +376,7 @@ class IDF_Svn
$xmlInfo = shell_exec($cmd); $xmlInfo = shell_exec($cmd);
$xml = simplexml_load_string($xmlInfo); $xml = simplexml_load_string($xmlInfo);
return (String) $xml->entry->commit['revision']; return (string) $xml->entry->commit['revision'];
} }
} }

View File

@ -68,6 +68,7 @@ class IDF_Views_Source
$branches[0])); $branches[0]));
return new Pluf_HTTP_Response_Redirect($url); return new Pluf_HTTP_Response_Redirect($url);
} }
$res = $scm->filesAtCommit($commit); $res = $scm->filesAtCommit($commit);
$cobject = $scm->getCommit($commit); $cobject = $scm->getCommit($commit);
$tree_in = in_array($commit, $branches); $tree_in = in_array($commit, $branches);

View File

@ -6,7 +6,6 @@
<tr> <tr>
<th>{trans 'Age'}</th> <th>{trans 'Age'}</th>
<th>{trans 'Message'}</th> <th>{trans 'Message'}</th>
{* <th>{trans 'Details'}</th> *}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -38,12 +37,14 @@
</p> </p>
{/if} {/if}
{if $scm == 'svn'} {if $scm == 'svn'}
<p><strong>{trans 'Revison:'} {$commit}</strong><br /> <form class="star" action="{url 'IDF_Views_Source::changelogRev', array($project.shortname)}" method="get">
<form class="star" action="{url 'IDF_Views_Source::changelogRev', array($project.shortname)}" method="get"> <p><strong>{trans 'Revison:'}</strong> {$commit}</p>
<input accesskey="4" type="text" value="{$commit}" name="rev" size="20" /> <p>
<input accesskey="4" type="text" value="{$commit}" name="rev" size="5" />
<input type="submit" name="s" value="{trans 'Go to revision'}" /> <input type="submit" name="s" value="{trans 'Go to revision'}" />
</form>
</p> </p>
</form>
{/if} {/if}
{/block} {/block}

View File

@ -56,16 +56,17 @@
{/foreach} {/foreach}
</tbody> </tbody>
</table> </table>
<p class="right soft"><img style="vertical-align: text-bottom;" src="{media '/idf/img/package-grey.png'}" alt="{trans 'Archive'}" align="bottom" /></a> <kbd>svn checkout {$project.getSvnDaemonUrl()}@{$commit}</kbd></p> <p class="right soft"><img style="vertical-align: text-bottom;" src="{media '/idf/img/package-grey.png'}" alt="{trans 'Archive'}" align="bottom" /> <kbd>svn checkout {$project.getSvnDaemonUrl()}@{$commit}</kbd></p>
{/block} {/block}
{block context} {block context}
<p><strong>{trans 'Revison:'} {$commit}</strong><br /> <form class="star" action="{url 'IDF_Views_Source::treeRev', array($project.shortname)}" method="get">
<form class="star" action="{url 'IDF_Views_Source::treeRev', array($project.shortname)}" method="get"> <p><strong>{trans 'Revison:'}</strong> {$commit}</p>
<input accesskey="4" type="text" value="{$commit}" name="rev" size="20" /> <p>
<input accesskey="4" type="text" value="{$commit}" name="rev" size="5" />
<input type="hidden" name="sourcefile" value="{$base}"/> <input type="hidden" name="sourcefile" value="{$base}"/>
<input type="submit" name="s" value="{trans 'Go to revision'}" /> <input type="submit" name="s" value="{trans 'Go to revision'}" /></p>
</form> </form>
</p>
{/block} {/block}