/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to push.py

  • Committer: matkor
  • Date: 2007-08-23 10:17:40 UTC
  • mto: This revision was merged to the branch mainline in revision 265.
  • Revision ID: matkor@laptop-hp-20070823101740-s17kf9qa383wiuje
Code for "branch update" menuitem and toolbox. Typo fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
from errors import show_bzr_error
27
27
 
 
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
30
32
 
31
 
from bzrlib.plugins.gtk import _i18n
32
33
from dialog import error_dialog, info_dialog, question_dialog
33
34
 
34
35
from history import UrlHistory
48
49
        self.branch = branch
49
50
        
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()
55
56
        
56
57
        # Set callbacks
92
93
        """ Push button clicked handler. """
93
94
        location = self._combo.get_child().get_text()
94
95
        revs = 0
95
 
        
 
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)
 
101
 
96
102
        try:
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)
103
 
        
104
 
        if self.branch is not None and self.branch.get_push_location() is None:
105
 
            self.branch.set_push_location(location)
 
109
            return
106
110
        
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)
110
114
        
111
115
        self.response(gtk.RESPONSE_OK)
112
116
 
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)
146
150
            else:
147
151
                return
148
152
        dir_to = br_from.bzrdir.clone(location_url,