48
47
"""Write a human-readable description of the result."""
49
48
if self.branch_push_result is None:
50
49
if self.stacked_on is not None:
51
note(gettext('Created new stacked branch referring to %s.') %
50
note('Created new stacked branch referring to %s.' %
54
note(gettext('Created new branch.'))
53
note('Created new branch.')
56
55
self.branch_push_result.report(to_file)
93
92
except errors.FileExists, err:
94
93
if err.path.endswith('/.bzr'):
95
raise errors.BzrCommandError(gettext(
94
raise errors.BzrCommandError(
96
95
"Target directory %s already contains a .bzr directory, "
97
"but it is not valid.") % (location,))
96
"but it is not valid." % (location,))
98
97
if not use_existing_dir:
99
raise errors.BzrCommandError(gettext("Target directory %s"
98
raise errors.BzrCommandError("Target directory %s"
100
99
" already exists, but does not have a .bzr"
101
100
" directory. Supply --use-existing-dir to push"
102
" there anyway.") % location)
101
" there anyway." % location)
103
102
# This shouldn't occur, but if it does the FileExists error will be
104
103
# more informative than an UnboundLocalError for br_to.
106
105
except errors.NoSuchFile:
107
106
if not create_prefix:
108
raise errors.BzrCommandError(gettext("Parent directory of %s"
107
raise errors.BzrCommandError("Parent directory of %s"
109
108
" does not exist."
110
109
"\nYou may supply --create-prefix to create all"
111
" leading parent directories.")
110
" leading parent directories."
113
112
# This shouldn't occur (because create_prefix is true, so
114
113
# create_clone_on_transport should be catching NoSuchFile and
117
116
# UnboundLocalError for br_to.
119
118
except errors.TooManyRedirections:
120
raise errors.BzrCommandError(gettext("Too many redirections trying "
121
"to make %s.") % location)
119
raise errors.BzrCommandError("Too many redirections trying "
120
"to make %s." % location)
122
121
push_result = PushResult()
123
122
# TODO: Some more useful message about what was copied
142
141
push_result = dir_to.push_branch(br_from, revision_id, overwrite,
143
142
remember, create_prefix)
144
143
except errors.DivergedBranches:
145
raise errors.BzrCommandError(gettext('These branches have diverged.'
144
raise errors.BzrCommandError('These branches have diverged.'
146
145
' See "bzr help diverged-branches"'
147
' for more information.'))
146
' for more information.')
148
147
except errors.NoRoundtrippingSupport, e:
149
raise errors.BzrCommandError(gettext("It is not possible to losslessly "
150
"push to %s. You may want to use dpush instead.") %
148
raise errors.BzrCommandError("It is not possible to losslessly "
149
"push to %s. You may want to use dpush instead." %
151
150
e.target_branch.mapping.vcs.abbreviation)
152
151
except errors.NoRepositoryPresent:
153
# we have a controldir but no branch or repository
152
# we have a bzrdir but no branch or repository
154
153
# XXX: Figure out what to do other than complain.
155
raise errors.BzrCommandError(gettext("At %s you have a valid .bzr"
154
raise errors.BzrCommandError("At %s you have a valid .bzr"
156
155
" control directory, but not a branch or repository. This"
157
156
" is an unsupported configuration. Please move the target"
158
" directory out of the way and try again.") % location)
157
" directory out of the way and try again." % location)
159
158
if push_result.workingtree_updated == False:
160
159
warning("This transport does not update the working "
161
160
"tree of: %s. See 'bzr help working-trees' for "