/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/shelf_ui.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-16 23:19:12 UTC
  • mfrom: (7180 work)
  • mto: This revision was merged to the branch mainline in revision 7294.
  • Revision ID: jelmer@jelmer.uk-20181116231912-e043vpq22bdkxa6q
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
    vocab = {'add file': gettext('Shelve adding file "%(path)s"?'),
49
49
             'binary': gettext('Shelve binary changes?'),
50
50
             'change kind': gettext('Shelve changing "%s" from %(other)s'
51
 
             ' to %(this)s?'),
 
51
                                    ' to %(this)s?'),
52
52
             'delete file': gettext('Shelve removing file "%(path)s"?'),
53
53
             'final': gettext('Shelve %d change(s)?'),
54
54
             'hunk': gettext('Shelve?'),
55
55
             'modify target': gettext('Shelve changing target of'
56
 
             ' "%(path)s" from "%(other)s" to "%(this)s"?'),
 
56
                                      ' "%(path)s" from "%(other)s" to "%(this)s"?'),
57
57
             'rename': gettext('Shelve renaming "%(other)s" =>'
58
 
                        ' "%(this)s"?')
 
58
                               ' "%(this)s"?')
59
59
             }
60
60
 
61
61
    invert_diff = False
100
100
    vocab = {'add file': gettext('Delete file "%(path)s"?'),
101
101
             'binary': gettext('Apply binary changes?'),
102
102
             'change kind': gettext('Change "%(path)s" from %(this)s'
103
 
             ' to %(other)s?'),
 
103
                                    ' to %(other)s?'),
104
104
             'delete file': gettext('Add file "%(path)s"?'),
105
105
             'final': gettext('Apply %d change(s)?'),
106
106
             'hunk': gettext('Apply change?'),
107
107
             'modify target': gettext('Change target of'
108
 
             ' "%(path)s" from "%(this)s" to "%(other)s"?'),
 
108
                                      ' "%(path)s" from "%(this)s" to "%(other)s"?'),
109
109
             'rename': gettext('Rename "%(this)s" => "%(other)s"?'),
110
110
             }
111
111
 
181
181
        tree.lock_tree_write()
182
182
        try:
183
183
            target_tree = builtins._get_one_revision_tree('shelf2', revision,
184
 
                tree.branch, tree)
 
184
                                                          tree.branch, tree)
185
185
            files = tree.safe_relpath_files(file_list)
186
186
            return klass(tree, target_tree, diff_writer, all, all, files,
187
187
                         message, destroy)
211
211
            if changes_shelved > 0:
212
212
                self.reporter.selected_changes(creator.work_transform)
213
213
                if (self.auto_apply or self.prompt_bool(
214
 
                    self.reporter.vocab['final'] % changes_shelved)):
 
214
                        self.reporter.vocab['final'] % changes_shelved)):
215
215
                    if self.destroy:
216
216
                        creator.transform()
217
217
                        self.reporter.changes_destroyed()
249
249
        new_path = new_tree.id2path(file_id)
250
250
        path_encoding = osutils.get_terminal_encoding()
251
251
        text_differ = diff.DiffText(old_tree, new_tree, diff_file,
252
 
            path_encoding=path_encoding)
 
252
                                    path_encoding=path_encoding)
253
253
        patch = text_differ.diff(file_id, old_path, new_path, 'file', 'file')
254
254
        diff_file.seek(0)
255
255
        return patches.parse_patch(diff_file)
406
406
            else:
407
407
                shelf_id = manager.last_shelf()
408
408
                if shelf_id is None:
409
 
                    raise errors.BzrCommandError(gettext('No changes are shelved.'))
 
409
                    raise errors.BzrCommandError(
 
410
                        gettext('No changes are shelved.'))
410
411
            apply_changes = True
411
412
            delete_shelf = True
412
413
            read_shelf = True
464
465
        cleanups = [self.tree.unlock]
465
466
        try:
466
467
            if self.read_shelf:
467
 
                trace.note(gettext('Using changes with id "%d".') % self.shelf_id)
 
468
                trace.note(gettext('Using changes with id "%d".') %
 
469
                           self.shelf_id)
468
470
                unshelver = self.manager.get_unshelver(self.shelf_id)
469
471
                cleanups.append(unshelver.finalize)
470
472
                if unshelver.message is not None:
480
482
                    self.show_changes(merger)
481
483
            if self.delete_shelf:
482
484
                self.manager.delete_shelf(self.shelf_id)
483
 
                trace.note(gettext('Deleted changes with id "%d".') % self.shelf_id)
 
485
                trace.note(gettext('Deleted changes with id "%d".') %
 
486
                           self.shelf_id)
484
487
        finally:
485
488
            for cleanup in reversed(cleanups):
486
489
                cleanup()
491
494
        tt = tree_merger.make_preview_transform()
492
495
        new_tree = tt.get_preview_tree()
493
496
        if self.write_diff_to is None:
494
 
            self.write_diff_to = ui.ui_factory.make_output_stream(encoding_type='exact')
 
497
            self.write_diff_to = ui.ui_factory.make_output_stream(
 
498
                encoding_type='exact')
495
499
        path_encoding = osutils.get_diff_header_encoding()
496
500
        diff.show_diff_trees(merger.this_tree, new_tree, self.write_diff_to,
497
 
            path_encoding=path_encoding)
 
501
                             path_encoding=path_encoding)
498
502
        tt.finalize()
499
503
 
500
504
    def show_changes(self, merger):