diff options
author | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-08-31 16:21:27 +0000 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-08-31 16:21:27 +0000 |
commit | ff9325753f4fc1a2d060e9e65edd53fbc418e7c3 (patch) | |
tree | 2fa01a07ca4b51efeb5f31af707384cade127c5e | |
parent | de019ebba77fc54ddfce9759fada9731625336f7 (diff) | |
download | morph-ff9325753f4fc1a2d060e9e65edd53fbc418e7c3.tar.gz |
Fix branch dir search by not aborting when seeing a directory twice
Instead, simply clear the list of subdirs to recurse into and
continue. Also make the filtering of hidden subdirectories a
one-liner.
-rw-r--r-- | morphlib/plugins/branch_and_merge_plugin.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py index 829176fa..ea9b67a8 100644 --- a/morphlib/plugins/branch_and_merge_plugin.py +++ b/morphlib/plugins/branch_and_merge_plugin.py @@ -84,7 +84,8 @@ class BranchAndMergePlugin(cliapp.Plugin): for dirname, subdirs, files in os.walk(os.getcwd(), followlinks=True): # Avoid infinite recursion. if dirname in visited: - break + subdirs[:] = [] + continue visited.add(dirname) if cls.is_system_branch_directory(dirname): @@ -92,9 +93,7 @@ class BranchAndMergePlugin(cliapp.Plugin): # Do not recurse deeper if we have more than one # non-hidden directory. - for d in copy.copy(subdirs): - if d.startswith('.'): - subdirs.remove(d) + subdirs[:] = [x for x in subdirs if not x.startswith('.')] if len(subdirs) > 1: break |