Steve Borho committed 5215e78

shlib: only send one shell notification per directory

This should improve the performance and possibly robustness
of large repository operations. It should not adversely effect
the shell overlays since it will get fewer refresh events and the
overlay code is already optimized to re-read entire directories.

Comments (0)

Files changed (1)

             from import shell, shellcon
         except ImportError:
+        dirs = []
         for path in paths:
             abspath = os.path.abspath(path)
-            pidl, ignore = shell.SHILCreateFromPath(abspath, 0)
+            if not os.path.isdir(abspath):
+                abspath = os.path.dirname(abspath)
+            if abspath not in dirs:
+                dirs.append(abspath)
+        # send notifications to deepest directories first
+        dirs.sort(lambda x, y: len(y) - len(x))
+        for dir in dirs:
+            pidl, ignore = shell.SHILCreateFromPath(dir, 0)
             if pidl is None: