Commit ae1e5497 authored by Kai Willadsen's avatar Kai Willadsen

dirdiff: Refactor sibling revalidating logic

parent 07e26f60
......@@ -827,19 +827,16 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
# if parent has more children: state of these children is in state_filters;
# parent may not be removed in this case : stop while loop
self.model.remove(it) # all paths of sibling dirs still on the stack are now invalid!
index = 0
# siblings that are on the stack, all occupy the top positions (in reverse order)
while it is not None:
one_dir = any(os.path.isdir(f) for f in self.model.value_paths(it))
if one_dir:
index += 1
todo[-index] = self.model.get_path(it) # correct the path for this sibling
# stop while loop: it == sibling files and sibling dirs come first in tree
it = self.model.iter_next(it)
break # parent of current level in tree has children : stop while loop
# Remove the current row, and then revalidate all
# sibling paths on the stack by removing and
# readding them
deleted_path = self.model.get_path(it)
for path in todo:
if tree.path_is_sibling(path, deleted_path):
# parent of current level in tree has children : stop while loop
if differences:
......@@ -35,6 +35,11 @@ from import \
def path_is_sibling(path1, path2):
return (len(path1) == len(path2) and
path1.get_indices()[:-1] == path2.get_indices()[:-1])
class DiffTreeStore(Gtk.TreeStore):
def __init__(self, ntree, types):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment