From 5323cc1ba94095938c54a2853a3827c14b420e66 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 6 Oct 2009 06:37:21 -0400 Subject: Moved VCS detection from _vcs_help() to _vcs_version(). The version string is useful information to have around, while the help string is probably not. For example, we use it in darcs.Darcs._vcs_get_file_contents() to construct an incantation appropriate to the version we're dealing with. --- libbe/vcs.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'libbe/vcs.py') diff --git a/libbe/vcs.py b/libbe/vcs.py index 6975a83..7484660 100644 --- a/libbe/vcs.py +++ b/libbe/vcs.py @@ -124,13 +124,12 @@ class VCS(object): self._duplicateBasedir = None self._duplicateDirname = None self.encoding = encoding - - def _vcs_help(self): + self.version = self._get_version() + def _vcs_version(self): """ - Return the command help string. - (Allows a simple test to see if the client is installed.) + Return the VCS version string. """ - pass + return "0.0" def _vcs_detect(self, path=None): """ Detect whether a directory is revision controlled with this VCS. @@ -229,15 +228,21 @@ class VCS(object): specified revision does not exist. """ return None - def installed(self): + def _get_version(self): try: - self._vcs_help() - return True + ret = self._vcs_version() + return ret except OSError, e: if e.errno == errno.ENOENT: - return False + return None + else: + raise OSError, e except CommandError: - return False + return None + def installed(self): + if self.version != None: + return True + return False def detect(self, path="."): """ Detect whether a directory is revision controlled with this VCS. -- cgit