comparison svnwrap/svn_swig_wrapper.py @ 234:33e885f5f86a

Add --username and --password options to all commands
author Daniel Tang <dytang@cs.purdue.edu>
date Mon, 06 Apr 2009 02:52:14 -0400
parents 80a700398995
children 2969a20e0eef
comparison
equal deleted inserted replaced
233:80a700398995 234:33e885f5f86a
116 """Wrapper for a Subversion repository. 116 """Wrapper for a Subversion repository.
117 117
118 This uses the SWIG Python bindings, and will only work on svn >= 1.4. 118 This uses the SWIG Python bindings, and will only work on svn >= 1.4.
119 It takes a required param, the URL. 119 It takes a required param, the URL.
120 """ 120 """
121 def __init__(self, url='', username=''): 121 def __init__(self, url='', username='', password=''):
122 self.svn_url = url 122 self.svn_url = url
123 self.username = username 123 self.username = username
124 self.password = password
124 self.auth_baton_pool = core.Pool() 125 self.auth_baton_pool = core.Pool()
125 self.auth_baton = _create_auth_baton(self.auth_baton_pool) 126 self.auth_baton = _create_auth_baton(self.auth_baton_pool)
126 127
127 self.init_ra_and_client() 128 self.init_ra_and_client()
128 self.uuid = ra.get_uuid(self.ra, self.pool) 129 self.uuid = ra.get_uuid(self.ra, self.pool)
141 self.pool = core.Pool() 142 self.pool = core.Pool()
142 if self.username: 143 if self.username:
143 core.svn_auth_set_parameter(self.auth_baton, 144 core.svn_auth_set_parameter(self.auth_baton,
144 core.SVN_AUTH_PARAM_DEFAULT_USERNAME, 145 core.SVN_AUTH_PARAM_DEFAULT_USERNAME,
145 self.username) 146 self.username)
147 if self.password:
148 core.svn_auth_set_parameter(self.auth_baton,
149 core.SVN_AUTH_PARAM_DEFAULT_PASSWORD,
150 self.password)
146 self.client_context = client.create_context() 151 self.client_context = client.create_context()
147 152
148 self.client_context.auth_baton = self.auth_baton 153 self.client_context.auth_baton = self.auth_baton
149 self.client_context.config = svn_config 154 self.client_context.config = svn_config
150 callbacks = RaCallbacks() 155 callbacks = RaCallbacks()