r24711 - /scripts/KGB/server/KGB
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Fri Aug 29 06:52:53 UTC 2008
Author: dmn
Date: Fri Aug 29 06:52:49 2008
New Revision: 24711
URL: http://svn.debian.org/wsvn/?sc=1&rev=24711
Log:
KGB: fix building directory usage counts
avoids infinite loop
Modified:
scripts/KGB/server/KGB
Modified: scripts/KGB/server/KGB
URL: http://svn.debian.org/wsvn/scripts/KGB/server/KGB?rev=24711&op=diff
==============================================================================
--- scripts/KGB/server/KGB (original)
+++ scripts/KGB/server/KGB Fri Aug 29 06:52:49 2008
@@ -247,22 +247,26 @@
my @log = split(/\n+/, $log);
my $path_string;
my %dirs;
- my $changed_files;
+ my $changed_files = scalar(@$paths);
my $MAGIC_MAX_FILES = 4;
- for my $path (@$paths) {
- $dirs{dirname($path)}++;
- $changed_files++;
- $path_string .= " " . $path;
- }
-
if ($changed_files > $MAGIC_MAX_FILES) {
+ my %dirs;
+ for my $path (@$paths)
+ {
+ # strip modification flags from dir name
+ $path =~ s/^\([^\)]*\)//;
+ $dirs{dirname($path)}++;
+ }
+
my %most_dirs;
for my $dir (keys %dirs) {
- my $ndir = dirname($dir);
- while ($dir ne $ndir) {
+ $most_dirs{$dir}++;
+ while (1) {
+ my $ndir = dirname($dir);
+ last if $ndir = $dir; # reached the root?
$most_dirs{$ndir}++;
- $ndir = dirname($ndir);
+ $dir = $ndir;
}
}
@@ -288,6 +292,11 @@
$path_string = sprintf("%s %d files in %d dirs", $topdir, $changed_files, scalar keys(%dirs));
}
+ else
+ {
+ $path_string = join(' ', @$paths);
+ }
+
my @string = ("\002$repo_id\017: \00303$author\017 * r\002$rev\017 " .
"(files: \00310$path_string\017) $log[0]");
More information about the Pkg-perl-cvs-commits
mailing list