aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bachelier <laurent@bachelier.name>2017-03-27 23:35:04 +0200
committerLaurent Bachelier <laurent@bachelier.name>2017-03-27 23:35:04 +0200
commitb1d4b3f595d6ee8b8fc531643a210b60c843ad75 (patch)
tree667b0cbcf52cbe554897a21bb1b5e90d2aaa3b4c
parentAdd options to ignore symbolic links; ignore both kinds by default (diff)
downloadbrutha-b1d4b3f595d6ee8b8fc531643a210b60c843ad75.tar.xz
Huge speedup for the delete step on large collections
This goes from about ten minutes to ten seconds on my collection.
-rw-r--r--brutha/tree.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/brutha/tree.py b/brutha/tree.py
index db4e4fc..3c0d830 100644
--- a/brutha/tree.py
+++ b/brutha/tree.py
@@ -57,7 +57,8 @@ class Tree(object):
c = d.commands()
if c:
commands.append(c)
- wanted.extend(d.wanted())
+ if self.options['delete']:
+ wanted.extend(d.wanted())
except NotInteresting:
pass
except NotAllowed as e:
@@ -72,6 +73,7 @@ class Tree(object):
return commands
def delete(self, wanted):
+ wanted = frozenset(wanted)
num = 0
for root, dirs, files in os.walk(self.destpath, topdown=False, followlinks=False):
num += 1