# HG changeset patch
# User Simon Heimberg <[email protected]>
# Date 1242814001 -7200
# Node ID 0ce39293ca746da0d8326602ab65c4555634511c
# Parent  4dd0a9fc0d730ec34380f92ca984ab3e46f2aa16
shlib: use set instead of list

diff -r 4dd0a9fc0d73 -r 0ce39293ca74 thgutil/shlib.py
--- a/thgutil/shlib.py  Mit Mai 20 11:59:54 2009 +0200
+++ b/thgutil/shlib.py  Mit Mai 20 12:06:41 2009 +0200
@@ -158,16 +158,14 @@
             import pywintypes
         except ImportError:
             return
-        dirs = []
+        dirs = set()
         for path in paths:
             abspath = os.path.abspath(path)
             if not os.path.isdir(abspath):
                 abspath = os.path.dirname(abspath)
-            if abspath not in dirs:
-                dirs.append(abspath)
+            dirs.add(abspath)
         # send notifications to deepest directories first
-        dirs.sort(lambda x, y: len(y) - len(x))
-        for dir in dirs:
+        for dir in sorted(dirs, key=len, reverse=True):
             try:
                 pidl, ignore = shell.SHILCreateFromPath(dir, 0)
             except pywintypes.com_error:

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to