Commit 2f3b9379 authored by Louis des Landes's avatar Louis des Landes Committed by Kai Willadsen

Render directories in flattened mode if required (bgo#701970)

parent e2b42488
...@@ -116,6 +116,12 @@ class DiffTreeStore(Gtk.TreeStore): ...@@ -116,6 +116,12 @@ class DiffTreeStore(Gtk.TreeStore):
path = path.decode('utf8') path = path.decode('utf8')
return path return path
def is_folder(self, it, pane, path):
# A folder may no longer exist, and is only tracked by VC.
# Therefore, check the icon instead, as the pane already knows.
icon = self.get_value(it, self.column_index(COL_ICON, pane))
return icon == "folder" or os.path.isdir(path)
def column_index(self, col, pane): def column_index(self, col, pane):
return self.ntree * col + pane return self.ntree * col + pane
......
...@@ -437,7 +437,7 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component): ...@@ -437,7 +437,7 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
entries = self.vc.listdir(path) entries = self.vc.listdir(path)
entries = [e for e in entries if any(f(e) for f in filters)] entries = [e for e in entries if any(f(e) for f in filters)]
for e in entries: for e in entries:
if e.isdir: if e.isdir and e.state != tree.STATE_REMOVED:
try: try:
st = os.lstat(e.path) st = os.lstat(e.path)
# Covers certain unreadable symlink cases; see bgo#585895 # Covers certain unreadable symlink cases; see bgo#585895
...@@ -454,6 +454,11 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component): ...@@ -454,6 +454,11 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
if flattened: if flattened:
if e.state != tree.STATE_IGNORED: if e.state != tree.STATE_IGNORED:
# If directory state is changed, render it in
# in flattened mode.
if e.state != tree.STATE_NORMAL:
child = self.model.add_entries(it, [e.path])
self._update_item_state(child, e, path[prefixlen:])
todo.append((Gtk.TreePath.new_first(), e.path)) todo.append((Gtk.TreePath.new_first(), e.path))
continue continue
...@@ -491,7 +496,8 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component): ...@@ -491,7 +496,8 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
self.treeview.expand_row(path, False) self.treeview.expand_row(path, False)
else: else:
path = self.model.value_path(it, 0) path = self.model.value_path(it, 0)
self.run_diff(path) if not self.model.is_folder(it, 0, path):
self.run_diff(path)
def run_diff(self, path): def run_diff(self, path):
if os.path.isdir(path): if os.path.isdir(path):
...@@ -505,7 +511,9 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component): ...@@ -505,7 +511,9 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
'prompt_resolve': False, 'prompt_resolve': False,
} }
if self.vc.get_entry(path).state == tree.STATE_CONFLICT and \ # May have removed directories in list.
vc_entry = self.vc.get_entry(path)
if vc_entry and vc_entry.state == tree.STATE_CONFLICT and \
hasattr(self.vc, 'get_path_for_conflict'): hasattr(self.vc, 'get_path_for_conflict'):
local_label = _(u"%s — local") % basename local_label = _(u"%s — local") % basename
remote_label = _(u"%s — remote") % basename remote_label = _(u"%s — remote") % basename
......
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