Make sure to handle deleted prefixes properly

This commit is contained in:
Joseph Schorr 2014-10-15 11:57:54 -04:00
parent da28bc4ce9
commit dba75a08af
2 changed files with 33 additions and 1 deletions

View file

@ -89,9 +89,14 @@ class StreamLayerMerger(object):
# Check if this file has already been encountered somewhere. If so,
# skip it.
ubsolute = unicode(absolute)
if ubsolute in self.path_trie or any(self.prefix_trie.iter_prefixes(ubsolute)):
if ubsolute in self.path_trie:
return False
# Check if this file is under a deleted path.
for prefix in self.prefix_trie.iter_prefixes(ubsolute):
if not os.path.relpath(ubsolute, prefix).startswith('..'):
return False
# Otherwise, add the path to the encountered list and return it.
self.path_encountered.append(absolute)
return True