Поло, водное по-оло!..

There are two non-empty arrays $a and $b. What is the result of their sum (+)?

View Results

Loading ... Loading ...

Рекламная пауза

SVN log by developer

Задача очень типовая: посмотреть список коммитов девелоперов, желательно красиво.

Требует colordiff’а (спасибо Антону Фёдорову).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
 * Analyzes the SVN's XML and outputs the verbose list of developer's commits
 *
 * @author Stanis Shramko <im@dinexi.ru>
 */
 
// Checking the args
if (isset($argv[1]))
{
  $author = $argv[1];
}
else
{ 
  echo "Usage:\n";
  echo "svnlogbyuser.php DEV [FULL]\n";
  die(-1);
}
$brief = (isset($argv[2])) ? false : true;
 
// Getting the data
$xml = simplexml_load_string(`svn log -r HEAD:0 -v --xml`);
$totalChanged = 0;
 
// Parsing them using XPath and, if required, svn and colordiff 
foreach ($xml->xpath("/log/logentry[author = '$author']") as $node)
{
  $revision = $node['revision'];
  $previousRevision = $revision - 1;
  $date = date(DATE_RFC2822, strtotime((string)$node->date));
  printf("\nRevision %d, %s at %s\n", $revision, $author, $date);
  foreach($node->paths->path as $path) {
    $totalChanged++;
    printf("%s\n", $path);
    if (!$brief)
    {
      printf("%s\n\n", `svn diff -r $previousRevision:$revision ^/$path | colordiff`);
    }
  }
}
printf("Total changed %d by %s\n", $totalChanged, $author);
 
?>
Share:
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Juick
  • Twitter

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">