targets = config.components.keys()
for name in targets:
- print 'Cleaning component:', name
-
c = config.components[name]
+ print 'Cleaning', c.repo.path
- paths = []
- for repo in (c.repo, c.meta):
- files = git.ls_files(repo.path, ['-o'])
- paths += [os.path.join(repo.path, i) for i in files]
-
+ files = git.ls_files(c.repo.path, ['-o'])
+ paths = [os.path.join(c.repo.path, i) for i in files]
paths.sort()
paths.reverse()
paths.append(cache)
for path in paths:
+ if git.contains_database(path):
+ continue
+
if config.debug:
- print 'Deleting', path
+ print 'Removing', path
if os.path.islink(path) or not os.path.isdir(path):
os.remove(path)
- elif not os.path.exists(os.path.join(path, '.git')):
- os.rmdir(path)
+ else:
+ remove_tree(path)
for repo in (c.repo, c.meta):
files = git.ls_files(repo.path, ['-m', '-d'])