/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: Daniel Schierbeck
  • Date: 2008-01-13 14:12:49 UTC
  • mto: (423.1.2 trunk)
  • mto: This revision was merged to the branch mainline in revision 429.
  • Revision ID: daniel.schierbeck@gmail.com-20080113141249-gd0i2lknr3yik55r
Moved branch view to its own package.

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.RESPONSE_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?'))
 
105
            response = question_dialog(_('Branches have been diverged'),
 
106
                                       _('You cannot push if branches have diverged.\nOverwrite?'))
101
107
            if response == gtk.RESPONSE_YES:
102
108
                revs = do_push(self.branch, location=location, overwrite=True)
103
109
        
104
 
        if self.branch is not None and self.branch.get_push_location() is None:
105
 
            self.branch.set_push_location(location)
106
 
        
107
110
        self._history.add_entry(location)
108
 
        info_dialog(_i18n('Push successful'),
109
 
                    _i18n("%d revision(s) pushed.") % revs)
 
111
        info_dialog(_('Push successful'),
 
112
                    _("%d revision(s) pushed.") % revs)
110
113
        
111
114
        self.response(gtk.RESPONSE_OK)
112
115
 
139
142
            relurl = transport.relpath(location_url)
140
143
            transport.mkdir(relurl)
141
144
        except errors.NoSuchFile:
142
 
            response = question_dialog(_i18n('Non existing parent directory'),
143
 
                         _i18n("The parent directory (%s)\ndoesn't exist. Create?") % location)
 
145
            response = question_dialog(_('Non existing parent directory'),
 
146
                         _("The parent directory (%s)\ndoesn't exist. Create?") % location)
144
147
            if response == gtk.RESPONSE_OK:
145
 
                transport.create_prefix()
 
148
                _create_prefix(transport)
146
149
            else:
147
150
                return
148
151
        dir_to = br_from.bzrdir.clone(location_url,