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

  • Committer: John Arbash Meinel
  • Date: 2007-10-02 23:08:12 UTC
  • mto: (322.1.1 trunk) (330.3.3 trunk)
  • mto: This revision was merged to the branch mainline in revision 368.
  • Revision ID: john@arbash-meinel.com-20071002230812-h8i6pq8fwvodute4
Start testing with Unicode data.
It seems there is some brokenness with serializing Unicode messages.
But otherwise everything seems to be working.

Show diffs side-by-side

added added

removed removed

Lines of Context:
154
154
        self._pending_box.show()
155
155
 
156
156
    def _fill_in_files(self):
157
 
        # We should really use _iter_changes, and then add a progress bar of
158
 
        # some kind.
 
157
        # We should really use add a progress bar of some kind.
159
158
        # While we fill in the view, hide the store
160
159
        store = self._files_store
161
160
        self._treeview_files.set_model(None)
180
179
        self._wt.lock_read()
181
180
        self._basis_tree.lock_read()
182
181
        try:
183
 
            for (file_id, paths, changed_content, versioned, parent_ids, names,
184
 
                 kinds, executables) in self._wt._iter_changes(self._basis_tree):
185
 
 
186
 
                # Skip the root entry.
187
 
                if parent_ids == (None, None):
188
 
                    continue
189
 
 
190
 
                change_type = None
191
 
                if kinds[0] is None:
192
 
                    source_marker = ''
193
 
                else:
194
 
                    source_marker = osutils.kind_marker(kinds[0])
195
 
                if kinds[1] is None:
196
 
                    assert kinds[0] is not None
197
 
                    marker = osutils.kind_marker(kinds[0])
198
 
                else:
199
 
                    marker = osutils.kind_marker(kinds[1])
200
 
 
201
 
                real_path = paths[1]
202
 
                if real_path is None:
203
 
                    real_path = paths[0]
204
 
                assert real_path is not None
205
 
                display_path = real_path + marker
206
 
 
207
 
                present_source = versioned[0] and kinds[0] is not None
208
 
                present_target = versioned[1] and kinds[1] is not None
209
 
 
210
 
                if present_source != present_target:
211
 
                    if present_target:
212
 
                        change_type = added
213
 
                    else:
214
 
                        change_type = removed
215
 
                elif names[0] != names[1] or parent_ids[0] != parent_ids[1]:
216
 
                    # Renamed
217
 
                    if changed_content or executables[0] != executables[1]:
218
 
                        # and modified
219
 
                        change_type = renamed_and_modified
220
 
                    else:
221
 
                        change_type = renamed
222
 
                    display_path = (paths[0] + source_marker
223
 
                                    + ' => ' + paths[1] + marker)
224
 
                elif kinds[0] != kinds[1]:
225
 
                    change_type = kind_changed
226
 
                    display_path = (paths[0] + source_marker
227
 
                                    + ' => ' + paths[1] + marker)
228
 
                elif changed_content is True or executables[0] != executables[1]:
229
 
                    change_type = modified
230
 
                else:
231
 
                    assert False, "How did we get here?"
232
 
 
233
 
                store.append([file_id, real_path, True, display_path,
 
182
            from diff import _iter_changes_to_status
 
183
            for (file_id, real_path, change_type, display_path
 
184
                ) in _iter_changes_to_status(self._basis_tree, self._wt):
 
185
                store.append([file_id, real_path.encode('UTF-8'),
 
186
                              True, display_path.encode('UTF-8'),
234
187
                              change_type, ''])
235
188
        finally:
236
189
            self._basis_tree.unlock()
510
463
            if path is None:
511
464
                self._diff_view.show_diff(None)
512
465
            else:
513
 
                self._diff_view.show_diff([path])
 
466
                self._diff_view.show_diff([path.decode('UTF-8')])
514
467
            self._update_per_file_info(selection)
515
468
 
516
469
    def _save_current_file_message(self):
551
504
        file_info = []
552
505
        for record in records:
553
506
            if record[2]: # [2] checkbox
554
 
                file_id = record[0]
555
 
                path = record[1]
556
 
                file_message = record[5]
557
 
                files.append(record[1]) # [1] real path
 
507
                file_id = record[0] # [0] file_id
 
508
                path = record[1] # [1] real path
 
509
                file_message = record[5] # [5] commit message
 
510
                files.append(path.decode('UTF-8'))
558
511
                if file_message:
 
512
                    # All of this needs to be utf-8 information
559
513
                    file_info.append({'path':path, 'file_id':file_id,
560
514
                                     'message':file_message})
561
515
        file_info.sort(key=lambda x:(x['path'], x['file_id']))
630
584
 
631
585
    def _set_global_commit_message(self, message):
632
586
        """Just a helper for the test suite."""
 
587
        if isinstance(message, unicode):
 
588
            message = message.encode('UTF-8')
633
589
        self._global_message_text_view.get_buffer().set_text(message)
634
590
 
635
591
    def _set_file_commit_message(self, message):
636
592
        """Helper for the test suite."""
 
593
        if isinstance(message, unicode):
 
594
            message = message.encode('UTF-8')
637
595
        self._file_message_text_view.get_buffer().set_text(message)
638
596
 
639
597
    @staticmethod