~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/shelf_ui.py

  • Committer: John Arbash Meinel
  • Date: 2010-01-12 22:51:31 UTC
  • mto: This revision was merged to the branch mainline in revision 4955.
  • Revision ID: john@arbash-meinel.com-20100112225131-he8h411p6aeeb947
Delay grabbing an output stream until we actually go to show a diff.

This makes the test suite happy, but it also seems to be reasonable.
If we aren't going to write anything, we don't need to hold an
output stream open.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008 Canonical Ltd
 
1
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
458
458
        self.read_shelf = read_shelf
459
459
        self.show_diff = show_diff
460
460
        self.write_diff_to = write_diff_to
461
 
        if self.write_diff_to is None:
462
 
            self.write_diff_to = ui.ui_factory.make_output_stream()
463
461
 
464
462
    def run(self):
465
463
        """Perform the unshelving operation."""
497
495
        tree_merger = merger.make_merger()
498
496
        tt = tree_merger.make_preview_transform()
499
497
        new_tree = tt.get_preview_tree()
 
498
        if self.write_diff_to is None:
 
499
            self.write_diff_to = ui.ui_factory.make_output_stream()
500
500
        diff.show_diff_trees(merger.this_tree, new_tree, self.write_diff_to)
501
501
        tt.finalize()
502
502