~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/shelf_ui.py

  • Committer: Martin Pool
  • Date: 2010-01-29 14:09:05 UTC
  • mto: This revision was merged to the branch mainline in revision 4992.
  • Revision ID: mbp@sourcefrog.net-20100129140905-2uiarb6p8di1ywsr
Correction to url

from review: https://code.edge.launchpad.net/~mbp/bzr/doc/+merge/18250

Show diffs side-by-side

added added

removed removed

Lines of Context:
241
241
            new_tree = self.work_tree
242
242
        old_path = old_tree.id2path(file_id)
243
243
        new_path = new_tree.id2path(file_id)
244
 
        text_differ = diff.DiffText(old_tree, new_tree, diff_file,
245
 
            path_encoding=osutils.get_terminal_encoding())
 
244
        text_differ = diff.DiffText(old_tree, new_tree, diff_file)
246
245
        patch = text_differ.diff(file_id, old_path, new_path, 'file', 'file')
247
246
        diff_file.seek(0)
248
247
        return patches.parse_patch(diff_file)
472
471
                if unshelver.message is not None:
473
472
                    trace.note('Message: %s' % unshelver.message)
474
473
                change_reporter = delta._ChangeReporter()
475
 
                merger = unshelver.make_merger(None)
476
 
                merger.change_reporter = change_reporter
477
 
                if self.apply_changes:
478
 
                    merger.do_merge()
479
 
                elif self.show_diff:
480
 
                    self.write_diff(merger)
481
 
                else:
482
 
                    self.show_changes(merger)
 
474
                task = ui.ui_factory.nested_progress_bar()
 
475
                try:
 
476
                    merger = unshelver.make_merger(task)
 
477
                    merger.change_reporter = change_reporter
 
478
                    if self.apply_changes:
 
479
                        merger.do_merge()
 
480
                    elif self.show_diff:
 
481
                        self.write_diff(merger)
 
482
                    else:
 
483
                        self.show_changes(merger)
 
484
                finally:
 
485
                    task.finished()
483
486
            if self.delete_shelf:
484
487
                self.manager.delete_shelf(self.shelf_id)
485
488
                trace.note('Deleted changes with id "%d".' % self.shelf_id)
494
497
        new_tree = tt.get_preview_tree()
495
498
        if self.write_diff_to is None:
496
499
            self.write_diff_to = ui.ui_factory.make_output_stream()
497
 
        path_encoding = osutils.get_diff_header_encoding()
498
 
        diff.show_diff_trees(merger.this_tree, new_tree, self.write_diff_to,
499
 
            path_encoding=path_encoding)
 
500
        diff.show_diff_trees(merger.this_tree, new_tree, self.write_diff_to)
500
501
        tt.finalize()
501
502
 
502
503
    def show_changes(self, merger):