r24715 - /scripts/KGB/server/KGB

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Fri Aug 29 07:51:06 UTC 2008


Author: dmn
Date: Fri Aug 29 07:51:04 2008
New Revision: 24715

URL: http://svn.debian.org/wsvn/?sc=1&rev=24715
Log:
resurrect %most_dirs. top dir detection fixed

Modified:
    scripts/KGB/server/KGB

Modified: scripts/KGB/server/KGB
URL: http://svn.debian.org/wsvn/scripts/KGB/server/KGB?rev=24715&op=diff
==============================================================================
--- scripts/KGB/server/KGB (original)
+++ scripts/KGB/server/KGB Fri Aug 29 07:51:04 2008
@@ -252,11 +252,19 @@
 
     if ($changed_files > $MAGIC_MAX_FILES) {
         my %dirs;
+        my %most_dirs;
         for my $path (@$paths)
         {
             # strip modification flags from dir name
             $path =~ s/^\([^\)]*\)//;
-            $dirs{dirname($path)}++;
+            my $dir = dirname($path);
+            $dirs{$dir}++;
+            while(1) {
+                $most_dirs{$dir}++;
+                my $ndir = dirname($dir);
+                last if $ndir eq $dir;  # reached the root?
+                $dir = $ndir;
+            }
         }
 
         my $topdir = '';
@@ -271,10 +279,10 @@
         # to choose the last in the list.  Otherwise all messages will 
         # end up being roughly /trunk/ or /tags/, which gets a bit boring.
 
-        for my $dirpath (keys %dirs) {
+        for my $dirpath (keys %most_dirs) {
             if ((length($topdir) < length($dirpath)) && 
-                ($max <= $dirs{$dirpath})) {
-                $max = $dirs{$dirpath};
+                ($max <= $most_dirs{$dirpath})) {
+                $max = $most_dirs{$dirpath};
                 $topdir = $dirpath;
             }
         }




More information about the Pkg-perl-cvs-commits mailing list