Rev 6040: (jelmer) Add support for file relative URLs with a scheme. (Jelmer Vernooij) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sat Jul 23 12:09:47 UTC 2011


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

------------------------------------------------------------
revno: 6040 [merge]
revision-id: pqm at pqm.ubuntu.com-20110723120944-iot2mt9eu8qmbibo
parent: pqm at pqm.ubuntu.com-20110722141110-t853v5hoqst5iwr3
parent: jelmer at samba.org-20110723113121-g0ia0ynj6itmjf1g
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2011-07-23 12:09:44 +0000
message:
  (jelmer) Add support for file relative URLs with a scheme. (Jelmer Vernooij)
modified:
  bzrlib/help_topics/en/url-special-chars.txt urlspecialchars.txt-20110630155852-mod387qhw2i2gdzp-1
  bzrlib/tests/test_transport.py testtransport.py-20050718175618-e5cdb99f4555ddce
  bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/help_topics/en/url-special-chars.txt'
--- a/bzrlib/help_topics/en/url-special-chars.txt	2011-07-21 10:09:59 +0000
+++ b/bzrlib/help_topics/en/url-special-chars.txt	2011-07-23 11:31:21 +0000
@@ -45,3 +45,4 @@
 
   bzr log foo,branch=bla # path "foo" with the segment parameter "branch" set to "bla"
   bzr log file:foo%2Cbranch=bla # path "foo,branch=bla"
+  bzr log file:foo,branch=bla # path "foo" with segment parameter "branch" set to "bla"

=== modified file 'bzrlib/tests/test_transport.py'
--- a/bzrlib/tests/test_transport.py	2011-07-16 20:43:40 +0000
+++ b/bzrlib/tests/test_transport.py	2011-07-22 11:06:10 +0000
@@ -1023,3 +1023,10 @@
 
     def test_path(self):
         self.assertEquals("file:///foo/bar", location_to_url("/foo/bar"))
+
+    def test_relative_file_url(self):
+        self.assertEquals(urlutils.local_path_to_url(".") + "/bar",
+            location_to_url("file:bar"))
+
+    def test_absolute_file_url(self):
+        self.assertEquals("file:///bar", location_to_url("file:/bar"))

=== modified file 'bzrlib/transport/__init__.py'
--- a/bzrlib/transport/__init__.py	2011-07-19 12:00:12 +0000
+++ b/bzrlib/transport/__init__.py	2011-07-22 11:05:08 +0000
@@ -1577,10 +1577,13 @@
                 extra='URLs must be properly escaped')
         location = urlutils.local_path_to_url(location)
 
-    if urlutils.is_url(location):
-        return location
-
-    return urlutils.local_path_to_url(location)
+    if location.startswith("file:") and not location.startswith("file://"):
+        return urlutils.join(urlutils.local_path_to_url("."), location[5:])
+
+    if not urlutils.is_url(location):
+        return urlutils.local_path_to_url(location)
+
+    return location
 
 
 def get_transport(base, possible_transports=None):

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2011-07-21 07:08:05 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-07-22 11:05:08 +0000
@@ -20,6 +20,9 @@
 
 .. New commands, options, etc that users may wish to try out.
 
+* Relative local paths can now be specified in URL syntax by using the "file:" prefix.
+  (Jelmer Vernooij)
+
 Improvements
 ************
 




More information about the bazaar-commits mailing list