Rev 5294: (spiv) Fix 'bzr pull' when lp: URL explicitly defined in in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Jun 15 05:32:52 BST 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5294 [merge]
revision-id: pqm at pqm.ubuntu.com-20100615043249-b5xx4yeyfyfbfyav
parent: pqm at pqm.ubuntu.com-20100614231448-vm57uwy8iq2iwww1
parent: andrew.bennetts at canonical.com-20100615030831-78s16nmrfiv3wdcn
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2010-06-15 05:32:49 +0100
message:
  (spiv) Fix 'bzr pull' when lp: URL explicitly defined in
  	locations.conf or branch.conf. (Gordon Tyler, #534787)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/test_urlutils.py  test_urlutils.py-20060502192900-46b1f9579987cf9c
  bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
  bzrlib/urlutils.py             urlutils.py-20060502195429-e8a161ecf8fac004
=== modified file 'NEWS'
--- a/NEWS	2010-06-14 21:41:32 +0000
+++ b/NEWS	2010-06-15 04:32:49 +0000
@@ -55,6 +55,10 @@
 * Relative imports in plugins are now handled correctly when using
   BZR_PLUGINS_AT. (Vincent Ladeuil, #588959)
 
+* ``bzr pull`` now works when a lp: URL is explicitly defined as the parent
+  or pull location in locations.conf or branch.conf.
+  (Gordon Tyler, #534787)
+
 Improvements
 ************
 

=== modified file 'bzrlib/tests/test_urlutils.py'
--- a/bzrlib/tests/test_urlutils.py	2010-06-08 01:31:34 +0000
+++ b/bzrlib/tests/test_urlutils.py	2010-06-15 03:08:31 +0000
@@ -195,6 +195,20 @@
             dirname('path/to/foo/', exclude_trailing_slash=False))
         self.assertEqual('path/..', dirname('path/../foo'))
         self.assertEqual('../path', dirname('../path/foo'))
+    
+    def test_is_url(self):
+        self.assertTrue(urlutils.is_url('http://foo/bar'))
+        self.assertTrue(urlutils.is_url('bzr+ssh://foo/bar'))
+        self.assertTrue(urlutils.is_url('lp:foo/bar'))
+        self.assertTrue(urlutils.is_url('file:///foo/bar'))
+        self.assertFalse(urlutils.is_url(''))
+        self.assertFalse(urlutils.is_url('foo'))
+        self.assertFalse(urlutils.is_url('foo/bar'))
+        self.assertFalse(urlutils.is_url('/foo'))
+        self.assertFalse(urlutils.is_url('/foo/bar'))
+        self.assertFalse(urlutils.is_url('C:/'))
+        self.assertFalse(urlutils.is_url('C:/foo'))
+        self.assertFalse(urlutils.is_url('C:/foo/bar'))
 
     def test_join(self):
         def test(expected, *args):

=== modified file 'bzrlib/transport/__init__.py'
--- a/bzrlib/transport/__init__.py	2010-05-30 16:26:11 +0000
+++ b/bzrlib/transport/__init__.py	2010-06-02 01:45:31 +0000
@@ -1551,9 +1551,6 @@
         return transport
 
 
-# We try to recognize an url lazily (ignoring user, password, etc)
-_urlRE = re.compile(r'^(?P<proto>[^:/\\]+)://(?P<rest>.*)$')
-
 def get_transport(base, possible_transports=None):
     """Open a transport to access a URL or directory.
 
@@ -1572,8 +1569,7 @@
     base = directories.dereference(base)
 
     def convert_path_to_url(base, error_str):
-        m = _urlRE.match(base)
-        if m:
+        if urlutils.is_url(base):
             # This looks like a URL, but we weren't able to
             # instantiate it as such raise an appropriate error
             # FIXME: we have a 'error_str' unused and we use last_err below

=== modified file 'bzrlib/urlutils.py'
--- a/bzrlib/urlutils.py	2010-06-14 17:58:24 +0000
+++ b/bzrlib/urlutils.py	2010-06-15 04:32:49 +0000
@@ -104,6 +104,11 @@
     return len(scheme), first_path_slash+m.start('path')
 
 
+def is_url(url):
+    """Tests whether a URL is in actual fact a URL."""
+    return _url_scheme_re.match(url) is not None
+
+
 def join(base, *args):
     """Create a URL by joining sections.
 




More information about the bazaar-commits mailing list