[meld] Fix files labelled as empty folders when deleting (closes bgo#684350)



commit d324674dd849736669fde5dc5aea63fa9fc09f7a
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Sep 22 09:15:08 2012 +1000

    Fix files labelled as empty folders when deleting (closes bgo#684350)
    
    When recursively deleting a folder, we recursively update the tree row
    in the scheduler, but then remove the row immediately. This leads to
    a recursive update being scheduled on the row that replaces the deleted
    row.
    
    While this ordering is very broken, the risks involved in messing with
    the scheduled updates and deletion ordering are high, given that there
    are no other functional bugs reported against this. As such, this
    commit simply adds a specific check for recursive updating of a file
    row, avoiding the 'empty folder' appearance.

 meld/dirdiff.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index ffa9c04..0386a26 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -512,6 +512,12 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
             path = todo.pop(0)
             it = self.model.get_iter( path )
             roots = self.model.value_paths( it )
+
+            # Buggy ordering when deleting rows means that we sometimes try to
+            # recursively update files; this fix seems the least invasive.
+            if not any(os.path.isdir(root) for root in roots):
+                continue
+
             yield _("[%s] Scanning %s") % (self.label_text, roots[0][prefixlen:])
             differences = False
             encoding_errors = []
@@ -737,8 +743,8 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
                                 parent = self,
                                 buttonstype=gtk.BUTTONS_OK_CANCEL) == gtk.RESPONSE_OK:
                             shutil.rmtree(name)
-                            self.recursively_update( path )
-                        self.file_deleted( path, pane)
+                            self.recursively_update(path)
+                            self.file_deleted(path, pane)
                 except OSError as e:
                     misc.run_dialog(_("Error removing %s\n\n%s.") % (name,e), parent = self)
 



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