aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/vcs.py
diff options
context:
space:
mode:
authorGianluca Montecchi <gian@grys.it>2009-10-07 20:41:49 +0200
committerGianluca Montecchi <gian@grys.it>2009-10-07 20:41:49 +0200
commitc65661ce0bcacf67169faf3f62d495a1e8269aa8 (patch)
treef803a1417278840c938e4585b4b76bfbb9fd74fe /libbe/vcs.py
parent828721071e6283fbf7397ad7ad4b98c5d6ee49bc (diff)
downloadbugseverywhere-c65661ce0bcacf67169faf3f62d495a1e8269aa8.tar.gz
Updated to trunk
Diffstat (limited to 'libbe/vcs.py')
-rw-r--r--libbe/vcs.py32
1 files changed, 18 insertions, 14 deletions
diff --git a/libbe/vcs.py b/libbe/vcs.py
index a1d3022..7b506e8 100644
--- a/libbe/vcs.py
+++ b/libbe/vcs.py
@@ -50,7 +50,7 @@ def _get_matching_vcs(matchfn):
vcs = module.new()
if matchfn(vcs) == True:
return vcs
- del(vcs)
+ vcs.cleanup()
return VCS()
def vcs_by_name(vcs_name):
@@ -124,15 +124,12 @@ class VCS(object):
self._duplicateBasedir = None
self._duplicateDirname = None
self.encoding = encoding
- def __del__(self):
- self.cleanup()
-
- 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.
@@ -231,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.
@@ -674,7 +677,7 @@ class VCSTestCase(unittest.TestCase):
setup_vcs_test_fixtures(self)
def tearDown(self):
- del(self.vcs)
+ self.vcs.cleanup()
super(VCSTestCase, self).tearDown()
def full_path(self, rel_path):
@@ -837,6 +840,7 @@ class VCS_commit_TestCase(VCSTestCase):
def test_revision_file_contents_as_committed(self):
"""Should get file contents as committed to specified revision."""
+ import sys
if not self.vcs.versioned:
return
for path in self.test_files: