Mercurial > bitten > bitten-test
changeset 564:2145ec6680fd
Allow passing `username` and `password` to subversion `checkout` and `export` (fixes #349)
author | dfraser |
---|---|
date | Mon, 11 May 2009 15:46:54 +0000 |
parents | a5a7e19399b5 |
children | 78109beea395 |
files | bitten/build/svntools.py doc/commands.txt |
diffstat | 2 files changed, 23 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/bitten/build/svntools.py +++ b/bitten/build/svntools.py @@ -67,7 +67,8 @@ if errors: raise Error, errors -def checkout(ctxt, url, path=None, revision=None, dir_='.', verbose=False, shared_path=None): +def checkout(ctxt, url, path=None, revision=None, dir_='.', verbose=False, shared_path=None, + username=None, password=None): """Perform a checkout from a Subversion repository. :param ctxt: the build context @@ -78,6 +79,8 @@ :param dir_: the name of a local subdirectory to check out into :param verbose: whether to log the list of checked out files :param shared_path: a shared directory to do the checkout in, before copying to dir_ + :param username: a username of the repository + :param password: a password of the repository """ args = ['checkout'] if revision: @@ -86,6 +89,10 @@ final_url = posixpath.join(url, path.lstrip('/')) else: final_url = url + if username: + args += ['--username', username] + if password: + args += ['--password', password] args += [final_url, dir_] cofilter = None @@ -106,7 +113,7 @@ if returncode != 0: ctxt.error('svn checkout failed (%s)' % returncode) -def export(ctxt, url, path=None, revision=None, dir_='.'): +def export(ctxt, url, path=None, revision=None, dir_='.', username=None, password=None): """Perform an export from a Subversion repository. :param ctxt: the build context @@ -115,12 +122,18 @@ :param path: the path inside the repository :param revision: the revision to check out :param dir_: the name of a local subdirectory to export out into + :param username: a username of the repository + :param password: a password of the repository """ args = ['export', '--force'] if revision: args += ['-r', revision] if path: url = posixpath.join(url, path) + if username: + args += ['--username', username] + if password: + args += ['--password', password] args += [url, dir_] from bitten.build import shtools
--- a/doc/commands.txt +++ b/doc/commands.txt @@ -795,6 +795,10 @@ | | relative to the project directory, so for standard usage | | | set it to something like ``../trunk`` | +-----------------+-------------------------------------------------------------+ +| ``username`` | Username to pass for authentication (optional) | ++-----------------+-------------------------------------------------------------+ +| ``password`` | Password to pass for authentication (optional) | ++-----------------+-------------------------------------------------------------+ Examples @@ -836,6 +840,10 @@ | ``dir`` | Path specifying which directory the sources should be | | | exported to (defaults to '.') | +--------------+-------------------------------------------------------------+ +| ``username`` | Username to pass for authentication (optional) | ++--------------+-------------------------------------------------------------+ +| ``password`` | Password to pass for authentication (optional) | ++--------------+-------------------------------------------------------------+ Examples --------