26
26
from errors import show_bzr_error
28
# FIXME: This needs to be public JRV 20070714
29
from bzrlib.builtins import _create_prefix
28
30
from bzrlib.config import LocationConfig
29
31
import bzrlib.errors as errors
31
from bzrlib.plugins.gtk import _i18n
32
33
from dialog import error_dialog, info_dialog, question_dialog
34
35
from history import UrlHistory
48
49
self.branch = branch
50
51
# Create the widgets
51
self._label_location = gtk.Label(_i18n("Location:"))
52
self._label_location = gtk.Label(_("Location:"))
52
53
self._combo = gtk.ComboBoxEntry()
53
self._button_push = gtk.Button(_i18n("_Push"), use_underline=True)
54
self._button_push = gtk.Button(_("_Push"), use_underline=True)
54
55
self._hbox_location = gtk.HBox()
92
93
""" Push button clicked handler. """
93
94
location = self._combo.get_child().get_text()
96
if self.branch is not None and self.branch.get_push_location() is None:
97
response = question_dialog(_('Set default push location'),
98
_('There is no default push location set.\nSet %r as default now?') % location)
99
if response == gtk.REPONSE_OK:
100
self.branch.set_push_location(location)
97
103
revs = do_push(self.branch, location=location, overwrite=False)
98
104
except errors.DivergedBranches:
99
response = question_dialog(_i18n('Branches have been diverged'),
100
_i18n('You cannot push if branches have diverged.\nOverwrite?'))
101
if response == gtk.RESPONSE_YES:
105
response = question_dialog(_('Branches have been diverged'),
106
_('You cannot push if branches have diverged.\nOverwrite?'))
107
if response == gtk.RESPONSE_OK:
102
108
revs = do_push(self.branch, location=location, overwrite=True)
104
if self.branch is not None and self.branch.get_push_location() is None:
105
self.branch.set_push_location(location)
107
111
self._history.add_entry(location)
108
info_dialog(_i18n('Push successful'),
109
_i18n("%d revision(s) pushed.") % revs)
112
info_dialog(_('Push successful'),
113
_("%d revision(s) pushed.") % revs)
111
115
self.response(gtk.RESPONSE_OK)
139
143
relurl = transport.relpath(location_url)
140
144
transport.mkdir(relurl)
141
145
except errors.NoSuchFile:
142
response = question_dialog(_i18n('Non existing parent directory'),
143
_i18n("The parent directory (%s)\ndoesn't exist. Create?") % location)
146
response = question_dialog(_('Non existing parent directory'),
147
_("The parent directory (%s)\ndoesn't exist. Create?") % location)
144
148
if response == gtk.RESPONSE_OK:
145
transport.create_prefix()
149
_create_prefix(transport)
148
152
dir_to = br_from.bzrdir.clone(location_url,