File: svndump_stats.pl

package info (click to toggle)
libsvn-dump-perl 0.08-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 416 kB
  • sloc: perl: 682; makefile: 7
file content (25 lines) | stat: -rw-r--r-- 685 bytes parent folder | download | duplicates (5)
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
#!/usr/bin/perl
use strict;
use warnings;
use SVN::Dump;

my $dump = SVN::Dump->new( { file => @ARGV ? $ARGV[0] : '-' } );
my $file = @ARGV ? $ARGV[0] : "on STDIN";

# compute some stats
my %type;
my %kind;
while ( my $record = $dump->next_record() ) {
    $type{ $record->type() }++;
    $kind{ $record->get_header('Node-action') }++
        if $record->type() eq 'node';
}

# print the results
print "Statistics for dump $file:\n",
      "  version:   ", $dump->version(), "\n",
      "  uuid:      ", $dump->uuid(), "\n",
      "  revisions: ", $type{revision}, "\n",
      "  nodes:     ", $type{node}, "\n";
print map { sprintf "  - %-7s: %d\n", $_, $kind{$_} } sort keys %kind;