29
27
import bzrlib.errors as errors
31
from olive import gladefile
29
from dialog import error_dialog, info_dialog
30
from guifiles import GLADEFILENAME
34
34
""" Display Push dialog and perform the needed actions. """
35
35
def __init__(self, branch):
36
36
""" Initialize the Push dialog. """
37
self.glade = gtk.glade.XML(gladefile, 'window_push')
37
self.glade = gtk.glade.XML(GLADEFILENAME, 'window_push')
39
39
self.window = self.glade.get_widget('window_push')
104
104
revs = do_push(self.branch,
105
105
overwrite=self.check_overwrite.get_active())
106
except errors.NotBranchError:
107
error_dialog(_('Directory is not a branch'),
108
_('You can perform this action only in a branch.'))
110
106
except errors.DivergedBranches:
111
error_dialog(_('Branches have been diverged'),
112
_('You cannot push if branches have diverged. Use the\noverwrite option if you want to push anyway.'))
107
response = question_dialog(_('Branches have been diverged'),
108
_('You cannot push if branches have diverged. \nOverwrite?'))
109
if response == gtk.RESPONSE_OK:
110
revs = do_push(self.branch, overwrite=True)
114
112
elif self.radio_specific.get_active():
115
113
location = self.entry_location.get_text()
116
114
if location == '':
117
115
error_dialog(_('No location specified'),
118
_('Please specify a location or use the default.'))
116
_('Please specify a location or use the default.'))
122
120
revs = do_push(self.branch, location,
123
121
self.check_remember.get_active(),
124
self.check_overwrite.get_active(),
125
123
self.check_create.get_active())
126
except errors.NotBranchError:
127
error_dialog(_('Directory is not a branch'),
128
_('You can perform this action only in a branch.'))
130
124
except errors.DivergedBranches:
131
error_dialog(_('Branches have been diverged'),
132
_('You cannot push if branches have diverged. Use the\noverwrite option if you want to push anyway.'))
125
response = question_dialog(_('Branches have been diverged'),
126
_('You cannot push if branches have diverged. \nOverwrite?'))
127
if response == gtk.RESPONSE_OK:
128
revs = do_push(self.branch, location,
129
self.check_remember.get_active(),
131
self.check_create.get_active())
136
136
info_dialog(_('Push successful'),
137
_('%d revision(s) pushed.') % revs)
137
_('%d revision(s) pushed.') % revs)
139
139
def test(self, widget):
140
140
""" Test if write access possible. """
185
185
from bzrlib.bzrdir import BzrDir
186
186
from bzrlib.transport import get_transport
188
br_from = Branch.open_containing(branch)[0]
190
190
stored_loc = br_from.get_push_location()
191
191
if location is None:
192
192
if stored_loc is None:
193
193
error_dialog(_('Push location is unknown'),
194
_('Please specify a location manually.'))
194
_('Please specify a location manually.'))
197
197
location = stored_loc
232
232
new_transport.relpath(transport.base)))
233
233
if new_transport.base == transport.base:
234
234
error_dialog(_('Path prefix not created'),
235
_("The path leading up to the specified location couldn't\nbe created."))
235
_("The path leading up to the specified location couldn't\nbe created."))
237
237
dir_to = br_from.bzrdir.clone(location_url,
238
238
revision_id=br_from.last_revision())