/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/commit.py

  • Committer: Jelmer Vernooij
  • Date: 2006-09-27 17:40:05 UTC
  • mto: (0.12.2 olive)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060927174005-5dfa27de4081ed19
Handle non-bzr unknown errors as well.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
import sys
 
18
 
17
19
try:
18
20
    import pygtk
19
21
    pygtk.require("2.0")
20
22
except:
21
23
    pass
 
24
try:
 
25
    import gtk
 
26
    import gtk.glade
 
27
    import gobject
 
28
    import pango
 
29
except:
 
30
    sys.exit(1)
22
31
 
23
 
import gtk
24
 
import gtk.glade
25
 
import gobject
26
 
import pango
 
32
from bzrlib import version_info
27
33
 
28
34
import bzrlib.errors as errors
 
35
from bzrlib.workingtree import WorkingTree
29
36
 
30
37
from dialog import error_dialog
31
 
from olive import gladefile
32
38
 
33
39
class OliveCommit:
34
40
    """ Display Commit dialog and perform the needed actions. """
35
 
    def __init__(self, wt, wtpath):
 
41
    def __init__(self, gladefile, wt, wtpath):
36
42
        """ Initialize the Commit dialog. """
37
 
        self.glade = gtk.glade.XML(gladefile, 'window_commit', 'olive-gtk')
 
43
        self.gladefile = gladefile
 
44
        self.glade = gtk.glade.XML(self.gladefile, 'window_commit', 'olive-gtk')
38
45
        
39
46
        self.wt = wt
40
47
        self.wtpath = wtpath
54
61
        
55
62
        # Set the delta
56
63
        self.old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
57
 
        self.delta = self.wt.changes_from(self.old_tree)
 
64
        if version_info < (0, 9):
 
65
            self.delta = compare_trees(self.old_tree, self.wt)
 
66
        else:
 
67
            self.delta = self.wt.changes_from(self.old_tree)
58
68
        
59
69
        # Dictionary for signal_autoconnect
60
70
        dic = { "on_button_commit_commit_clicked": self.commit,
70
80
        """ Display the Push dialog. """
71
81
        if self.notbranch:
72
82
            error_dialog(_('Directory is not a branch'),
73
 
                         _('You can perform this action only in a branch.'))
 
83
                                     _('You can perform this action only in a branch.'))
74
84
            self.close()
75
85
        else:
76
86
            if self.wt.branch.get_bound_location() is not None:
117
127
            it = self.file_store.iter_next(it)
118
128
 
119
129
        return ret
 
130
    # end of bzr-gtk code
120
131
    
121
132
    def _toggle_commit(self, cell, path, model):
122
133
        model[path][0] = not model[path][0]
140
151
                           specific_files=specific_files)
141
152
        except errors.NotBranchError:
142
153
            error_dialog(_('Directory is not a branch'),
143
 
                         _('You can perform this action only in a branch.'))
 
154
                                     _('You can perform this action only in a branch.'))
144
155
            return
145
156
        except errors.LocalRequiresBoundBranch:
146
157
            error_dialog(_('Directory is not a checkout'),
147
 
                         _('You can perform local commit only on checkouts.'))
 
158
                                     _('You can perform local commit only on checkouts.'))
148
159
            return
149
160
        except errors.PointlessCommit:
150
161
            error_dialog(_('No changes to commit'),
151
 
                         _('Try force commit if you want to commit anyway.'))
 
162
                                     _('Try force commit if you want to commit anyway.'))
152
163
            return
153
164
        except errors.ConflictsInTree:
154
165
            error_dialog(_('Conflicts in tree'),
155
 
                         _('You need to resolve the conflicts before committing.'))
 
166
                                     _('You need to resolve the conflicts before committing.'))
156
167
            return
157
168
        except errors.StrictCommitFailed:
158
169
            error_dialog(_('Strict commit failed'),
159
 
                         _('There are unknown files in the working tree.\nPlease add or delete them.'))
 
170
                                     _('There are unknown files in the working tree.\nPlease add or delete them.'))
160
171
            return
161
172
        except errors.BoundBranchOutOfDate, errmsg:
162
173
            error_dialog(_('Bound branch is out of date'),
163
 
                         _('%s') % errmsg)
 
174
                                     _('%s') % errmsg)
164
175
            return
165
176
        except errors.BzrError, msg:
166
177
            error_dialog(_('Unknown bzr error'), str(msg))
170
181
            return
171
182
        
172
183
        self.close()
 
184
        self.comm.refresh_right()
173
185
        
174
186
    def close(self, widget=None):
175
187
        self.window.destroy()