| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
* This file is part of the symfony package.
|
|
|
5 |
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
6 |
*
|
|
|
7 |
* For the full copyright and license information, please view the LICENSE
|
|
|
8 |
* file that was distributed with this source code.
|
|
|
9 |
*/
|
|
|
10 |
|
|
|
11 |
/**
|
|
|
12 |
* Outputs formatted Subversion log entries.
|
|
|
13 |
*
|
|
|
14 |
* Usage: php data/bin/changelog.php -r12345:67890 /branches/1.3
|
|
|
15 |
*
|
|
|
16 |
* @package symfony
|
|
|
17 |
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
18 |
* @version SVN: $Id: changelog.php 24071 2009-11-17 07:36:21Z Kris.Wallsmith $
|
|
|
19 |
*/
|
|
|
20 |
require_once dirname(__FILE__).'/../../lib/task/sfFilesystem.class.php';
|
|
|
21 |
|
|
|
22 |
if (!isset($argv[1]))
|
|
|
23 |
{
|
|
|
24 |
throw new Exception('You must provide a revision range (-r123:456)');
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
if (!isset($argv[2]))
|
|
|
28 |
{
|
|
|
29 |
throw new Exception('You must provide a repository path (/branches/1.3)');
|
|
|
30 |
}
|
|
|
31 |
|
|
|
32 |
$filesystem = new sfFilesystem();
|
|
|
33 |
|
|
|
34 |
list($out, $err) = $filesystem->execute('svn info --xml');
|
|
|
35 |
$info = new SimpleXMLElement($out);
|
|
|
36 |
|
|
|
37 |
list($out, $err) = $filesystem->execute(vsprintf('svn log %s --xml %s', array_map('escapeshellarg', array(
|
|
|
38 |
$argv[1],
|
|
|
39 |
(string) $info->entry->repository->root.$argv[2],
|
|
|
40 |
))));
|
|
|
41 |
$log = new SimpleXMLElement($out);
|
|
|
42 |
|
|
|
43 |
foreach ($log->logentry as $logentry)
|
|
|
44 |
{
|
|
|
45 |
echo sprintf(' * [%d] %s', $logentry['revision'], trim(preg_replace('/\s*\[[\d\., ]+\]\s*/', '', (string) $logentry->msg)));
|
|
|
46 |
echo PHP_EOL;
|
|
|
47 |
}
|