Rev 4910: Delay grabbing an output stream until we actually go to show a diff. in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0rc1-unshelve-preview

John Arbash Meinel john at arbash-meinel.com
Tue Jan 12 22:51:53 GMT 2010


At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0rc1-unshelve-preview

------------------------------------------------------------
revno: 4910
revision-id: john at arbash-meinel.com-20100112225131-he8h411p6aeeb947
parent: john at arbash-meinel.com-20100112223623-836x5mou0gm5vsep
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0rc1-unshelve-preview
timestamp: Tue 2010-01-12 16:51:31 -0600
message:
  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.
-------------- next part --------------
=== modified file 'bzrlib/shelf_ui.py'
--- a/bzrlib/shelf_ui.py	2010-01-12 22:36:23 +0000
+++ b/bzrlib/shelf_ui.py	2010-01-12 22:51:31 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2008 Canonical Ltd
+# Copyright (C) 2008, 2009, 2010 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -458,8 +458,6 @@
         self.read_shelf = read_shelf
         self.show_diff = show_diff
         self.write_diff_to = write_diff_to
-        if self.write_diff_to is None:
-            self.write_diff_to = ui.ui_factory.make_output_stream()
 
     def run(self):
         """Perform the unshelving operation."""
@@ -497,6 +495,8 @@
         tree_merger = merger.make_merger()
         tt = tree_merger.make_preview_transform()
         new_tree = tt.get_preview_tree()
+        if self.write_diff_to is None:
+            self.write_diff_to = ui.ui_factory.make_output_stream()
         diff.show_diff_trees(merger.this_tree, new_tree, self.write_diff_to)
         tt.finalize()
 



More information about the bazaar-commits mailing list