[PATCH] svn: Update a file's status after its been modified
- From: Peter Tyser <ptyser gmail com>
- To: meld-list gnome org
- Subject: [PATCH] svn: Update a file's status after its been modified
- Date: Sun, 16 Jan 2011 15:34:53 -0600
This commit is very similar to 15dadb2bbc0c0da116fdd6e920306268f1cf37d5,
but resolves the bug for subversion which was recently modified to use
CachedVC.
Previously, a VcView diff of a subversion-controlled directory could
easily become out of date. For example, if the file 'AUTHORS' was a
version controlled file in a svn repository:
> echo "asdf" >> AUTHORS
> meld ./
# Double click on the AUTHORS file to view its diff.
# Save the AUTHORS file. This will cause meld to cache its current
state (modified).
# Remove the "asdf" at the bottom of the file and save it.
# Close the AUTHORS tab.
# The state of the AUTHORS file will still show up as modified, even
though it is now unmodified.
Signed-off-by: Peter Tyser <ptyser gmail com>
---
meld/vc/svn.py | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/meld/vc/svn.py b/meld/vc/svn.py
index a3d7b01..dc7e913 100644
--- a/meld/vc/svn.py
+++ b/meld/vc/svn.py
@@ -73,18 +73,16 @@ class Vc(_vc.CachedVc):
def switch_to_external_diff(self):
self.external_diff = "diff"
- def _lookup_tree_cache(self, rootdir):
+ def _update_tree_state_cache(self, path, tree_state):
while 1:
try:
- status_cmd = [self.CMD, "status", "-v", "--xml", rootdir]
+ status_cmd = [self.CMD, "status", "-v", "--xml", path]
tree = ElementTree.parse(_vc.popen(status_cmd))
break
except OSError, e:
if e.errno != errno.EAGAIN:
raise
- tree_state = {}
-
for target in tree.findall("target"):
for entry in (t for t in target.getchildren() if t.tag == "entry"):
path = entry.attrib["path"]
@@ -103,7 +101,16 @@ class Vc(_vc.CachedVc):
tree_state[mydir] = {}
tree_state[mydir][name] = (item, rev)
- return tree_state
+ def _lookup_tree_cache(self, rootdir):
+ # Get a list of all files in rootdir, as well as their status
+ tree_state = {}
+ self._update_tree_state_cache(rootdir, tree_state)
+
+ return tree_state
+
+ def update_file_state(self, path):
+ tree_state = self._get_tree_cache(os.path.dirname(path))
+ self._update_tree_state_cache(path, tree_state)
def _get_dirsandfiles(self, directory, dirs, files):
tree = self._get_tree_cache(directory)
--
1.7.1.13.gcfb88
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]