Merge lp:~mbp/bzr/deprecation-old into lp:bzr

Proposed by Martin Pool
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~mbp/bzr/deprecation-old
Merge into: lp:bzr
Diff against target: None lines
To merge this branch: bzr merge lp:~mbp/bzr/deprecation-old
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+12260@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote :

Just removing a bit more deprecated cruft.

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:
> Martin Pool has proposed merging lp:~mbp/bzr/deprecation-old into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
>
> Just removing a bit more deprecated cruft.
>

I'm happy to bring in the deprecation and cleanup, though
+ @deprecated_method(deprecated_in((1, 17, 0)))
     def note(self, fmt_string, *args):

^- I'm not sure that we want to backport our deprecations. :)

So other than that line

 review: approve
 merge: approve
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkq6KpMACgkQJdeBCYSNAAOaEgCfXar7AaA565CrgLybXu+O8GPz
rksAn3RU76sYdo+4gCji7WPpwALgYHng
=MzqU
-----END PGP SIGNATURE-----

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2009-06-23 04:02:23 +0000
3+++ NEWS 2009-06-23 09:17:21 +0000
4@@ -131,6 +131,9 @@
5 API Changes
6 ***********
7
8+* ``ProgressTask.note`` is deprecated.
9+ (Martin Pool)
10+
11 * Removed overspecific error class ``InvalidProgressBarType``.
12 (Martin Pool)
13
14
15=== modified file 'bzrlib/bzrdir.py'
16--- bzrlib/bzrdir.py 2009-06-22 15:13:45 +0000
17+++ bzrlib/bzrdir.py 2009-06-23 09:17:21 +0000
18@@ -577,8 +577,7 @@
19 # permissions as the .bzr directory (probably a bug in copy_tree)
20 old_path = self.root_transport.abspath('.bzr')
21 new_path = self.root_transport.abspath('backup.bzr')
22- pb.note('making backup of %s' % (old_path,))
23- pb.note(' to %s' % (new_path,))
24+ ui.ui_factory.note('making backup of %s\n to %s' % (old_path, new_path,))
25 self.root_transport.copy_tree('.bzr', 'backup.bzr')
26 return (old_path, new_path)
27 finally:
28@@ -2575,14 +2574,14 @@
29 """See Converter.convert()."""
30 self.bzrdir = to_convert
31 self.pb = pb
32- self.pb.note('starting upgrade from format 4 to 5')
33+ ui.ui_factory.note('starting upgrade from format 4 to 5')
34 if isinstance(self.bzrdir.transport, local.LocalTransport):
35 self.bzrdir.get_workingtree_transport(None).delete('stat-cache')
36 self._convert_to_weaves()
37 return BzrDir.open(self.bzrdir.root_transport.base)
38
39 def _convert_to_weaves(self):
40- self.pb.note('note: upgrade may be faster if all store files are ungzipped first')
41+ ui.ui_factory.note('note: upgrade may be faster if all store files are ungzipped first')
42 try:
43 # TODO permissions
44 stat = self.bzrdir.transport.stat('weaves')
45@@ -2616,10 +2615,10 @@
46 self.pb.clear()
47 self._write_all_weaves()
48 self._write_all_revs()
49- self.pb.note('upgraded to weaves:')
50- self.pb.note(' %6d revisions and inventories', len(self.revisions))
51- self.pb.note(' %6d revisions not present', len(self.absent_revisions))
52- self.pb.note(' %6d texts', self.text_count)
53+ ui.ui_factory.note('upgraded to weaves:')
54+ ui.ui_factory.note(' %6d revisions and inventories' % len(self.revisions))
55+ ui.ui_factory.note(' %6d revisions not present' % len(self.absent_revisions))
56+ ui.ui_factory.note(' %6d texts' % self.text_count)
57 self._cleanup_spare_files_after_format4()
58 self.branch._transport.put_bytes(
59 'branch-format',
60@@ -2693,8 +2692,8 @@
61 len(self.known_revisions))
62 if not self.branch.repository.has_revision(rev_id):
63 self.pb.clear()
64- self.pb.note('revision {%s} not present in branch; '
65- 'will be converted as a ghost',
66+ ui.ui_factory.note('revision {%s} not present in branch; '
67+ 'will be converted as a ghost' %
68 rev_id)
69 self.absent_revisions.add(rev_id)
70 else:
71@@ -2827,7 +2826,7 @@
72 """See Converter.convert()."""
73 self.bzrdir = to_convert
74 self.pb = pb
75- self.pb.note('starting upgrade from format 5 to 6')
76+ ui.ui_factory.note('starting upgrade from format 5 to 6')
77 self._convert_to_prefixed()
78 return BzrDir.open(self.bzrdir.root_transport.base)
79
80@@ -2835,7 +2834,7 @@
81 from bzrlib.store import TransportStore
82 self.bzrdir.transport.delete('branch-format')
83 for store_name in ["weaves", "revision-store"]:
84- self.pb.note("adding prefixes to %s" % store_name)
85+ ui.ui_factory.note("adding prefixes to %s" % store_name)
86 store_transport = self.bzrdir.transport.clone(store_name)
87 store = TransportStore(store_transport, prefixed=True)
88 for urlfilename in store_transport.list_dir('.'):
89@@ -2875,7 +2874,7 @@
90 self.dir_mode = self.bzrdir._get_dir_mode()
91 self.file_mode = self.bzrdir._get_file_mode()
92
93- self.pb.note('starting upgrade from format 6 to metadir')
94+ ui.ui_factory.note('starting upgrade from format 6 to metadir')
95 self.bzrdir.transport.put_bytes(
96 'branch-format',
97 "Converting to format 6",
98@@ -2931,7 +2930,7 @@
99 else:
100 has_checkout = True
101 if not has_checkout:
102- self.pb.note('No working tree.')
103+ ui.ui_factory.note('No working tree.')
104 # If some checkout files are there, we may as well get rid of them.
105 for name, mandatory in checkout_files:
106 if name in bzrcontents:
107@@ -3006,7 +3005,7 @@
108 else:
109 if not isinstance(repo._format, self.target_format.repository_format.__class__):
110 from bzrlib.repository import CopyConverter
111- self.pb.note('starting repository conversion')
112+ ui.ui_factory.note('starting repository conversion')
113 converter = CopyConverter(self.target_format.repository_format)
114 converter.convert(repo, pb)
115 try:
116
117=== modified file 'bzrlib/progress.py'
118--- bzrlib/progress.py 2009-06-10 03:56:49 +0000
119+++ bzrlib/progress.py 2009-06-23 09:17:21 +0000
120@@ -129,16 +129,27 @@
121 own_fraction = 0.0
122 return self._parent_task._overall_completion_fraction(own_fraction)
123
124+ @deprecated_method(deprecated_in((1, 17, 0)))
125 def note(self, fmt_string, *args):
126- """Record a note without disrupting the progress bar."""
127- # XXX: shouldn't be here; put it in mutter or the ui instead
128+ """Record a note without disrupting the progress bar.
129+
130+ Deprecated: use ui_factory.note() instead or bzrlib.trace. Note that
131+ ui_factory.note takes just one string as the argument, not a format
132+ string and arguments.
133+ """
134 if args:
135 self.ui_factory.note(fmt_string % args)
136 else:
137 self.ui_factory.note(fmt_string)
138
139 def clear(self):
140- # XXX: shouldn't be here; put it in mutter or the ui instead
141+ # TODO: deprecate this method; the model object shouldn't be concerned
142+ # with whether it's shown or not. Most callers use this because they
143+ # want to write some different non-progress output to the screen, but
144+ # they should probably instead use a stream that's synchronized with
145+ # the progress output. It may be there is a model-level use for
146+ # saying "this task's not active at the moment" but I don't see it. --
147+ # mbp 20090623
148 self.ui_factory.clear_term()
149
150
151
152=== modified file 'bzrlib/reconcile.py'
153--- bzrlib/reconcile.py 2009-06-10 03:56:49 +0000
154+++ bzrlib/reconcile.py 2009-06-23 09:17:21 +0000
155@@ -90,26 +90,25 @@
156 # Nothing to check here
157 self.fixed_branch_history = None
158 return
159- self.pb.note('Reconciling branch %s',
160- self.branch.base)
161+ ui.ui_factory.note('Reconciling branch %s' % self.branch.base)
162 branch_reconciler = self.branch.reconcile(thorough=True)
163 self.fixed_branch_history = branch_reconciler.fixed_history
164
165 def _reconcile_repository(self):
166 self.repo = self.bzrdir.find_repository()
167- self.pb.note('Reconciling repository %s',
168- self.repo.bzrdir.root_transport.base)
169+ ui.ui_factory.note('Reconciling repository %s' %
170+ self.repo.bzrdir.root_transport.base)
171 self.pb.update("Reconciling repository", 0, 1)
172 repo_reconciler = self.repo.reconcile(thorough=True)
173 self.inconsistent_parents = repo_reconciler.inconsistent_parents
174 self.garbage_inventories = repo_reconciler.garbage_inventories
175 if repo_reconciler.aborted:
176- self.pb.note(
177+ ui.ui_factory.note(
178 'Reconcile aborted: revision index has inconsistent parents.')
179- self.pb.note(
180+ ui.ui_factory.note(
181 'Run "bzr check" for more details.')
182 else:
183- self.pb.note('Reconciliation complete.')
184+ ui.ui_factory.note('Reconciliation complete.')
185
186
187 class BranchReconciler(object):
188@@ -151,13 +150,13 @@
189 # set_revision_history, as this will regenerate it again.
190 # Not really worth a whole BranchReconciler class just for this,
191 # though.
192- self.pb.note('Fixing last revision info %s => %s',
193- last_revno, len(real_history))
194+ ui.ui_factory.note('Fixing last revision info %s => %s' % (
195+ last_revno, len(real_history)))
196 self.branch.set_last_revision_info(len(real_history),
197 last_revision_id)
198 else:
199 self.fixed_history = False
200- self.pb.note('revision_history ok.')
201+ ui.ui_factory.note('revision_history ok.')
202
203
204 class RepoReconciler(object):
205@@ -238,11 +237,11 @@
206 # (no garbage inventories or we are not doing a thorough check)
207 if (not self.inconsistent_parents and
208 (not self.garbage_inventories or not self.thorough)):
209- self.pb.note('Inventory ok.')
210+ ui.ui_factory.note('Inventory ok.')
211 return
212 self.pb.update('Backing up inventory', 0, 0)
213 self.repo._backup_inventory()
214- self.pb.note('Backup inventory created.')
215+ ui.ui_factory.note('Backup inventory created.')
216 new_inventories = self.repo._temp_inventories()
217
218 # we have topological order of revisions and non ghost parents ready.
219@@ -262,7 +261,7 @@
220 self.pb.update('Writing weave')
221 self.repo._activate_new_inventory()
222 self.inventory = None
223- self.pb.note('Inventory regenerated.')
224+ ui.ui_factory.note('Inventory regenerated.')
225
226 def _new_inv_parents(self, revision_key):
227 """Lookup ghost-filtered parents for revision_key."""
228@@ -369,11 +368,11 @@
229 self._check_garbage_inventories()
230 self.pb.update('Checking unused inventories', 1, 3)
231 if not self.garbage_inventories:
232- self.pb.note('Inventory ok.')
233+ ui.ui_factory.note('Inventory ok.')
234 return
235 self.pb.update('Backing up inventory', 0, 0)
236 self.repo._backup_inventory()
237- self.pb.note('Backup Inventory created')
238+ ui.ui_factory.note('Backup Inventory created')
239 # asking for '' should never return a non-empty weave
240 new_inventories = self.repo._temp_inventories()
241 # we have topological order of revisions and non ghost parents ready.
242@@ -393,7 +392,7 @@
243 self.pb.update('Writing weave')
244 self.repo._activate_new_inventory()
245 self.inventory = None
246- self.pb.note('Inventory regenerated.')
247+ ui.ui_factory.note('Inventory regenerated.')
248
249 def _fix_text_parents(self):
250 """Fix bad versionedfile parent entries.
251
252=== modified file 'bzrlib/repository.py'
253--- bzrlib/repository.py 2009-06-22 21:55:37 +0000
254+++ bzrlib/repository.py 2009-06-23 09:17:21 +0000
255@@ -3811,7 +3811,7 @@
256 converted.unlock()
257 self.step('Deleting old repository content.')
258 self.repo_dir.transport.delete_tree('repository.backup')
259- self.pb.note('repository converted')
260+ ui.ui_factory.note('repository converted')
261
262 def step(self, message):
263 """Update the pb by a step."""
264
265=== modified file 'bzrlib/tests/__init__.py'
266--- bzrlib/tests/__init__.py 2009-06-10 18:58:02 +0000
267+++ bzrlib/tests/__init__.py 2009-06-23 09:17:21 +0000
268@@ -437,20 +437,20 @@
269 return self._shortened_test_description(test)
270
271 def report_error(self, test, err):
272- self.pb.note('ERROR: %s\n %s\n',
273+ ui.ui_factory.note('ERROR: %s\n %s\n' % (
274 self._test_description(test),
275 err[1],
276- )
277+ ))
278
279 def report_failure(self, test, err):
280- self.pb.note('FAIL: %s\n %s\n',
281+ ui.ui_factory.note('FAIL: %s\n %s\n' % (
282 self._test_description(test),
283 err[1],
284- )
285+ ))
286
287 def report_known_failure(self, test, err):
288- self.pb.note('XFAIL: %s\n%s\n',
289- self._test_description(test), err[1])
290+ ui.ui_factory.note('XFAIL: %s\n%s\n' % (
291+ self._test_description(test), err[1]))
292
293 def report_skip(self, test, reason):
294 pass
295@@ -709,6 +709,8 @@
296 Redirect stdin.
297 Allows get_password to be tested without real tty attached.
298 """
299+ # FIXME: Reduce divergence between this and the regular TextUIFactory or
300+ # CannedInputUIFactory
301
302 def __init__(self, stdout=None, stderr=None, stdin=None):
303 if stdin is not None:
304@@ -738,6 +740,7 @@
305 return self
306
307 def nested_progress_bar(self):
308+ # FIXME: Return a regular progress model instead
309 return self
310
311 def update(self, message, count=None, total=None):
312
313=== modified file 'bzrlib/tests/test_ui.py'
314--- bzrlib/tests/test_ui.py 2009-06-17 05:16:48 +0000
315+++ bzrlib/tests/test_ui.py 2009-06-23 09:17:21 +0000
316@@ -131,7 +131,9 @@
317 stdout=stdout)
318 pb = ui_factory.nested_progress_bar()
319 try:
320- result = pb.note('t')
321+ result = self.applyDeprecated(deprecated_in((1, 17, 0)),
322+ pb.note,
323+ 't')
324 self.assertEqual(None, result)
325 self.assertEqual("t\n", stdout.getvalue())
326 # Since there was no update() call, there should be no clear() call
327@@ -154,7 +156,8 @@
328 try:
329 # Create a progress update that isn't throttled
330 pb.update('x', 1, 1)
331- result = pb.note('t')
332+ result = self.applyDeprecated(deprecated_in((1, 17, 0)),
333+ pb.note, 't')
334 self.assertEqual(None, result)
335 self.assertEqual("t\n", stdout.getvalue())
336 # the exact contents will depend on the terminal width and we don't
337
338=== modified file 'bzrlib/upgrade.py'
339--- bzrlib/upgrade.py 2009-05-07 05:08:46 +0000
340+++ bzrlib/upgrade.py 2009-06-23 09:17:21 +0000
341@@ -46,8 +46,8 @@
342 branch = self.bzrdir.open_branch()
343 if branch.bzrdir.root_transport.base != \
344 self.bzrdir.root_transport.base:
345- self.pb.note("This is a checkout. The branch (%s) needs to be "
346- "upgraded separately.",
347+ ui.ui_factory.note("This is a checkout. The branch (%s) needs to be "
348+ "upgraded separately." %
349 branch.bzrdir.root_transport.base)
350 del branch
351 except (errors.NotBranchError, errors.IncompatibleRepositories):
352@@ -72,12 +72,13 @@
353 raise errors.BzrError("cannot upgrade from bzrdir format %s" %
354 self.bzrdir._format)
355 self.bzrdir.check_conversion_target(format)
356- self.pb.note('starting upgrade of %s', self.transport.base)
357+ ui.ui_factory.note('starting upgrade of %s' % self.transport.base)
358+
359 self.bzrdir.backup_bzrdir()
360 while self.bzrdir.needs_format_conversion(format):
361 converter = self.bzrdir._format.get_converter(format)
362 self.bzrdir = converter.convert(self.bzrdir, self.pb)
363- self.pb.note("finished")
364+ ui.ui_factory.note("finished")
365
366
367 def upgrade(url, format=None):