version_added for switch Parameter changed to 2.0 Add comment to explain check_rc Parameter in _exec Function Optimize code and clean up is_svn_repo Function

pull/18777/head
Benjamin Baumer 9 years ago committed by Matt Clay
parent 92615669c0
commit d38cd4896d

@ -82,7 +82,7 @@ options:
required: false required: false
default: "yes" default: "yes"
choices: [ "yes", "no" ] choices: [ "yes", "no" ]
version_added: "1.6" version_added: "2.0"
description: description:
- If C(no), do not call svn switch before update. - If C(no), do not call svn switch before update.
''' '''
@ -111,6 +111,7 @@ class Subversion(object):
self.svn_path = svn_path self.svn_path = svn_path
def _exec(self, args, check_rc=True): def _exec(self, args, check_rc=True):
'''Execute a subversion command, and return output. If check_rc is False, returns the return code instead of the output.'''
bits = [ bits = [
self.svn_path, self.svn_path,
'--non-interactive', '--non-interactive',
@ -122,20 +123,16 @@ class Subversion(object):
if self.password: if self.password:
bits.extend(["--password", self.password]) bits.extend(["--password", self.password])
bits.extend(args) bits.extend(args)
rc, out, err = self.module.run_command(bits, check_rc)
if check_rc: if check_rc:
rc, out, err = self.module.run_command(bits, check_rc)
return out.splitlines() return out.splitlines()
else: else:
rc, out, err = self.module.run_command(bits, check_rc)
return rc return rc
def is_svn_repo(self): def is_svn_repo(self):
'''Checks if path is a SVN Repo.''' '''Checks if path is a SVN Repo.'''
rc = self._exec(["info", self.dest], check_rc=False) rc = self._exec(["info", self.dest], check_rc=False)
if rc == 0: return rc == 0
return True
else:
return False
def checkout(self): def checkout(self):
'''Creates new svn working directory if it does not already exist.''' '''Creates new svn working directory if it does not already exist.'''

Loading…
Cancel
Save