[meld] vcview, vc.git: Identify and don't descend ignored folders (bgo#684400)
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] vcview, vc.git: Identify and don't descend ignored folders (bgo#684400)
- Date: Sat, 29 Mar 2014 20:19:38 +0000 (UTC)
commit c5432d9749bb625d64e3459a0d4425b9f1273604
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Mar 8 10:17:48 2014 +1000
vcview, vc.git: Identify and don't descend ignored folders (bgo#684400)
meld/vc/git.py | 13 +++++++++----
meld/vcview.py | 7 ++++---
2 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/meld/vc/git.py b/meld/vc/git.py
index d777a17..adb250e 100644
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@ -301,9 +301,10 @@ class Vc(_vc.CachedVc):
try:
entries = self._get_modified_files(path)
- # Identify ignored files
+ # Identify ignored files and folders
proc = _vc.popen([self.CMD, "ls-files", "--others",
- "--ignored", "--exclude-standard", path],
+ "--ignored", "--exclude-standard",
+ "--directory", path],
cwd=self.location)
ignored_entries = proc.read().split("\n")[:-1]
@@ -325,6 +326,7 @@ class Vc(_vc.CachedVc):
# 'entries' list, and tree_state['path'] will still contain stale
# data. When this corner case occurs we force tree_state['path']
# to STATE_NORMAL.
+ path = os.path.abspath(path)
tree_state[path] = _vc.STATE_NORMAL
else:
# There are 1 or more modified files, parse their state
@@ -335,6 +337,7 @@ class Vc(_vc.CachedVc):
# Git returns unix-style paths on Windows
name = os.path.normpath(name.strip())
path = os.path.join(self.root, name.strip())
+ path = os.path.abspath(path)
state = self.state_map.get(statekey.strip(), _vc.STATE_NONE)
tree_state[path] = state
if old_mode != new_mode:
@@ -344,10 +347,12 @@ class Vc(_vc.CachedVc):
for entry in ignored_entries:
path = os.path.join(self.location, entry.strip())
+ path = os.path.abspath(path)
tree_state[path] = _vc.STATE_IGNORED
for entry in unversioned_entries:
path = os.path.join(self.location, entry.strip())
+ path = os.path.abspath(path)
tree_state[path] = _vc.STATE_NONE
def _lookup_tree_cache(self, rootdir):
@@ -371,8 +376,8 @@ class Vc(_vc.CachedVc):
meta = self._tree_meta_cache.get(path, "")
retfiles.append(_vc.File(path, name, state, options=meta))
for name, path in dirs:
- # git does not operate on dirs, just files
- retdirs.append(_vc.Dir(path, name, _vc.STATE_NORMAL))
+ state = tree.get(path, _vc.STATE_NORMAL)
+ retdirs.append(_vc.Dir(path, name, state))
for path, state in tree.items():
# removed files are not in the filesystem, so must be added here
if state in (_vc.STATE_REMOVED, _vc.STATE_MISSING):
diff --git a/meld/vcview.py b/meld/vcview.py
index 8f8e0e8..5c1d109 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -427,13 +427,14 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
symlinks_followed.add(key)
if flattened:
- todo.append((Gtk.TreePath.new_first(), e.path))
+ if e.state != tree.STATE_IGNORED:
+ todo.append((Gtk.TreePath.new_first(), e.path))
continue
child = self.model.add_entries(it, [e.path])
- self._update_item_state(child, e, path[prefixlen:])
- if e.isdir:
+ if e.isdir and e.state != tree.STATE_IGNORED:
todo.append((self.model.get_path(child), e.path))
+ self._update_item_state(child, e, path[prefixlen:])
if flattened:
root = Gtk.TreePath.new_first()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]