[BUG] full local path to bundle don't accepted in merge/pull commands

Martin Pool mbp at canonical.com
Tue Aug 1 05:49:59 BST 2006


On 31 Jul 2006, John Arbash Meinel <john at arbash-meinel.com> wrote:
> Yep.
> 
> Specifically, 'read_bundle_from_url' expects to be passed a URL, not a
> local path.
> 
> We could probably fix it easily with the attached diff.
> 
> Does it work for you?


=== modified file 'bzrlib/bundle/__init__.py'
--- bzrlib/bundle/__init__.py	2006-07-07 16:41:38 +0000
+++ bzrlib/bundle/__init__.py	2006-07-31 22:00:21 +0000
@@ -26,7 +26,8 @@
     :return: A BundleReader, may raise NotABundle if the target 
             is not a proper bundle.
     """
-    url, filename = bzrlib.urlutils.split(url, exclude_trailing_slash=False)
+    url, filename = bzrlib.urlutils.split(url.replace('\\', '/'),
+                                          exclude_trailing_slash=False)
     if not filename:
         # A path to a directory was passed in
         # definitely not a bundle

It looks OK to fix this particular problem.

Should this be done in a more general way?  There are many commands that
need to take something from the user that may be either a local path or
a url and this bug might recur.  If we have something like

  urlutils.maybe_local_to_url(url)

that turns them into a file url if necessary then everything else can
just work with file urls.

-- 
Martin




More information about the bazaar mailing list