/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:25:14 UTC
  • mto: (0.12.2 olive)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060927172514-9d1dfd3902d9a255
Remove communicator use from Commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
 
37
37
class OliveCommit:
38
38
    """ Display Commit dialog and perform the needed actions. """
39
 
    def __init__(self, gladefile, comm, dialog):
 
39
    def __init__(self, gladefile, wt, wtpath, dialog):
40
40
        """ Initialize the Commit dialog. """
41
41
        self.gladefile = gladefile
42
42
        self.glade = gtk.glade.XML(self.gladefile, 'window_commit', 'olive-gtk')
43
43
        
44
 
        # Communication object
45
 
        self.comm = comm
 
44
        self.wt = wt
 
45
        self.wtpath = wtpath
 
46
 
46
47
        # Dialog object
47
48
        self.dialog = dialog
48
49
        
52
53
        self.textview = self.glade.get_widget('textview_commit')
53
54
        self.file_view = self.glade.get_widget('treeview_commit_select')
54
55
 
55
 
        # Check if current location is a branch
56
 
        try:
57
 
            (self.wt, path) = WorkingTree.open_containing(self.comm.get_path())
58
 
            branch = self.wt.branch
59
 
        except errors.NotBranchError:
60
 
            self.notbranch = True
61
 
            return
62
 
        except:
63
 
            raise
64
 
 
65
 
        file_id = self.wt.path2id(path)
 
56
        file_id = self.wt.path2id(wtpath)
66
57
 
67
58
        self.notbranch = False
68
59
        if file_id is None:
93
84
                                     _('You can perform this action only in a branch.'))
94
85
            self.close()
95
86
        else:
96
 
            from bzrlib.branch import Branch
97
 
            branch = Branch.open_containing(self.comm.get_path())[0]
98
 
 
99
 
            if branch.get_bound_location() is not None:
 
87
            if self.wt.branch.get_bound_location() is not None:
100
88
                # we have a checkout, so the local commit checkbox must appear
101
89
                self.checkbutton_local.show()
102
90
            
104
92
            self.window.show()
105
93
            
106
94
    
107
 
    # This code is from Jelmer Vernooij's bzr-gtk branch
108
95
    def _create_file_view(self):
109
96
        self.file_store = gtk.ListStore(gobject.TYPE_BOOLEAN,
110
97
                                        gobject.TYPE_STRING,
157
144
        
158
145
        specific_files = self._get_specific_files()
159
146
        
160
 
        self.comm.set_busy(self.window)
161
 
        # merged from Jelmer Vernooij's olive integration branch
162
147
        try:
163
148
            self.wt.commit(message, 
164
149
                           allow_pointless=checkbutton_force.get_active(),
168
153
        except errors.NotBranchError:
169
154
            self.dialog.error_dialog(_('Directory is not a branch'),
170
155
                                     _('You can perform this action only in a branch.'))
171
 
            self.comm.set_busy(self.window, False)
172
156
            return
173
157
        except errors.LocalRequiresBoundBranch:
174
158
            self.dialog.error_dialog(_('Directory is not a checkout'),
175
159
                                     _('You can perform local commit only on checkouts.'))
176
 
            self.comm.set_busy(self.window, False)
177
160
            return
178
161
        except errors.PointlessCommit:
179
162
            self.dialog.error_dialog(_('No changes to commit'),
180
163
                                     _('Try force commit if you want to commit anyway.'))
181
 
            self.comm.set_busy(self.window, False)
182
164
            return
183
165
        except errors.ConflictsInTree:
184
166
            self.dialog.error_dialog(_('Conflicts in tree'),
185
167
                                     _('You need to resolve the conflicts before committing.'))
186
 
            self.comm.set_busy(self.window, False)
187
168
            return
188
169
        except errors.StrictCommitFailed:
189
170
            self.dialog.error_dialog(_('Strict commit failed'),
190
171
                                     _('There are unknown files in the working tree.\nPlease add or delete them.'))
191
 
            self.comm.set_busy(self.window, False)
192
172
            return
193
173
        except errors.BoundBranchOutOfDate, errmsg:
194
174
            self.dialog.error_dialog(_('Bound branch is out of date'),
195
175
                                     _('%s') % errmsg)
196
 
            self.comm.set_busy(self.window, False)
197
176
            return
198
177
        except:
199
178
            raise