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
130
129
push_result.target_branch = br_to
131
130
push_result.old_revid = _mod_revision.NULL_REVISION
132
131
push_result.old_revno = 0
133
# Remembers if asked explicitly or no previous location is set
135
or (remember is None and br_from.get_push_location() is None)):
132
if br_from.get_push_location() is None or remember:
136
133
br_from.set_push_location(br_to.base)
138
135
if stacked_on is not None:
142
139
push_result = dir_to.push_branch(br_from, revision_id, overwrite,
143
140
remember, create_prefix)
144
141
except errors.DivergedBranches:
145
raise errors.BzrCommandError(gettext('These branches have diverged.'
142
raise errors.BzrCommandError('These branches have diverged.'
146
143
' See "bzr help diverged-branches"'
147
' for more information.'))
144
' for more information.')
148
145
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.") %
146
raise errors.BzrCommandError("It is not possible to losslessly "
147
"push to %s. You may want to use dpush instead." %
151
148
e.target_branch.mapping.vcs.abbreviation)
152
149
except errors.NoRepositoryPresent:
153
150
# we have a bzrdir but no branch or repository
154
151
# XXX: Figure out what to do other than complain.
155
raise errors.BzrCommandError(gettext("At %s you have a valid .bzr"
152
raise errors.BzrCommandError("At %s you have a valid .bzr"
156
153
" control directory, but not a branch or repository. This"
157
154
" is an unsupported configuration. Please move the target"
158
" directory out of the way and try again.") % location)
155
" directory out of the way and try again." % location)
159
156
if push_result.workingtree_updated == False:
160
157
warning("This transport does not update the working "
161
158
"tree of: %s. See 'bzr help working-trees' for "