Merge lp:~cleekbi/bzr-svn/allow-spaces into lp:bzr-svn/1.0

Proposed by Billie Cleek
Status: Rejected
Rejected by: Jelmer Vernooij
Proposed branch: lp:~cleekbi/bzr-svn/allow-spaces
Merge into: lp:bzr-svn/1.0
Diff against target: 31 lines (+5/-1)
2 files modified
tests/test_transport.py (+4/-0)
transport.py (+1/-1)
To merge this branch: bzr merge lp:~cleekbi/bzr-svn/allow-spaces
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) Disapprove
Review via email: mp+17118@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Please provide a patch that demonstrates that this change is actually necessary, e.g. attempting to open a location with spaces in it using Transport

E.g. please try: "bzr ls http://svn.gnome.org/svn/gtk+/branches/branch%20with%20spaces"

This breaks badly with your patch but works fine with current bzr-svn (although it gives a 404).

review: Disapprove
Revision history for this message
Billie Cleek (cleekbi) wrote :

I have modified the branch to unescape the uri prior to escaping it, to ensure that any escaped sequences don't get their escape character escaped. However, I am not able to see "breaks badly", because executing "bzr ls http://svn.gnome.org/svn/gtk+/branches/branch%20with%20spaces" with the most recent release, 1.0.1, gives

2.875 Traceback (most recent call last):
  File "bzrlib\commands.pyo", line 842, in exception_to_return_code
  File "bzrlib\commands.pyo", line 1037, in run_bzr
  File "bzrlib\commands.pyo", line 654, in run_argv_aliases
  File "bzrlib\commands.pyo", line 1052, in ignore_pipe
  File "bzrlib\builtins.pyo", line 2487, in run
  File "bzrlib\bzrdir.pyo", line 973, in open_containing_tree_or_branch
  File "bzrlib\bzrdir.pyo", line 945, in _get_tree_branch
  File "C:/Documents and Settings/cleekbi/Application Data/bazaar/2.0/plugins\svn\remote.py", line 224, in open_branch
  File "C:/Documents and Settings/cleekbi/Application Data/bazaar/2.0/plugins\svn\remote.py", line 142, in find_repository
  File "C:/Documents and Settings/cleekbi/Application Data/bazaar/2.0/plugins\svn\repository.py", line 390, in __init__
  File "C:/Documents and Settings/cleekbi/Application Data/bazaar/2.0/plugins\svn\transport.py", line 362, in get_uuid
  File "C:/Documents and Settings/cleekbi/Application Data/bazaar/2.0/plugins\svn\transport.py", line 320, in get_connection
  File "C:/Documents and Settings/cleekbi/Application Data/bazaar/2.0/plugins\svn\transport.py", line 272, in get
SubversionException: ("'http://svn.gnome.org/svn/gtk%2B' isn't in the same repository as 'http://svn.gnome.org/svn/gtk+'", 170000)

I will gladly make any modifications that I need to make to ensure that urls with spaces are properly handled.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

With the current trunk of bzr-svn I get a 404 when I attempt to do that.

With your change, I get the error you've pasted.

Revision history for this message
Billie Cleek (cleekbi) wrote :
Download full text (4.3 KiB)

With my fix, I get this (copied from the BZR_LOG:
0.078 bzr arguments: [u'ls', u'http://svn.gnome.org/svn/gtk+/trunk/']
0.078 looking for plugins in C:/Documents and Settings/cleekbi/Application Data/bazaar/2.0/plugins
0.187 looking for plugins in C:/Program Files/Bazaar/plugins
0.187 Plugin name svn already loaded
0.250 encoding stdout as sys.stdout encoding 'cp437'
0.312 bzr-svn: using Subversion 1.5.6 ()
4.125 potential branching layouts: [('trunk0', 301)]
4.125 Guessed repository layout: TrunkLayout(0), guess layout to use: CustomLayout(['runk'],[])
5.703 Traceback (most recent call last):
  File "bzrlib\commands.pyo", line 842, in exception_to_return_code
  File "bzrlib\commands.pyo", line 1037, in run_bzr
  File "bzrlib\commands.pyo", line 654, in run_argv_aliases
  File "bzrlib\commands.pyo", line 1052, in ignore_pipe
  File "bzrlib\builtins.pyo", line 2487, in run
  File "bzrlib\bzrdir.pyo", line 973, in open_containing_tree_or_branch
  File "bzrlib\bzrdir.pyo", line 945, in _get_tree_branch
  File "C:/Documents and Settings/cleekbi/Application Data/bazaar/2.0/plugins\svn\remote.py", line 229, in open_branch
  File "C:/Documents and Settings/cleekbi/Application Data/bazaar/2.0/plugins\svn\branch.py", line 189, in __init__
NotBranchError: Not a branch: "http://svn.gnome.org/svn/gtk%2B/runk".

With the current trunk I get (copied straight from my command window so you can see the plugin version number):

C:\Platform\ExampleAll>bzr ls "http://svn.gnome.org/svn/gtk+/trunk/"
bzr: ERROR: subvertpy.SubversionException: ("'http://svn.gnome.org/svn/gtk%2B' i
sn't in the same repository as 'http://svn.gnome.org/svn/gtk+'", 170000)

Traceback (most recent call last):
  File "bzrlib\commands.pyo", line 842, in exception_to_return_code
  File "bzrlib\commands.pyo", line 1037, in run_bzr
  File "bzrlib\commands.pyo", line 654, in run_argv_aliases
  File "bzrlib\commands.pyo", line 1052, in ignore_pipe
  File "bzrlib\builtins.pyo", line 2487, in run
  File "bzrlib\bzrdir.pyo", line 973, in open_containing_tree_or_branch
  File "bzrlib\bzrdir.pyo", line 945, in _get_tree_branch
  File "C:/Documents and Settings/cleekbi/Application Data/bazaar/2.0/plugins\sv
n\remote.py", line 228, in open_branch
  File "C:/Documents and Settings/cleekbi/Application Data/bazaar/2.0/plugins\sv
n\remote.py", line 142, in find_repository
  File "C:/Documents and Settings/cleekbi/Application Data/bazaar/2.0/plugins\sv
n\repository.py", line 394, in __init__
  File "C:/Documents and Settings/cleekbi/Application Data/bazaar/2.0/plugins\sv
n\transport.py", line 405, in get_uuid
  File "C:/Documents and Settings/cleekbi/Application Data/bazaar/2.0/plugins\sv
n\transport.py", line 360, in get_connection
  File "C:/Documents and Settings/cleekbi/Application Data/bazaar/2.0/plugins\sv
n\transport.py", line 312, in get
SubversionException: ("'http://svn.gnome.org/svn/gtk%2B' isn't in the same repos
itory as 'http://svn.gnome.org/svn/gtk+'", 170000)

bzr 2.0.3 on python 2.5.4 (Windows-XP-5.1.2600-SP2)
arguments: ['bzr', 'ls', 'http://svn.gnome.org/svn/gtk+/trunk/']
encoding: 'cp1252', fsenc: 'mbcs', lang: None
plugins:
  bzrtools C:\Program Files\Bazaar\plugin...

Read more...

Revision history for this message
Billie Cleek (cleekbi) wrote :

I just tested "bzr ls http://svn.gnome.org/svn/gtk+" using the bzr 2.0.3 release for Mac OS X, which includes bzr-svn 1.0.1, and got the same errors with a very similar stacktrace that I reported above for trunk without my fix.

Unmerged revisions

3241. By Billie H. Cleek <email address hidden>

FIXED: unit tests would always fail due to mixture of exepected escape sequences

3240. By Billie Cleek

1. FIXED: urls containing spaces fail on all operations that require contacting the repository. escape urls before passing to subverpty.
2. added test cases for urls containing spaces

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/test_transport.py'
2--- tests/test_transport.py 2009-07-20 14:58:55 +0000
3+++ tests/test_transport.py 2010-01-11 02:16:15 +0000
4@@ -222,10 +222,14 @@
5 def test_url_unescape_uri(self):
6 self.assertEquals("http://svn.gnome.org/svn/gtk+/trunk",
7 _url_unescape_uri("http://svn.gnome.org/svn/gtk%2B/trunk"))
8+ self.assertEquals("http://svn.gnome.org/svn/gtk+/branches/branch%20with%20spaces",
9+ _url_unescape_uri("http://svn.gnome.org/svn/gtk%2B/branches/branch with spaces"))
10
11 def test_url_escape_uri(self):
12 self.assertEquals("http://svn.gnome.org/svn/gtk%2B/trunk",
13 _url_escape_uri("http://svn.gnome.org/svn/gtk+/trunk"))
14+ self.assertEquals("http://svn.gnome.org/svn/gtk%2B/branches/branch with spaces",
15+ _url_escape_uri("http://svn.gnome.org/svn/gtk+/branches/branch%20with%20spaces"))
16
17 def test_url_join_unescaped_path(self):
18 self.assertEquals("http://svn.gnome.org/svn/gtk%2B/trunk",
19
20=== modified file 'transport.py'
21--- transport.py 2009-11-24 14:15:33 +0000
22+++ transport.py 2010-01-11 02:16:15 +0000
23@@ -246,7 +246,7 @@
24 progress_cb = None
25 assert type(url) == str
26 try:
27- ret = subvertpy.ra.RemoteAccess(url, auth=auth,
28+ ret = subvertpy.ra.RemoteAccess(_url_escape_uri(url), auth=auth,
29 client_string_func=bzrlib.plugins.svn.get_client_string,
30 progress_cb=progress_cb)
31 if 'transport' in debug.debug_flags:

Subscribers

People subscribed via source and target branches