/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
1
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
2
#
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
7
#
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
12
#
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
17
try:
18
    import pygtk
19
    pygtk.require("2.0")
20
except:
21
    pass
0.8.98 by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup.
22
0.13.11 by Jelmer Vernooij
Bunch of small fixes, cleanups and simplifications.
23
import gtk
24
import gtk.glade
25
import gobject
26
import pango
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
27
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
28
import bzrlib.errors as errors
93.1.10 by Alexander Belchenko
- Show file kind marker with path (i.e. directory path ends with '/')
29
from bzrlib import osutils
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
30
66.3.1 by v.ladeuil+lp at free
Fix #73737. Check empty message at commit time.
31
from dialog import error_dialog, question_dialog
93.1.12 by Alexander Belchenko
Names XML files with GUI resources obtained via olive/guifiles.py
32
from guifiles import GLADEFILENAME
93.1.6 by Alexander Belchenko
detecting name of glade file doing in separate module (olive.gladefile)
33
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
34
89 by Jelmer Vernooij
Rename OliveBranch -> BranchDialog.
35
class CommitDialog:
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
36
    """ Display Commit dialog and perform the needed actions. """
91.1.11 by Jelmer Vernooij
Cherrypick Alexanders' fix for #68127.
37
    def __init__(self, wt, wtpath, notbranch):
93.1.7 by Alexander Belchenko
Fix gcommit bug 66937 (bzr still running after cancel/commit clicked)
38
        """ Initialize the Commit dialog.
91.1.9 by Jelmer Vernooij
Use epydoc style (for consistency with Bazaar).
39
        :param  wt:         bzr working tree object
40
        :param  wtpath:     path to working tree root
91.1.11 by Jelmer Vernooij
Cherrypick Alexanders' fix for #68127.
41
        :param  notbranch:  flag that path is not a brach
42
        :type   notbranch:  bool
93.1.7 by Alexander Belchenko
Fix gcommit bug 66937 (bzr still running after cancel/commit clicked)
43
        """
93.1.6 by Alexander Belchenko
detecting name of glade file doing in separate module (olive.gladefile)
44
        self.glade = gtk.glade.XML(GLADEFILENAME, 'window_commit', 'olive-gtk')
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
45
        
0.13.1 by Jelmer Vernooij
Remove communicator use from Commit.
46
        self.wt = wt
47
        self.wtpath = wtpath
91.1.11 by Jelmer Vernooij
Cherrypick Alexanders' fix for #68127.
48
        self.notbranch = notbranch
93.1.7 by Alexander Belchenko
Fix gcommit bug 66937 (bzr still running after cancel/commit clicked)
49
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
50
        # Get some important widgets
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
51
        self.window = self.glade.get_widget('window_commit')
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
52
        self.checkbutton_local = self.glade.get_widget('checkbutton_commit_local')
53
        self.textview = self.glade.get_widget('textview_commit')
54
        self.file_view = self.glade.get_widget('treeview_commit_select')
95 by Szilveszter Farkas (Phanatic)
Added pending merges to Commit dialog. Fixed bug #66091.
55
        self.pending_label = self.glade.get_widget('label_commit_pending')
56
        self.pending_view = self.glade.get_widget('treeview_commit_pending')
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
57
91.1.11 by Jelmer Vernooij
Cherrypick Alexanders' fix for #68127.
58
        if wt is None or notbranch:
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
59
            return
60
        
61
        # Set the delta
62
        self.old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
0.13.6 by Jelmer Vernooij
Don't pass along dialog context everywhere.
63
        self.delta = self.wt.changes_from(self.old_tree)
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
64
        
95 by Szilveszter Farkas (Phanatic)
Added pending merges to Commit dialog. Fixed bug #66091.
65
        # Get pending merges
66
        self.pending = self._pending_merges(self.wt)
67
        
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
68
        # Dictionary for signal_autoconnect
69
        dic = { "on_button_commit_commit_clicked": self.commit,
70
                "on_button_commit_cancel_clicked": self.close }
93.1.7 by Alexander Belchenko
Fix gcommit bug 66937 (bzr still running after cancel/commit clicked)
71
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
72
        # Connect the signals to the handlers
73
        self.glade.signal_autoconnect(dic)
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
74
        
75
        # Create the file list
76
        self._create_file_view()
95 by Szilveszter Farkas (Phanatic)
Added pending merges to Commit dialog. Fixed bug #66091.
77
        # Create the pending merges
78
        self._create_pending_merges()
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
79
    
80
    def display(self):
91.1.11 by Jelmer Vernooij
Cherrypick Alexanders' fix for #68127.
81
        """ Display the Push dialog.
82
        @return:    True if dialog is shown.
83
        """
84
        if self.wt is None and not self.notbranch:
85
            error_dialog(_('Directory does not have a working tree'),
86
                         _('Operation aborted.'))
87
            self.close()
66.3.1 by v.ladeuil+lp at free
Fix #73737. Check empty message at commit time.
88
            dialog_shown = False
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
89
        if self.notbranch:
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
90
            error_dialog(_('Directory is not a branch'),
0.8.98 by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup.
91
                         _('You can perform this action only in a branch.'))
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
92
            self.close()
66.3.1 by v.ladeuil+lp at free
Fix #73737. Check empty message at commit time.
93
            dialog_shown = False
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
94
        else:
0.13.1 by Jelmer Vernooij
Remove communicator use from Commit.
95
            if self.wt.branch.get_bound_location() is not None:
0.8.23 by Szilveszter Farkas (Phanatic)
Visual feedback when Olive is busy; follow bzr API changes; commit dialog update
96
                # we have a checkout, so the local commit checkbox must appear
97
                self.checkbutton_local.show()
98
            
95 by Szilveszter Farkas (Phanatic)
Added pending merges to Commit dialog. Fixed bug #66091.
99
            if self.pending:
100
                # There are pending merges, file selection not supported
101
                self.file_view.set_sensitive(False)
102
            else:
103
                # No pending merges
104
                self.pending_view.set_sensitive(False)
105
            
0.8.26 by Szilveszter Farkas (Phanatic)
Implemented Diff window; added menu.py (was missing from last commit)
106
            self.textview.modify_font(pango.FontDescription("Monospace"))
0.8.23 by Szilveszter Farkas (Phanatic)
Visual feedback when Olive is busy; follow bzr API changes; commit dialog update
107
            self.window.show()
66.3.1 by v.ladeuil+lp at free
Fix #73737. Check empty message at commit time.
108
            dialog_shown = True
109
        if dialog_shown:
110
            # Gives the focus to the commit message area
111
            self.textview.grab_focus()
112
        return dialog_shown
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
113
    
114
    def _create_file_view(self):
93.1.13 by Alexander Belchenko
Fix bug introduced by revid:bialix@ukr.net-20061025102040-90bcdbad341ee3fa
115
        self.file_store = gtk.ListStore(gobject.TYPE_BOOLEAN,   # [0] checkbox
116
                                        gobject.TYPE_STRING,    # [1] path to display
117
                                        gobject.TYPE_STRING,    # [2] changes type
118
                                        gobject.TYPE_STRING)    # [3] real path
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
119
        self.file_view.set_model(self.file_store)
120
        crt = gtk.CellRendererToggle()
121
        crt.set_property("activatable", True)
122
        crt.connect("toggled", self._toggle_commit, self.file_store)
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
123
        self.file_view.append_column(gtk.TreeViewColumn(_('Commit'),
0.8.21 by Szilveszter Farkas (Phanatic)
2006-07-25 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
124
                                     crt, active=0))
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
125
        self.file_view.append_column(gtk.TreeViewColumn(_('Path'),
0.8.21 by Szilveszter Farkas (Phanatic)
2006-07-25 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
126
                                     gtk.CellRendererText(), text=1))
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
127
        self.file_view.append_column(gtk.TreeViewColumn(_('Type'),
0.8.21 by Szilveszter Farkas (Phanatic)
2006-07-25 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
128
                                     gtk.CellRendererText(), text=2))
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
129
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
130
        for path, id, kind in self.delta.added:
93.1.10 by Alexander Belchenko
- Show file kind marker with path (i.e. directory path ends with '/')
131
            marker = osutils.kind_marker(kind)
93.1.13 by Alexander Belchenko
Fix bug introduced by revid:bialix@ukr.net-20061025102040-90bcdbad341ee3fa
132
            self.file_store.append([ True, path+marker, _('added'), path ])
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
133
134
        for path, id, kind in self.delta.removed:
93.1.10 by Alexander Belchenko
- Show file kind marker with path (i.e. directory path ends with '/')
135
            marker = osutils.kind_marker(kind)
93.1.13 by Alexander Belchenko
Fix bug introduced by revid:bialix@ukr.net-20061025102040-90bcdbad341ee3fa
136
            self.file_store.append([ True, path+marker, _('removed'), path ])
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
137
138
        for oldpath, newpath, id, kind, text_modified, meta_modified in self.delta.renamed:
93.1.10 by Alexander Belchenko
- Show file kind marker with path (i.e. directory path ends with '/')
139
            marker = osutils.kind_marker(kind)
93.1.13 by Alexander Belchenko
Fix bug introduced by revid:bialix@ukr.net-20061025102040-90bcdbad341ee3fa
140
            if text_modified or meta_modified:
141
                changes = _('renamed and modified')
142
            else:
143
                changes = _('renamed')
93.1.10 by Alexander Belchenko
- Show file kind marker with path (i.e. directory path ends with '/')
144
            self.file_store.append([ True,
145
                                     oldpath+marker + '  =>  ' + newpath+marker,
93.1.13 by Alexander Belchenko
Fix bug introduced by revid:bialix@ukr.net-20061025102040-90bcdbad341ee3fa
146
                                     changes,
147
                                     newpath
148
                                   ])
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
149
150
        for path, id, kind, text_modified, meta_modified in self.delta.modified:
93.1.10 by Alexander Belchenko
- Show file kind marker with path (i.e. directory path ends with '/')
151
            marker = osutils.kind_marker(kind)
93.1.13 by Alexander Belchenko
Fix bug introduced by revid:bialix@ukr.net-20061025102040-90bcdbad341ee3fa
152
            self.file_store.append([ True, path+marker, _('modified'), path ])
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
153
    
95 by Szilveszter Farkas (Phanatic)
Added pending merges to Commit dialog. Fixed bug #66091.
154
    def _create_pending_merges(self):
155
        liststore = gtk.ListStore(gobject.TYPE_STRING,
156
                                  gobject.TYPE_STRING,
157
                                  gobject.TYPE_STRING)
158
        self.pending_view.set_model(liststore)
159
        
160
        self.pending_view.append_column(gtk.TreeViewColumn(_('Date'),
161
                                        gtk.CellRendererText(), text=0))
162
        self.pending_view.append_column(gtk.TreeViewColumn(_('Committer'),
163
                                        gtk.CellRendererText(), text=1))
164
        self.pending_view.append_column(gtk.TreeViewColumn(_('Summary'),
165
                                        gtk.CellRendererText(), text=2))
166
        
167
        if not self.pending:
168
            return
169
        
170
        for item in self.pending:
171
            liststore.append([ item['date'],
172
                               item['committer'],
173
                               item['summary'] ])
174
    
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
175
    def _get_specific_files(self):
176
        ret = []
177
        it = self.file_store.get_iter_first()
178
        while it:
179
            if self.file_store.get_value(it, 0):
93.1.13 by Alexander Belchenko
Fix bug introduced by revid:bialix@ukr.net-20061025102040-90bcdbad341ee3fa
180
                # get real path from hidden column 3
181
                ret.append(self.file_store.get_value(it, 3))
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
182
            it = self.file_store.iter_next(it)
183
184
        return ret
185
    
186
    def _toggle_commit(self, cell, path, model):
187
        model[path][0] = not model[path][0]
188
        return
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
189
    
95 by Szilveszter Farkas (Phanatic)
Added pending merges to Commit dialog. Fixed bug #66091.
190
    def _pending_merges(self, wt):
191
        """ Return a list of pending merges or None if there are none of them. """
192
        parents = wt.get_parent_ids()
193
        if len(parents) < 2:
194
            return None
195
        
196
        import re
197
        from bzrlib.osutils import format_date
198
        
199
        pending = parents[1:]
200
        branch = wt.branch
201
        last_revision = parents[0]
202
        
203
        if last_revision is not None:
204
            try:
205
                ignore = set(branch.repository.get_ancestry(last_revision))
206
            except errors.NoSuchRevision:
207
                # the last revision is a ghost : assume everything is new 
208
                # except for it
209
                ignore = set([None, last_revision])
210
        else:
211
            ignore = set([None])
212
        
213
        pm = []
214
        for merge in pending:
215
            ignore.add(merge)
216
            try:
217
                m_revision = branch.repository.get_revision(merge)
218
                
219
                rev = {}
220
                rev['committer'] = re.sub('<.*@.*>', '', m_revision.committer).strip(' ')
221
                rev['summary'] = m_revision.get_summary()
222
                rev['date'] = format_date(m_revision.timestamp,
223
                                          m_revision.timezone or 0, 
224
                                          'original', date_fmt="%Y-%m-%d",
225
                                          show_offset=False)
226
                
227
                pm.append(rev)
228
                
229
                inner_merges = branch.repository.get_ancestry(merge)
230
                assert inner_merges[0] is None
231
                inner_merges.pop(0)
232
                inner_merges.reverse()
233
                for mmerge in inner_merges:
234
                    if mmerge in ignore:
235
                        continue
236
                    mm_revision = branch.repository.get_revision(mmerge)
237
                    
238
                    rev = {}
239
                    rev['committer'] = re.sub('<.*@.*>', '', mm_revision.committer).strip(' ')
240
                    rev['summary'] = mm_revision.get_summary()
241
                    rev['date'] = format_date(mm_revision.timestamp,
242
                                              mm_revision.timezone or 0, 
243
                                              'original', date_fmt="%Y-%m-%d",
244
                                              show_offset=False)
245
                
246
                    pm.append(rev)
247
                    
248
                    ignore.add(mmerge)
249
            except errors.NoSuchRevision:
250
                print "DEBUG: NoSuchRevision:", merge
251
        
252
        return pm
253
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
254
    def commit(self, widget):
0.8.26 by Szilveszter Farkas (Phanatic)
Implemented Diff window; added menu.py (was missing from last commit)
255
        textbuffer = self.textview.get_buffer()
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
256
        start, end = textbuffer.get_bounds()
93.1.9 by Alexander Belchenko
Fix bug 67927 (non-ascii commit message saved as utf-8 string)
257
        message = textbuffer.get_text(start, end).decode('utf-8')
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
258
        
259
        checkbutton_strict = self.glade.get_widget('checkbutton_commit_strict')
260
        checkbutton_force = self.glade.get_widget('checkbutton_commit_force')
261
        
95 by Szilveszter Farkas (Phanatic)
Added pending merges to Commit dialog. Fixed bug #66091.
262
        if not self.pending:
263
            specific_files = self._get_specific_files()
264
        else:
265
            specific_files = None
66.3.1 by v.ladeuil+lp at free
Fix #73737. Check empty message at commit time.
266
267
        if message == '':
268
            response = question_dialog('Commit with an empty message ?',
269
                                       'You can describe your commit intent'
270
                                       +' in the message')
271
            if response == gtk.RESPONSE_NO:
272
                # Kindly give focus to message area
273
                self.textview.grab_focus()
274
                return
275
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
276
        try:
66.3.1 by v.ladeuil+lp at free
Fix #73737. Check empty message at commit time.
277
            self.wt.commit(message,
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
278
                           allow_pointless=checkbutton_force.get_active(),
279
                           strict=checkbutton_strict.get_active(),
0.8.23 by Szilveszter Farkas (Phanatic)
Visual feedback when Olive is busy; follow bzr API changes; commit dialog update
280
                           local=self.checkbutton_local.get_active(),
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
281
                           specific_files=specific_files)
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
282
        except errors.NotBranchError:
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
283
            error_dialog(_('Directory is not a branch'),
0.8.98 by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup.
284
                         _('You can perform this action only in a branch.'))
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
285
            return
286
        except errors.LocalRequiresBoundBranch:
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
287
            error_dialog(_('Directory is not a checkout'),
0.8.98 by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup.
288
                         _('You can perform local commit only on checkouts.'))
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
289
            return
290
        except errors.PointlessCommit:
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
291
            error_dialog(_('No changes to commit'),
0.8.98 by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup.
292
                         _('Try force commit if you want to commit anyway.'))
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
293
            return
294
        except errors.ConflictsInTree:
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
295
            error_dialog(_('Conflicts in tree'),
0.8.98 by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup.
296
                         _('You need to resolve the conflicts before committing.'))
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
297
            return
298
        except errors.StrictCommitFailed:
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
299
            error_dialog(_('Strict commit failed'),
0.8.98 by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup.
300
                         _('There are unknown files in the working tree.\nPlease add or delete them.'))
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
301
            return
302
        except errors.BoundBranchOutOfDate, errmsg:
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
303
            error_dialog(_('Bound branch is out of date'),
0.8.98 by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup.
304
                         _('%s') % errmsg)
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
305
            return
0.13.2 by Jelmer Vernooij
Handle unknown errors in commit.
306
        except errors.BzrError, msg:
0.13.4 by Jelmer Vernooij
Handle non-bzr unknown errors as well.
307
            error_dialog(_('Unknown bzr error'), str(msg))
308
            return
309
        except Exception, msg:
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
310
            error_dialog(_('Unknown error'), str(msg))
0.13.2 by Jelmer Vernooij
Handle unknown errors in commit.
311
            return
93.1.7 by Alexander Belchenko
Fix gcommit bug 66937 (bzr still running after cancel/commit clicked)
312
91.1.11 by Jelmer Vernooij
Cherrypick Alexanders' fix for #68127.
313
        self.close()
314
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
315
    def close(self, widget=None):
316
        self.window.destroy()