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

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-08-01 16:16:31 UTC
  • mto: (0.14.1 main) (93.1.1 win32.bialix)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060801161631-ca1ac79e3726e307
Visual feedback when Olive is busy; follow bzr API changes; commit dialog update

2006-08-01  Szilveszter Farkas <Szilveszter.Farkas@gmail.com>

    * olive/frontend/gtk/push.py: now the number of pushed revisions gets
      displayed (Fixed: #54698)
    * olive/backend/info.py: added is_checkout()
    * olive/frontend/gtk/commit.py: local commit checkbox shows up only if the
      current directory is a checkout
    * olive/backend/fileops.py: upgraded to new API (compare_trees deprecated)
    * many files: the cursor changes to a watch when performing time consuming
      operations (Fixed: #54015)

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
    """ Display Commit dialog and perform the needed actions. """
39
39
    def __init__(self, gladefile, comm):
40
40
        """ Initialize the Commit dialog. """
 
41
        import bzrlib
 
42
        
41
43
        self.gladefile = gladefile
42
44
        self.glade = gtk.glade.XML(self.gladefile, 'window_commit')
43
45
        
64
66
        
65
67
        # Set the delta
66
68
        self.old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
67
 
        self.delta = compare_trees(self.old_tree, self.wt)
 
69
        if bzrlib.version_info[1] < 9:
 
70
            self.delta = compare_trees(self.old_tree, self.wt)
 
71
        else:
 
72
            self.delta = self.wt.changes_from(self.old_tree)
68
73
        
69
74
        # Get the Commit dialog widget
70
75
        self.window = self.glade.get_widget('window_commit')
78
83
        
79
84
        # Create the file list
80
85
        self._create_file_view()
 
86
        
 
87
        # Some additional widgets
 
88
        self.checkbutton_local = self.glade.get_widget('checkbutton_commit_local')
81
89
    
82
90
    def display(self):
83
91
        """ Display the Push dialog. """
84
92
        if self.notbranch:
85
93
            self.dialog.error_dialog('Directory is not a branch.')
86
94
        else:
87
 
            self.window.show_all()
 
95
            from olive.backend.info import is_checkout
 
96
            if is_checkout(self.comm.get_path()):
 
97
                # we have a checkout, so the local commit checkbox must appear
 
98
                self.checkbutton_local.show()
 
99
            
 
100
            self.window.show()
 
101
            
88
102
    
89
103
    # This code is from Jelmer Vernooij's bzr-gtk branch
90
104
    def _create_file_view(self):
136
150
        start, end = textbuffer.get_bounds()
137
151
        message = textbuffer.get_text(start, end)
138
152
        
139
 
        checkbutton_local = self.glade.get_widget('checkbutton_commit_local')
140
153
        checkbutton_strict = self.glade.get_widget('checkbutton_commit_strict')
141
154
        checkbutton_force = self.glade.get_widget('checkbutton_commit_force')
142
155
        
143
156
        specific_files = self._get_specific_files()
144
157
        
 
158
        self.comm.set_busy(self.window)
145
159
        # merged from Jelmer Vernooij's olive integration branch
146
160
        try:
147
161
            self.wt.commit(message, 
148
162
                           allow_pointless=checkbutton_force.get_active(),
149
163
                           strict=checkbutton_strict.get_active(),
150
 
                           local=checkbutton_local.get_active(),
 
164
                           local=self.checkbutton_local.get_active(),
151
165
                           specific_files=specific_files)
152
166
        except errors.NotBranchError:
153
167
            self.dialog.error_dialog('Directory is not a branch.')
 
168
            self.comm.set_busy(self.window, False)
154
169
            return
155
170
        except errors.LocalRequiresBoundBranch:
156
171
            self.dialog.error_dialog('Local commit requires a bound branch.')
 
172
            self.comm.set_busy(self.window, False)
157
173
            return
158
174
        except errors.PointlessCommit:
159
175
            self.dialog.error_dialog('No changes to commit. Try force commit.')
 
176
            self.comm.set_busy(self.window, False)
160
177
            return
161
178
        except errors.ConflictsInTree:
162
179
            self.dialog.error_dialog('Conflicts in tree. Please resolve them first.')
 
180
            self.comm.set_busy(self.window, False)
163
181
            return
164
182
        except errors.StrictCommitFailed:
165
183
            self.dialog.error_dialog('Strict commit failed. There are unknown files.')
 
184
            self.comm.set_busy(self.window, False)
166
185
            return
167
186
        except errors.BoundBranchOutOfDate, errmsg:
168
187
            self.dialog.error_dialog('Bound branch is out of date: %s' % errmsg)
 
188
            self.comm.set_busy(self.window, False)
169
189
            return
170
190
        except:
171
191
            raise