diff 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
line wrap: on
line diff
--- a/svnwrap/svn_swig_wrapper.py
+++ b/svnwrap/svn_swig_wrapper.py
@@ -146,8 +146,11 @@ class SubversionRepo(object):
         callbacks = RaCallbacks()
         callbacks.auth_baton = self.auth_baton
         self.callbacks = callbacks
-        self.ra = ra.open2(self.svn_url.encode('utf-8'), callbacks,
-                           svn_config, self.pool)
+        try:
+            self.ra = ra.open2(self.svn_url.encode('utf-8'), callbacks,
+                               svn_config, self.pool)
+        except core.SubversionException, e:
+            raise hgutil.Abort(e.args[0])
 
     def HEAD(self):
         return ra.get_latest_revnum(self.ra, self.pool)
@@ -189,7 +192,7 @@ class SubversionRepo(object):
         try:
             tags = self.list_dir('tags', revision=revision).keys()
         except core.SubversionException, e:
-            if e.apr_err == 160013:
+            if e.apr_err == core.SVN_ERR_FS_NOT_FOUND:
                 return {}
             raise
         tag_info = {}
@@ -386,10 +389,8 @@ class SubversionRepo(object):
                       e_baton, self.pool)
         except core.SubversionException, e: #pragma: no cover
             # can I depend on this number being constant?
-            if (e.message == "Server doesn't support the replay command"
-                or e.apr_err == 170003
-                or e.message == 'The requested report is unknown.'
-                or e.apr_err == 200007):
+            if (e.apr_err == core.SVN_ERR_RA_NOT_IMPLEMENTED or
+                e.apr_err == core.SVN_ERR_UNSUPPORTED_FEATURE):
                 raise SubversionRepoCanNotReplay, ('This Subversion server '
                    'is older than 1.4.0, and cannot satisfy replay requests.')
             else: