[meld] dirdiff: Refactor some empty tree handling logic



commit 2c4a0cbeaa919ad4985b95c0328e5ea605bcb27f
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Jan 12 08:31:52 2014 +1000

    dirdiff: Refactor some empty tree handling logic

 meld/dirdiff.py |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 7a7c84a..63b53d8 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -815,15 +815,14 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
 
                     assert it and not self.model.iter_has_child(it)
                     while not self.model.iter_has_child(it):
+                        parent = self.model.iter_parent(it)
                         if self.model.iter_next(it) is None:
                             # all siblings of it have been processed, none are left on the todo stack
-                            parent = self.model.iter_parent(it)
                             if parent is None:             # don't remove top of the tree
                                 self.model.add_empty(it)
                                 expanded.add(rootpath)     # expand roothpath to show entire tree is empty
                                 break
                             self.model.remove(it)
-                            it = parent
                             # if parent has more children: state of these children is in state_filters;
                             # parent may not be removed in this case : stop while loop
                         else:
@@ -835,8 +834,7 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
                             for path in todo:
                                 if tree.path_is_sibling(path, deleted_path):
                                     path.prev()
-                            # parent of current level in tree has children : stop while loop
-                            break
+                        it = parent
 
             if differences:
                 expanded.add(path)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]