Merge lp:~jelmer/brz/268573-outf into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: 6835
Proposed branch: lp:~jelmer/brz/268573-outf
Merge into: lp:brz
Diff against target: 116 lines (+14/-15)
4 files modified
breezy/bisect.py (+5/-5)
breezy/builtins.py (+5/-5)
breezy/status.py (+1/-5)
doc/en/release-notes/brz-3.0.txt (+3/-0)
To merge this branch: bzr merge lp:~jelmer/brz/268573-outf
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+334653@code.launchpad.net

Description of the change

use self.outf rather than sys.stdout in command implementations.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/bisect.py'
2--- breezy/bisect.py 2017-08-26 23:50:59 +0000
3+++ breezy/bisect.py 2017-12-04 01:16:07 +0000
4@@ -71,12 +71,12 @@
5 """Is the current revision a merge point?"""
6 return len(self.get_parent_revids()) > 1
7
8- def show_rev_log(self, out = sys.stdout):
9+ def show_rev_log(self, outf):
10 """Write the current revision's log entry to a file."""
11 rev = self._branch.repository.get_revision(self._revid)
12 revno = ".".join([str(x) for x in self.get_current_revno()])
13- out.write("On revision %s (%s):\n%s\n" % (revno, rev.revision_id,
14- rev.message))
15+ outf.write("On revision %s (%s):\n%s\n" % (revno, rev.revision_id,
16+ rev.message))
17
18 def switch(self, revid):
19 """Switch the current revision to the given revid."""
20@@ -186,7 +186,7 @@
21 def _switch_wc_to_revno(self, revno, outf):
22 """Move the working tree to the given revno."""
23 self._current.switch(revno)
24- self._current.show_rev_log(out=outf)
25+ self._current.show_rev_log(outf=outf)
26
27 def _set_status(self, revid, status):
28 """Set the bisect status for the given revid."""
29@@ -330,7 +330,7 @@
30 bisect_log = BisectLog(controldir)
31 if bisect_log.is_done():
32 note("No further bisection is possible.\n")
33- bisect_log._current.show_rev_log(self.outf)
34+ bisect_log._current.show_rev_log(outf=self.outf)
35 return True
36
37 if revspec:
38
39=== modified file 'breezy/builtins.py'
40--- breezy/builtins.py 2017-11-24 09:25:13 +0000
41+++ breezy/builtins.py 2017-12-04 01:16:07 +0000
42@@ -2370,7 +2370,7 @@
43 file_list, revision, old, new, self.add_cleanup, apply_view=True)
44 # GNU diff on Windows uses ANSI encoding for filenames
45 path_encoding = osutils.get_diff_header_encoding()
46- return show_diff_trees(old_tree, new_tree, sys.stdout,
47+ return show_diff_trees(old_tree, new_tree, self.outf,
48 specific_files=specific_files,
49 external_diff_options=diff_options,
50 old_label=old_label, new_label=new_label,
51@@ -4505,7 +4505,7 @@
52 writer = breezy.option.diff_writer_registry.get()
53 shelver = shelf_ui.Shelver(merger.this_tree, result_tree, destroy=True,
54 reporter=shelf_ui.ApplyReporter(),
55- diff_writer=writer(sys.stdout))
56+ diff_writer=writer(self.outf))
57 try:
58 shelver.run()
59 finally:
60@@ -5488,8 +5488,8 @@
61 hidden = True
62
63 def run(self):
64- sys.stdout.write("running\n")
65- sys.stdout.flush()
66+ self.outf.write("running\n")
67+ self.outf.flush()
68 sys.stdin.readline()
69
70
71@@ -6539,7 +6539,7 @@
72 if writer is None:
73 writer = breezy.option.diff_writer_registry.get()
74 try:
75- shelver = Shelver.from_args(writer(sys.stdout), revision, all,
76+ shelver = Shelver.from_args(writer(self.outf), revision, all,
77 file_list, message, destroy=destroy, directory=directory)
78 try:
79 shelver.run()
80
81=== modified file 'breezy/status.py'
82--- breezy/status.py 2017-09-11 03:17:16 +0000
83+++ breezy/status.py 2017-12-04 01:16:07 +0000
84@@ -84,7 +84,7 @@
85 classify=classify)
86
87
88-def show_tree_status(wt, show_unchanged=None,
89+def show_tree_status(wt,
90 specific_files=None,
91 show_ids=False,
92 to_file=None,
93@@ -127,10 +127,6 @@
94 :param show_long_callback: A callback: message = show_long_callback(to_file, delta,
95 show_ids, show_unchanged, indent, filter), only used with the long output
96 """
97- if show_unchanged is not None:
98- warn("show_tree_status with show_unchanged has been deprecated "
99- "since breezy 0.9", DeprecationWarning, stacklevel=2)
100-
101 if to_file is None:
102 to_file = sys.stdout
103
104
105=== modified file 'doc/en/release-notes/brz-3.0.txt'
106--- doc/en/release-notes/brz-3.0.txt 2017-11-20 22:51:10 +0000
107+++ doc/en/release-notes/brz-3.0.txt 2017-12-04 01:16:07 +0000
108@@ -146,6 +146,9 @@
109 * Support automatic rename tracking into new directories.
110 (mnn, #373319)
111
112+* Avoid writing directly to sys.stdout, but use self.outf in
113+ Command implementations instead. (#268573, B. Clausius)
114+
115 Documentation
116 *************
117

Subscribers

People subscribed via source and target branches