Commit b1af7f9b authored by Kai Willadsen's avatar Kai Willadsen

meld.vc: All remaining VCs are 'cached', for what it's worth

parent 81177146
......@@ -128,6 +128,7 @@ class Vc(object):
self.root, self.location = self.is_in_repo(path)
if not self.root:
raise ValueError
self._tree_cache = None
def commit_command(self, message):
raise NotImplementedError()
......@@ -201,11 +202,19 @@ class Vc(object):
def get_working_directory(self, workdir):
return workdir
def cache_inventory(self, topdir):
pass
def cache_inventory(self, directory):
self._tree_cache = self._lookup_tree_cache(directory)
def uncache_inventory(self):
pass
self._tree_cache = None
def _lookup_tree_cache(self, directory):
raise NotImplementedError()
def _get_tree_cache(self, directory):
if self._tree_cache is None:
self.cache_inventory(directory)
return self._tree_cache
def update_file_state(self, path):
""" Update the state of a specific file. For example after a file
......@@ -293,27 +302,6 @@ class Vc(object):
raise NotImplementedError
class CachedVc(Vc):
def __init__(self, location):
super(CachedVc, self).__init__(location)
self._tree_cache = None
def cache_inventory(self, directory):
self._tree_cache = self._lookup_tree_cache(directory)
def uncache_inventory(self):
self._tree_cache = None
def _lookup_tree_cache(self, directory):
raise NotImplementedError()
def _get_tree_cache(self, directory):
if self._tree_cache is None:
self.cache_inventory(directory)
return self._tree_cache
class InvalidVCPath(ValueError):
"""Raised when a VC module is passed an invalid (or not present) path."""
......
......@@ -34,7 +34,7 @@ import tempfile
from . import _vc
class Vc(_vc.CachedVc):
class Vc(_vc.Vc):
CMD = "bzr"
CMDARGS = ["--no-aliases", "--no-plugins"]
......
......@@ -38,7 +38,7 @@ from meld.conf import _, ngettext
from . import _vc
class Vc(_vc.CachedVc):
class Vc(_vc.Vc):
CMD = "git"
NAME = "Git"
......
......@@ -30,7 +30,7 @@ import tempfile
from . import _vc
class Vc(_vc.CachedVc):
class Vc(_vc.Vc):
CMD = "hg"
NAME = "Mercurial"
......
......@@ -33,7 +33,7 @@ import subprocess
from . import _vc
class Vc(_vc.CachedVc):
class Vc(_vc.Vc):
CMD = "svn"
NAME = "Subversion"
......
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