comparison svnwrap/svn_swig_wrapper.py @ 293:fa26c7ef0180

Exception clean-ups; use symbolic names & avoid Python 2.6 deprecations.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Thu, 19 Mar 2009 21:27:39 +0100
parents 77812f98e250
children 32d3f1716e66
comparison
equal deleted inserted replaced
292:761b095c11fb 293:fa26c7ef0180
144 self.client_context.auth_baton = self.auth_baton 144 self.client_context.auth_baton = self.auth_baton
145 self.client_context.config = svn_config 145 self.client_context.config = svn_config
146 callbacks = RaCallbacks() 146 callbacks = RaCallbacks()
147 callbacks.auth_baton = self.auth_baton 147 callbacks.auth_baton = self.auth_baton
148 self.callbacks = callbacks 148 self.callbacks = callbacks
149 self.ra = ra.open2(self.svn_url.encode('utf-8'), callbacks, 149 try:
150 svn_config, self.pool) 150 self.ra = ra.open2(self.svn_url.encode('utf-8'), callbacks,
151 svn_config, self.pool)
152 except core.SubversionException, e:
153 raise hgutil.Abort(e.args[0])
151 154
152 def HEAD(self): 155 def HEAD(self):
153 return ra.get_latest_revnum(self.ra, self.pool) 156 return ra.get_latest_revnum(self.ra, self.pool)
154 HEAD = property(HEAD) 157 HEAD = property(HEAD)
155 158
187 190
188 def tags_at_rev(self, revision): 191 def tags_at_rev(self, revision):
189 try: 192 try:
190 tags = self.list_dir('tags', revision=revision).keys() 193 tags = self.list_dir('tags', revision=revision).keys()
191 except core.SubversionException, e: 194 except core.SubversionException, e:
192 if e.apr_err == 160013: 195 if e.apr_err == core.SVN_ERR_FS_NOT_FOUND:
193 return {} 196 return {}
194 raise 197 raise
195 tag_info = {} 198 tag_info = {}
196 for t in tags: 199 for t in tags:
197 tag_info[t] = self._get_copy_source('tags/%s' % t, 200 tag_info[t] = self._get_copy_source('tags/%s' % t,
384 try: 387 try:
385 ra.replay(self.ra, revision, oldest_rev_i_have, True, e_ptr, 388 ra.replay(self.ra, revision, oldest_rev_i_have, True, e_ptr,
386 e_baton, self.pool) 389 e_baton, self.pool)
387 except core.SubversionException, e: #pragma: no cover 390 except core.SubversionException, e: #pragma: no cover
388 # can I depend on this number being constant? 391 # can I depend on this number being constant?
389 if (e.message == "Server doesn't support the replay command" 392 if (e.apr_err == core.SVN_ERR_RA_NOT_IMPLEMENTED or
390 or e.apr_err == 170003 393 e.apr_err == core.SVN_ERR_UNSUPPORTED_FEATURE):
391 or e.message == 'The requested report is unknown.'
392 or e.apr_err == 200007):
393 raise SubversionRepoCanNotReplay, ('This Subversion server ' 394 raise SubversionRepoCanNotReplay, ('This Subversion server '
394 'is older than 1.4.0, and cannot satisfy replay requests.') 395 'is older than 1.4.0, and cannot satisfy replay requests.')
395 else: 396 else:
396 raise 397 raise
397 398