Rev 1308: Properly convert redirect requests to Bazaar exceptions. in http://people.samba.org/bzr/jelmer/bzr-svn/0.4

Jelmer Vernooij jelmer at samba.org
Mon Jun 23 04:18:14 BST 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/0.4

------------------------------------------------------------
revno: 1308
revision-id: jelmer at samba.org-20080623031812-b8fqdn9hiwwu95db
parent: jelmer at samba.org-20080623030911-yaum12tcthoe0hka
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2008-06-23 05:18:12 +0200
message:
  Properly convert redirect requests to Bazaar exceptions.
modified:
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  errors.py                      errors.py-20061226172623-w1sbj8ynpo0eojqp-1
  transport.py                   transport.py-20060406231150-b3472d06b3a0818d
=== modified file 'NEWS'
--- a/NEWS	2008-06-23 03:09:11 +0000
+++ b/NEWS	2008-06-23 03:18:12 +0000
@@ -52,6 +52,8 @@
 
    * Remove endless loop in logwalker. (#235776)
 
+   * Convert redirect requests received from Subversion. (#229848)
+
 bzr-svn 0.4.10  2008-05-12
 
   CHANGES

=== modified file 'errors.py'
--- a/errors.py	2008-06-22 20:17:00 +0000
+++ b/errors.py	2008-06-23 03:18:12 +0000
@@ -18,7 +18,8 @@
 from bzrlib.errors import (BzrError, ConnectionError, ConnectionReset, 
                            LockError, NotBranchError, PermissionDenied, 
                            DependencyNotPresent, NoRepositoryPresent,
-                           TransportError, UnexpectedEndOfContainerError)
+                           TransportError, UnexpectedEndOfContainerError,
+                           RedirectRequested)
 
 import urllib
 from bzrlib.plugins.svn import core
@@ -56,6 +57,7 @@
 ERR_WC_UNSUPPORTED_FORMAT = 155021
 ERR_UNKNOWN_CAPABILITY = 200026
 ERR_AUTHN_NO_PROVIDER = 215001
+ERR_RA_DAV_RELOCATED = 175011
 
 
 class NotSvnBranchPath(NotBranchError):

=== modified file 'transport.py'
--- a/transport.py	2008-06-22 23:03:15 +0000
+++ b/transport.py	2008-06-23 03:18:12 +0000
@@ -28,7 +28,7 @@
 from bzrlib.plugins.svn.auth import create_auth_baton
 from bzrlib.plugins.svn.client import get_config
 from bzrlib.plugins.svn.core import SubversionException
-from bzrlib.plugins.svn.errors import convert_svn_error, NoSvnRepositoryPresent, ERR_BAD_URL, ERR_RA_SVN_REPOS_NOT_FOUND, ERR_FS_ALREADY_EXISTS, ERR_FS_NOT_FOUND, ERR_FS_NOT_DIRECTORY
+from bzrlib.plugins.svn.errors import convert_svn_error, NoSvnRepositoryPresent, ERR_BAD_URL, ERR_RA_SVN_REPOS_NOT_FOUND, ERR_FS_ALREADY_EXISTS, ERR_FS_NOT_FOUND, ERR_FS_NOT_DIRECTORY, ERR_RA_DAV_RELOCATED
 from bzrlib.plugins.svn.ra import DIRENT_KIND, RemoteAccess
 import urlparse
 import urllib
@@ -51,7 +51,12 @@
     if isinstance(bzr_transport, SvnRaTransport):
         return bzr_transport
 
-    return SvnRaTransport(bzr_transport.base)
+    try:
+        return SvnRaTransport(bzr_transport.base)
+    except SubversionException, (msg, num):
+        if num == ERR_RA_DAV_RELOCATED:
+            raise RedirectRequested(url, msg.split("'")[1], is_permanent=True)
+        raise
 
 
 def _url_unescape_uri(url):
@@ -87,7 +92,7 @@
                 auth=create_auth_baton(url),
                 client_string_func=get_client_string)
         # FIXME: Callbacks
-    except SubversionException, (_, num):
+    except SubversionException, (msg, num):
         if num in (ERR_RA_SVN_REPOS_NOT_FOUND,):
             raise NoSvnRepositoryPresent(url=url)
         if num == ERR_BAD_URL:




More information about the bazaar-commits mailing list