Rev 4300: Report errors back in the UI layer for push, to use the url the user gave us. in http://people.ubuntu.com/~robertc/baz2.0/pending/push.roundtrips

Robert Collins robertc at robertcollins.net
Fri Apr 24 00:35:51 BST 2009


At http://people.ubuntu.com/~robertc/baz2.0/pending/push.roundtrips

------------------------------------------------------------
revno: 4300
revision-id: robertc at robertcollins.net-20090423233544-3dfus3gca15ita16
parent: robertc at robertcollins.net-20090423060744-ile6rixv4jqyqpts
committer: Robert Collins <robertc at robertcollins.net>
branch nick: push.roundtrips
timestamp: Fri 2009-04-24 09:35:44 +1000
message:
  Report errors back in the UI layer for push, to use the url the user gave us.
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2009-04-22 03:49:09 +0000
+++ b/bzrlib/branch.py	2009-04-23 23:35:44 +0000
@@ -1155,20 +1155,10 @@
                 create_prefix=create_prefix, use_existing_dir=use_existing_dir)
         except errors.FileExists:
             if not use_existing_dir:
-                raise errors.BzrCommandError("Target directory %s"
-                     " already exists, but does not have a valid .bzr"
-                     " directory. Supply --use-existing-dir to push"
-                     " there anyway." % to_transport.base)
+                raise
         except errors.NoSuchFile:
             if not create_prefix:
-                raise errors.BzrCommandError("Parent directory of %s"
-                    " does not exist."
-                    "\nYou may supply --create-prefix to create all"
-                    " leading parent directories."
-                    % to_transport.base)
-        except errors.TooManyRedirections:
-            raise errors.BzrCommandError("Too many redirections trying "
-                                         "to make %s." % to_transport.base)
+                raise
         return dir_to.open_branch()
 
     def create_checkout(self, to_location, revision_id=None,

=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2009-04-23 06:07:44 +0000
+++ b/bzrlib/bzrdir.py	2009-04-23 23:35:44 +0000
@@ -180,7 +180,7 @@
 
     def clone_on_transport(self, transport, revision_id=None,
         force_new_repo=False, preserve_stacking=False, stacked_on=None,
-        create_prefix=False, use_existing_dir=False):
+        create_prefix=False, use_existing_dir=True):
         """Clone this bzrdir and its contents to transport verbatim.
 
         :param transport: The transport for the location to produce the clone

=== modified file 'bzrlib/push.py'
--- a/bzrlib/push.py	2009-04-20 04:19:45 +0000
+++ b/bzrlib/push.py	2009-04-23 23:35:44 +0000
@@ -86,9 +86,26 @@
         dir_to = None
 
     if dir_to is None:
-        br_to = br_from.create_clone_on_transport(to_transport,
-            revision_id=revision_id, stacked_on=stacked_on,
-            create_prefix=create_prefix, use_existing_dir=use_existing_dir)
+        try:
+            br_to = br_from.create_clone_on_transport(to_transport,
+                revision_id=revision_id, stacked_on=stacked_on,
+                create_prefix=create_prefix, use_existing_dir=use_existing_dir)
+        except errors.FileExists:
+            if not use_existing_dir:
+                raise errors.BzrCommandError("Target directory %s"
+                     " already exists, but does not have a valid .bzr"
+                     " directory. Supply --use-existing-dir to push"
+                     " there anyway." % location)
+        except errors.NoSuchFile:
+            if not create_prefix:
+                raise errors.BzrCommandError("Parent directory of %s"
+                    " does not exist."
+                    "\nYou may supply --create-prefix to create all"
+                    " leading parent directories."
+                    % location)
+        except errors.TooManyRedirections:
+            raise errors.BzrCommandError("Too many redirections trying "
+                                         "to make %s." % location)
         push_result = PushResult()
         # TODO: Some more useful message about what was copied
         try:

=== modified file 'bzrlib/transport/__init__.py'
--- a/bzrlib/transport/__init__.py	2009-04-20 04:19:45 +0000
+++ b/bzrlib/transport/__init__.py	2009-04-23 23:35:44 +0000
@@ -540,7 +540,6 @@
         """
         raise errors.NotLocalUrl(self.abspath(relpath))
 
-
     def has(self, relpath):
         """Does the file relpath exist?
 




More information about the bazaar-commits mailing list