Index: owners.py |
diff --git a/owners.py b/owners.py |
index d3028a593462177d881456d357f478273c63c831..e51997ccdf74c60a6ff872d8da51bb7796125b8c 100644 |
--- a/owners.py |
+++ b/owners.py |
@@ -178,9 +178,8 @@ class Database(object): |
current_owners = set() |
dirname = current_dir |
while dirname in self.owners_for: |
- for owner in self.owners_for[dirname]: |
- current_owners.add(owner) |
- if self._stop_looking(dirname): |
+ current_owners |= self.owners_for[dirname] |
+ if self._stop_looking(dirname) or dirname == '/': |
Dirk Pranke
2012/05/10 18:26:11
I'm a bit troubled by the "dirname == '/'" additio
|
break |
dirname = self.os_path.dirname(dirname) |
@@ -189,9 +188,7 @@ class Database(object): |
# Add the directory to the list of each owner. |
for owner in current_owners: |
- if not owner in owned_dirs: |
- owned_dirs[owner] = set() |
- owned_dirs[owner].add(current_dir) |
+ owned_dirs.setdefault(owner, set()).add(current_dir) |
final_owners = set() |
while dirs: |
@@ -205,6 +202,7 @@ class Database(object): |
owner_count[owner] = count |
if count >= max_count: |
max_owner = owner |
+ max_count = count |
# If no more directories have OWNERS, we're done. |
if not max_owner: |
@@ -215,7 +213,6 @@ class Database(object): |
# Remove all directories owned by the current owner from the remaining |
# list. |
for dirname in owned_dirs[max_owner]: |
- if dirname in dirs: |
- dirs.remove(dirname) |
+ dirs.discard(dirname) |
return final_owners |