Rev 1478: Deliver encoded paths in URLs to Subversion in switch() and reparent() functions. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk

Jelmer Vernooij jelmer at samba.org
Thu Jul 17 17:46:41 BST 2008


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

------------------------------------------------------------
revno: 1478
revision-id: jelmer at samba.org-20080717164639-g9p8wks1rchmgobk
parent: jelmer at samba.org-20080717160751-eg2sqhqj40ktz153
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Thu 2008-07-17 18:46:39 +0200
message:
  Deliver encoded paths in URLs to Subversion in switch() and reparent() functions.
modified:
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
  transport.py                   transport.py-20060406231150-b3472d06b3a0818d
=== modified file 'NEWS'
--- a/NEWS	2008-07-08 23:28:17 +0000
+++ b/NEWS	2008-07-17 16:46:39 +0000
@@ -99,6 +99,9 @@
 
    * Cope with files that are special files but not symlinks. (#245788)
 
+   * Deliver encoded paths in URLs to Subversion in switch() and reparent()
+     functions. (#248892)
+
 bzr-svn 0.4.10  2008-05-12
 
   CHANGES

=== modified file 'fetch.py'
--- a/fetch.py	2008-07-17 16:07:51 +0000
+++ b/fetch.py	2008-07-17 16:46:39 +0000
@@ -39,6 +39,7 @@
 from bzrlib.plugins.svn.properties import parse_externals_description
 from bzrlib.plugins.svn.repository import SvnRepository, SvnRepositoryFormat
 from bzrlib.plugins.svn.svk import SVN_PROP_SVK_MERGE
+from bzrlib.plugins.svn.transport import _url_escape_uri
 from bzrlib.plugins.svn.tree import inventory_add_external
 
 def _escape_commit_message(message):
@@ -642,7 +643,7 @@
 
                         if parent_branch != editor.branch_path:
                             reporter = conn.do_switch(editor.revnum, "", True, 
-                                urlutils.join(repos_root, editor.branch_path), 
+                                _url_escape_uri(urlutils.join(repos_root, editor.branch_path)), 
                                 editor)
                         else:
                             reporter = conn.do_update(editor.revnum, "", True, editor)

=== modified file 'transport.py'
--- a/transport.py	2008-07-07 17:10:55 +0000
+++ b/transport.py	2008-07-17 16:46:39 +0000
@@ -64,7 +64,17 @@
 
 def _url_unescape_uri(url):
     (scheme, netloc, path, query, fragment) = urlparse.urlsplit(url)
-    path = urllib.unquote(path)
+    if scheme in ("http", "https"):
+        # Without this, URLs with + in them break
+        path = urllib.unquote(path)
+    return urlparse.urlunsplit((scheme, netloc, path, query, fragment))
+
+
+def _url_escape_uri(url):
+    (scheme, netloc, path, query, fragment) = urlparse.urlsplit(url)
+    if scheme in ("http", "https"):
+        # Without this, URLs with + in them break
+        path = urllib.quote(path)
     return urlparse.urlunsplit((scheme, netloc, path, query, fragment))
 
 
@@ -88,9 +98,7 @@
         url = url[len("svn+"):] # Skip svn+
         warn_svnplus(url)
 
-    if url.startswith("http"):
-        # Without this, URLs with + in them break
-        url = _url_unescape_uri(url)
+    url = _url_unescape_uri(url)
 
     # The SVN libraries don't like trailing slashes...
     url = url.rstrip('/')
@@ -136,7 +144,7 @@
             return Connection(url)
         c = self.connections.pop()
         try:
-            c.reparent(url)
+            c.reparent(_url_escape_uri(url))
             return c
         except NotImplementedError:
             self.connections.add(c)




More information about the bazaar-commits mailing list