122
122
if self.radio_stored.get_active():
124
124
revs = do_push(self.comm.get_path(),
125
overwrite=self.check_overwrite.get_active())
125
overwrite=self.check_overwrite.get_active())
126
126
except errors.NotBranchError:
127
127
self.dialog.error_dialog(_('Directory is not a branch'),
128
128
_('You can perform this action only in a branch.'))
130
except errors.NoLocationKnown:
131
self.dialog.error_dialog(_('Push location is unknown'),
132
_('Please specify a location manually.'))
134
except errors.NonExistingParent, errmsg:
135
self.dialog.error_dialog(_('Non existing parent directory'),
136
_("The parent directory (%s)\ndoesn't exist.") % errmsg)
138
except errors.DivergedBranchesError:
130
except errors.DivergedBranches:
139
131
self.dialog.error_dialog(_('Branches have been diverged'),
140
132
_('You cannot push if branches have diverged. Use the\noverwrite option if you want to push anyway.'))
152
144
revs = do_push(self.comm.get_path(), location,
153
self.check_remember.get_active(),
154
self.check_overwrite.get_active(),
155
self.check_create.get_active())
145
self.check_remember.get_active(),
146
self.check_overwrite.get_active(),
147
self.check_create.get_active())
156
148
except errors.NotBranchError:
157
149
self.dialog.error_dialog(_('Directory is not a branch'),
158
150
_('You can perform this action only in a branch.'))
159
151
self.comm.set_busy(self.window, False)
161
except errors.NonExistingParent, errmsg:
162
self.dialog.error_dialog(_('Non existing parent directory'),
163
_("The parent directory (%s)\ndoesn't exist.") % errmsg)
164
self.comm.set_busy(self.window, False)
166
except errors.DivergedBranchesError:
153
except errors.DivergedBranches:
167
154
self.dialog.error_dialog(_('Branches have been diverged'),
168
155
_('You cannot push if branches have diverged. Use the\noverwrite option if you want to push anyway.'))
169
156
self.comm.set_busy(self.window, False)
171
except errors.PathPrefixNotCreated:
172
self.dialog.error_dialog(_('Path prefix not created'),
173
_("The path leading up to the specified location couldn't\nbe created."))
174
self.comm.set_busy(self.window, False)
229
211
:return: number of revisions pushed
231
213
from bzrlib.branch import Branch
214
from bzrlib.bzrdir import BzrDir
232
215
from bzrlib.transport import get_transport
234
217
br_from = Branch.open_containing(branch)[0]
252
dir_to = bzrlib.bzrdir.BzrDir.open(location_url)
237
dir_to = BzrDir.open(location_url)
253
238
br_to = dir_to.open_branch()
254
except NotBranchError:
239
except errors.NotBranchError:
255
240
# create a branch.
256
241
transport = transport.clone('..')
257
242
if not create_prefix:
259
244
relurl = transport.relpath(location_url)
260
245
transport.mkdir(relurl)
262
raise NonExistingParent(location)
246
except errors.NoSuchFile:
247
self.dialog.error_dialog(_('Non existing parent directory'),
248
_("The parent directory (%s)\ndoesn't exist.") % location)
264
251
current = transport.base
265
252
needed = [(transport, transport.relpath(location_url))]
268
255
transport, relpath = needed[-1]
269
256
transport.mkdir(relpath)
258
except errors.NoSuchFile:
272
259
new_transport = transport.clone('..')
273
260
needed.append((new_transport,
274
261
new_transport.relpath(transport.base)))
275
262
if new_transport.base == transport.base:
276
raise PathPrefixNotCreated
263
self.dialog.error_dialog(_('Path prefix not created'),
264
_("The path leading up to the specified location couldn't\nbe created."))
277
266
dir_to = br_from.bzrdir.clone(location_url,
278
267
revision_id=br_from.last_revision())
279
268
br_to = dir_to.open_branch()
285
274
tree_to = dir_to.open_workingtree()
275
except errors.NotLocalUrl:
287
276
# FIXME - what to do here? how should we warn the user?
288
277
#warning('This transport does not update the working '
289
278
# 'tree of: %s' % (br_to.base,))
290
279
count = br_to.pull(br_from, overwrite)
291
except NoWorkingTree:
280
except errors.NoWorkingTree:
292
281
count = br_to.pull(br_from, overwrite)
294
283
count = tree_to.pull(br_from, overwrite)
295
except DivergedBranches:
296
raise DivergedBranchesError
284
except errors.DivergedBranches: