/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 olive/push.py

  • Committer: Jelmer Vernooij
  • Date: 2007-01-29 23:27:09 UTC
  • Revision ID: jelmer@samba.org-20070129232709-0yygg83sh9is3xvw
Use decorator for catching and showing bzr-gtk errors graphically. Eventually, this should go away and should be handled by the ui factory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
        if self.radio_stored.get_active():
103
103
            try:
104
104
                revs = do_push(self.branch,
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.'))
109
 
                return
110
105
            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.'))
 
106
                response = question_dialog(_('Branches have been diverged'),
 
107
                             _('You cannot push if branches have diverged. \nOverwrite?'))
 
108
                if response == gtk.RESPONSE_OK:
 
109
                    revs = do_push(self.branch, overwrite=True)
113
110
                return
114
111
        elif self.radio_specific.get_active():
115
112
            location = self.entry_location.get_text()
121
118
            try:
122
119
                revs = do_push(self.branch, location,
123
120
                               self.check_remember.get_active(),
124
 
                               self.check_overwrite.get_active(),
 
121
                               False,
125
122
                               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.'))
129
 
                return
130
123
            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.'))
133
 
                return
 
124
                response = question_dialog(_('Branches have been diverged'),
 
125
                             _('You cannot push if branches have diverged. \nOverwrite?'))
 
126
                if response == gtk.RESPONSE_OK:
 
127
                    revs = do_push(self.branch, location,
 
128
                        self.check_remember.get_active(),
 
129
                            True,
 
130
                            self.check_create.get_active())
 
131
                else:
 
132
                    return
134
133
        
135
134
        self.close()
136
135
        info_dialog(_('Push successful'),