~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/push.py

  • Committer: Robert Collins
  • Date: 2009-04-23 23:35:44 UTC
  • mto: This revision was merged to the branch mainline in revision 4304.
  • Revision ID: robertc@robertcollins.net-20090423233544-3dfus3gca15ita16
Report errors back in the UI layer for push, to use the url the user gave us.

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
        dir_to = None
87
87
 
88
88
    if dir_to is None:
89
 
        br_to = br_from.create_clone_on_transport(to_transport,
90
 
            revision_id=revision_id, stacked_on=stacked_on,
91
 
            create_prefix=create_prefix, use_existing_dir=use_existing_dir)
 
89
        try:
 
90
            br_to = br_from.create_clone_on_transport(to_transport,
 
91
                revision_id=revision_id, stacked_on=stacked_on,
 
92
                create_prefix=create_prefix, use_existing_dir=use_existing_dir)
 
93
        except errors.FileExists:
 
94
            if not use_existing_dir:
 
95
                raise errors.BzrCommandError("Target directory %s"
 
96
                     " already exists, but does not have a valid .bzr"
 
97
                     " directory. Supply --use-existing-dir to push"
 
98
                     " there anyway." % location)
 
99
        except errors.NoSuchFile:
 
100
            if not create_prefix:
 
101
                raise errors.BzrCommandError("Parent directory of %s"
 
102
                    " does not exist."
 
103
                    "\nYou may supply --create-prefix to create all"
 
104
                    " leading parent directories."
 
105
                    % location)
 
106
        except errors.TooManyRedirections:
 
107
            raise errors.BzrCommandError("Too many redirections trying "
 
108
                                         "to make %s." % location)
92
109
        push_result = PushResult()
93
110
        # TODO: Some more useful message about what was copied
94
111
        try: