Merge lp:~mbp/bzr/456077-cross-format-fetch into lp:bzr/2.0
- 456077-cross-format-fetch
- Merge into 2.0
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/456077-cross-format-fetch |
Merge into: | lp:bzr/2.0 |
Diff against target: |
340 lines (+128/-27) 8 files modified
NEWS (+6/-0) bzrlib/repository.py (+12/-10) bzrlib/smart/repository.py (+0/-7) bzrlib/tests/blackbox/test_branch.py (+4/-0) bzrlib/tests/test_ui.py (+29/-1) bzrlib/ui/__init__.py (+56/-7) bzrlib/ui/text.py (+14/-1) bzrlib/upgrade.py (+7/-1) |
To merge this branch: | bzr merge lp:~mbp/bzr/456077-cross-format-fetch |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrew Bennetts | uifactory | Approve | |
bzr-core | Pending | ||
Review via email: mp+20041@code.launchpad.net |
Commit message
(mbp) give a clearer warning about cross-format conversions earlier in fetch
Description of the change
Martin Pool (mbp) wrote : | # |
Martin Pool (mbp) wrote : | # |
https:/
Andrew Bennetts (spiv) wrote : | # |
On IRC Martin asked me to look at the UIFactory changes, i.e. the new show_user_
I haven't yet really looked at the part of the patch that emits warnings about slow fetches, although removing code from bzrlib/smart is a promising sign :)
Martin Pool (mbp) wrote : | # |
On 25 February 2010 17:12, Andrew Bennetts
<email address hidden> wrote:
> Review: Approve uifactory
> On IRC Martin asked me to look at the UIFactory changes, i.e. the new show_user_
I was planning to build on addCleanup etc, but this isn't in 2.0 where
this is targeted.
It might be nice if there was a contextmanager-like object for "with a
warning suppressed".
--
Martin <http://
Martin Pool (mbp) wrote : | # |
As a followon, when this merges to trunk, it can take https:/
Vincent Ladeuil (vila) wrote : | # |
>>>>> Martin Pool <email address hidden> writes:
> As a followon, when this merges to trunk, it can take
> https:/
> 2.1 and later we have a config.
> let you turn them on/off per location; presumably that should be
> checked before going into the uifactory.
On a semi-related subject, we miss a config object that can
search either bazaar.conf or locations.conf.
So far, we can do either:
- global config,
- global + locations + branch.
Vincent
Andrew Bennetts (spiv) wrote : | # |
Vincent Ladeuil wrote:
> >>>>> Martin Pool <email address hidden> writes:
>
> > As a followon, when this merges to trunk, it can take
> > https:/
> > 2.1 and later we have a config.
> > let you turn them on/off per location; presumably that should be
> > checked before going into the uifactory.
>
> On a semi-related subject, we miss a config object that can
> search either bazaar.conf or locations.conf.
>
> So far, we can do either:
> - global config,
> - global + locations + branch.
That's true. I actually have code more-or-less like this in bzr-pqm of all
places, but have lacked the tuits to extract it into something appropriate for
bzrlib. See the StackedConfig class in pqm_submit.py:
<http://
-Andrew.
John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Vincent Ladeuil wrote:
>>>>>> Martin Pool <email address hidden> writes:
>
> > As a followon, when this merges to trunk, it can take
> > https:/
> > 2.1 and later we have a config.
> > let you turn them on/off per location; presumably that should be
> > checked before going into the uifactory.
>
> On a semi-related subject, we miss a config object that can
> search either bazaar.conf or locations.conf.
>
> So far, we can do either:
> - global config,
> - global + locations + branch.
>
> Vincent
Not true, LocationConfig is global + locations without Branch. We just
don't have it obviously exposed.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAku
VMkAoL82qA72xaH
=FcJC
-----END PGP SIGNATURE-----
Vincent Ladeuil (vila) wrote : | # |
@Martin, is this ready to land ?
Martin Pool (mbp) wrote : | # |
Martin Pool (mbp) wrote : | # |
Preview Diff
1 | === modified file 'NEWS' | |||
2 | --- NEWS 2010-03-03 09:21:47 +0000 | |||
3 | +++ NEWS 2010-03-17 04:31:23 +0000 | |||
4 | @@ -29,6 +29,12 @@ | |||
5 | 29 | a lock. | 29 | a lock. |
6 | 30 | (Martin Pool, #185103) | 30 | (Martin Pool, #185103) |
7 | 31 | 31 | ||
8 | 32 | * Give the warning about potentially slow cross-format fetches much | ||
9 | 33 | earlier on in the fetch operation. Don't show this message during | ||
10 | 34 | upgrades, and show the correct format indication for remote | ||
11 | 35 | repositories. | ||
12 | 36 | (Martin Pool, #456077, #515356, #513157) | ||
13 | 37 | |||
14 | 32 | * Handle renames correctly when there are files or directories that | 38 | * Handle renames correctly when there are files or directories that |
15 | 33 | differ only in case. (Chris Jones, Martin Pool, #368931) | 39 | differ only in case. (Chris Jones, Martin Pool, #368931) |
16 | 34 | 40 | ||
17 | 35 | 41 | ||
18 | === modified file 'bzrlib/repository.py' | |||
19 | --- bzrlib/repository.py 2010-01-14 07:34:37 +0000 | |||
20 | +++ bzrlib/repository.py 2010-03-17 04:31:23 +0000 | |||
21 | @@ -3067,8 +3067,8 @@ | |||
22 | 3067 | # Does the repository inventory storage understand references to trees? | 3067 | # Does the repository inventory storage understand references to trees? |
23 | 3068 | supports_tree_reference = None | 3068 | supports_tree_reference = None |
24 | 3069 | 3069 | ||
27 | 3070 | def __str__(self): | 3070 | def __repr__(self): |
28 | 3071 | return "<%s>" % self.__class__.__name__ | 3071 | return "%s()" % self.__class__.__name__ |
29 | 3072 | 3072 | ||
30 | 3073 | def __eq__(self, other): | 3073 | def __eq__(self, other): |
31 | 3074 | # format objects are generally stateless | 3074 | # format objects are generally stateless |
32 | @@ -3407,6 +3407,11 @@ | |||
33 | 3407 | :return: None. | 3407 | :return: None. |
34 | 3408 | """ | 3408 | """ |
35 | 3409 | from bzrlib.fetch import RepoFetcher | 3409 | from bzrlib.fetch import RepoFetcher |
36 | 3410 | # See <https://launchpad.net/bugs/456077> asking for a warning here | ||
37 | 3411 | if self.source._format.network_name() != self.target._format.network_name(): | ||
38 | 3412 | ui.ui_factory.show_user_warning('cross_format_fetch', | ||
39 | 3413 | from_format=self.source._format, | ||
40 | 3414 | to_format=self.target._format) | ||
41 | 3410 | f = RepoFetcher(to_repository=self.target, | 3415 | f = RepoFetcher(to_repository=self.target, |
42 | 3411 | from_repository=self.source, | 3416 | from_repository=self.source, |
43 | 3412 | last_revision=revision_id, | 3417 | last_revision=revision_id, |
44 | @@ -3980,18 +3985,17 @@ | |||
45 | 3980 | """See InterRepository.fetch().""" | 3985 | """See InterRepository.fetch().""" |
46 | 3981 | if fetch_spec is not None: | 3986 | if fetch_spec is not None: |
47 | 3982 | raise AssertionError("Not implemented yet...") | 3987 | raise AssertionError("Not implemented yet...") |
48 | 3983 | # See <https://launchpad.net/bugs/456077> asking for a warning here | ||
49 | 3984 | # | ||
50 | 3985 | # nb this is only active for local-local fetches; other things using | ||
51 | 3986 | # streaming. | ||
52 | 3987 | ui.ui_factory.warn_cross_format_fetch(self.source._format, | ||
53 | 3988 | self.target._format) | ||
54 | 3989 | if (not self.source.supports_rich_root() | 3988 | if (not self.source.supports_rich_root() |
55 | 3990 | and self.target.supports_rich_root()): | 3989 | and self.target.supports_rich_root()): |
56 | 3991 | self._converting_to_rich_root = True | 3990 | self._converting_to_rich_root = True |
57 | 3992 | self._revision_id_to_root_id = {} | 3991 | self._revision_id_to_root_id = {} |
58 | 3993 | else: | 3992 | else: |
59 | 3994 | self._converting_to_rich_root = False | 3993 | self._converting_to_rich_root = False |
60 | 3994 | # See <https://launchpad.net/bugs/456077> asking for a warning here | ||
61 | 3995 | if self.source._format.network_name() != self.target._format.network_name(): | ||
62 | 3996 | ui.ui_factory.show_user_warning('cross_format_fetch', | ||
63 | 3997 | from_format=self.source._format, | ||
64 | 3998 | to_format=self.target._format) | ||
65 | 3995 | revision_ids = self.target.search_missing_revision_ids(self.source, | 3999 | revision_ids = self.target.search_missing_revision_ids(self.source, |
66 | 3996 | revision_id, find_ghosts=find_ghosts).get_keys() | 4000 | revision_id, find_ghosts=find_ghosts).get_keys() |
67 | 3997 | if not revision_ids: | 4001 | if not revision_ids: |
68 | @@ -4284,8 +4288,6 @@ | |||
69 | 4284 | self._extract_and_insert_inventories( | 4288 | self._extract_and_insert_inventories( |
70 | 4285 | substream, src_serializer) | 4289 | substream, src_serializer) |
71 | 4286 | elif substream_type == 'inventory-deltas': | 4290 | elif substream_type == 'inventory-deltas': |
72 | 4287 | ui.ui_factory.warn_cross_format_fetch(src_format, | ||
73 | 4288 | self.target_repo._format) | ||
74 | 4289 | self._extract_and_insert_inventory_deltas( | 4291 | self._extract_and_insert_inventory_deltas( |
75 | 4290 | substream, src_serializer) | 4292 | substream, src_serializer) |
76 | 4291 | elif substream_type == 'chk_bytes': | 4293 | elif substream_type == 'chk_bytes': |
77 | 4292 | 4294 | ||
78 | === modified file 'bzrlib/smart/repository.py' | |||
79 | --- bzrlib/smart/repository.py 2010-01-14 07:34:37 +0000 | |||
80 | +++ bzrlib/smart/repository.py 2010-03-17 04:31:23 +0000 | |||
81 | @@ -503,13 +503,6 @@ | |||
82 | 503 | yield pack_writer.begin() | 503 | yield pack_writer.begin() |
83 | 504 | yield pack_writer.bytes_record(src_format.network_name(), '') | 504 | yield pack_writer.bytes_record(src_format.network_name(), '') |
84 | 505 | for substream_type, substream in stream: | 505 | for substream_type, substream in stream: |
85 | 506 | if substream_type == 'inventory-deltas': | ||
86 | 507 | # This doesn't feel like the ideal place to issue this warning; | ||
87 | 508 | # however we don't want to do it in the Repository that's | ||
88 | 509 | # generating the stream, because that might be on the server. | ||
89 | 510 | # Instead we try to observe it as the stream goes by. | ||
90 | 511 | ui.ui_factory.warn_cross_format_fetch(src_format, | ||
91 | 512 | '(remote)') | ||
92 | 513 | for record in substream: | 506 | for record in substream: |
93 | 514 | if record.storage_kind in ('chunked', 'fulltext'): | 507 | if record.storage_kind in ('chunked', 'fulltext'): |
94 | 515 | serialised = record_to_fulltext_bytes(record) | 508 | serialised = record_to_fulltext_bytes(record) |
95 | 516 | 509 | ||
96 | === modified file 'bzrlib/tests/blackbox/test_branch.py' | |||
97 | --- bzrlib/tests/blackbox/test_branch.py 2009-08-20 12:30:49 +0000 | |||
98 | +++ bzrlib/tests/blackbox/test_branch.py 2010-03-17 04:31:23 +0000 | |||
99 | @@ -326,6 +326,8 @@ | |||
100 | 326 | ' Packs 5 (adds stacking support, requires bzr 1.6)\n' | 326 | ' Packs 5 (adds stacking support, requires bzr 1.6)\n' |
101 | 327 | 'Source branch format does not support stacking, using format:\n' | 327 | 'Source branch format does not support stacking, using format:\n' |
102 | 328 | ' Branch format 7\n' | 328 | ' Branch format 7\n' |
103 | 329 | 'Doing on-the-fly conversion from RepositoryFormatKnitPack1() to RepositoryFormatKnitPack5().\n' | ||
104 | 330 | 'This may take some time. Upgrade the repositories to the same format for better performance.\n' | ||
105 | 329 | 'Created new stacked branch referring to %s.\n' % (trunk.base,), | 331 | 'Created new stacked branch referring to %s.\n' % (trunk.base,), |
106 | 330 | err) | 332 | err) |
107 | 331 | 333 | ||
108 | @@ -339,6 +341,8 @@ | |||
109 | 339 | ' Packs 5 rich-root (adds stacking support, requires bzr 1.6.1)\n' | 341 | ' Packs 5 rich-root (adds stacking support, requires bzr 1.6.1)\n' |
110 | 340 | 'Source branch format does not support stacking, using format:\n' | 342 | 'Source branch format does not support stacking, using format:\n' |
111 | 341 | ' Branch format 7\n' | 343 | ' Branch format 7\n' |
112 | 344 | 'Doing on-the-fly conversion from RepositoryFormatKnitPack4() to RepositoryFormatKnitPack5RichRoot().\n' | ||
113 | 345 | 'This may take some time. Upgrade the repositories to the same format for better performance.\n' | ||
114 | 342 | 'Created new stacked branch referring to %s.\n' % (trunk.base,), | 346 | 'Created new stacked branch referring to %s.\n' % (trunk.base,), |
115 | 343 | err) | 347 | err) |
116 | 344 | 348 | ||
117 | 345 | 349 | ||
118 | === modified file 'bzrlib/tests/test_ui.py' | |||
119 | --- bzrlib/tests/test_ui.py 2009-08-03 05:54:52 +0000 | |||
120 | +++ bzrlib/tests/test_ui.py 2010-03-17 04:31:23 +0000 | |||
121 | @@ -1,4 +1,4 @@ | |||
123 | 1 | # Copyright (C) 2005, 2008, 2009 Canonical Ltd | 1 | # Copyright (C) 2005, 2008, 2009, 2010 Canonical Ltd |
124 | 2 | # | 2 | # |
125 | 3 | # This program is free software; you can redistribute it and/or modify | 3 | # This program is free software; you can redistribute it and/or modify |
126 | 4 | # it under the terms of the GNU General Public License as published by | 4 | # it under the terms of the GNU General Public License as published by |
127 | @@ -25,6 +25,8 @@ | |||
128 | 25 | 25 | ||
129 | 26 | from bzrlib import ( | 26 | from bzrlib import ( |
130 | 27 | errors, | 27 | errors, |
131 | 28 | remote, | ||
132 | 29 | repository, | ||
133 | 28 | tests, | 30 | tests, |
134 | 29 | ui as _mod_ui, | 31 | ui as _mod_ui, |
135 | 30 | ) | 32 | ) |
136 | @@ -300,6 +302,32 @@ | |||
137 | 300 | finally: | 302 | finally: |
138 | 301 | pb.finished() | 303 | pb.finished() |
139 | 302 | 304 | ||
140 | 305 | def test_text_ui_show_user_warning(self): | ||
141 | 306 | from bzrlib.repofmt.groupcompress_repo import RepositoryFormat2a | ||
142 | 307 | from bzrlib.repofmt.pack_repo import RepositoryFormatKnitPack5 | ||
143 | 308 | err = StringIO() | ||
144 | 309 | out = StringIO() | ||
145 | 310 | ui = tests.TextUIFactory(stdin=None, stdout=out, stderr=err) | ||
146 | 311 | remote_fmt = remote.RemoteRepositoryFormat() | ||
147 | 312 | remote_fmt._network_name = RepositoryFormatKnitPack5().network_name() | ||
148 | 313 | ui.show_user_warning('cross_format_fetch', from_format=RepositoryFormat2a(), | ||
149 | 314 | to_format=remote_fmt) | ||
150 | 315 | self.assertEquals('', out.getvalue()) | ||
151 | 316 | self.assertEquals("Doing on-the-fly conversion from RepositoryFormat2a() to " | ||
152 | 317 | "RemoteRepositoryFormat(_network_name='Bazaar RepositoryFormatKnitPack5 " | ||
153 | 318 | "(bzr 1.6)\\n').\nThis may take some time. Upgrade the repositories to " | ||
154 | 319 | "the same format for better performance.\n", | ||
155 | 320 | err.getvalue()) | ||
156 | 321 | # and now with it suppressed please | ||
157 | 322 | err = StringIO() | ||
158 | 323 | out = StringIO() | ||
159 | 324 | ui = tests.TextUIFactory(stdin=None, stdout=out, stderr=err) | ||
160 | 325 | ui.suppressed_warnings.add('cross_format_fetch') | ||
161 | 326 | ui.show_user_warning('cross_format_fetch', from_format=RepositoryFormat2a(), | ||
162 | 327 | to_format=remote_fmt) | ||
163 | 328 | self.assertEquals('', out.getvalue()) | ||
164 | 329 | self.assertEquals('', err.getvalue()) | ||
165 | 330 | |||
166 | 303 | 331 | ||
167 | 304 | class CLIUITests(TestCase): | 332 | class CLIUITests(TestCase): |
168 | 305 | 333 | ||
169 | 306 | 334 | ||
170 | === modified file 'bzrlib/ui/__init__.py' | |||
171 | --- bzrlib/ui/__init__.py 2010-01-15 02:41:11 +0000 | |||
172 | +++ bzrlib/ui/__init__.py 2010-03-17 04:31:23 +0000 | |||
173 | @@ -105,10 +105,22 @@ | |||
174 | 105 | 105 | ||
175 | 106 | This tells the library how to display things to the user. Through this | 106 | This tells the library how to display things to the user. Through this |
176 | 107 | layer different applications can choose the style of UI. | 107 | layer different applications can choose the style of UI. |
177 | 108 | |||
178 | 109 | :ivar suppressed_warnings: Identifiers for user warnings that should | ||
179 | 110 | no be emitted. | ||
180 | 108 | """ | 111 | """ |
181 | 109 | 112 | ||
182 | 113 | _user_warning_templates = dict( | ||
183 | 114 | cross_format_fetch=("Doing on-the-fly conversion from " | ||
184 | 115 | "%(from_format)s to %(to_format)s.\n" | ||
185 | 116 | "This may take some time. Upgrade the repositories to the " | ||
186 | 117 | "same format for better performance." | ||
187 | 118 | ) | ||
188 | 119 | ) | ||
189 | 120 | |||
190 | 110 | def __init__(self): | 121 | def __init__(self): |
191 | 111 | self._task_stack = [] | 122 | self._task_stack = [] |
192 | 123 | self.suppressed_warnings = set() | ||
193 | 112 | 124 | ||
194 | 113 | def get_password(self, prompt='', **kwargs): | 125 | def get_password(self, prompt='', **kwargs): |
195 | 114 | """Prompt the user for a password. | 126 | """Prompt the user for a password. |
196 | @@ -170,6 +182,21 @@ | |||
197 | 170 | """ | 182 | """ |
198 | 171 | pass | 183 | pass |
199 | 172 | 184 | ||
200 | 185 | def format_user_warning(self, warning_id, message_args): | ||
201 | 186 | try: | ||
202 | 187 | template = self._user_warning_templates[warning_id] | ||
203 | 188 | except KeyError: | ||
204 | 189 | fail = "failed to format warning %r, %r" % (warning_id, message_args) | ||
205 | 190 | warnings.warn(fail) # so tests will fail etc | ||
206 | 191 | return fail | ||
207 | 192 | try: | ||
208 | 193 | return template % message_args | ||
209 | 194 | except ValueError, e: | ||
210 | 195 | fail = "failed to format warning %r, %r: %s" % ( | ||
211 | 196 | warning_id, message_args, e) | ||
212 | 197 | warnings.warn(fail) # so tests will fail etc | ||
213 | 198 | return fail | ||
214 | 199 | |||
215 | 173 | def get_boolean(self, prompt): | 200 | def get_boolean(self, prompt): |
216 | 174 | """Get a boolean question answered from the user. | 201 | """Get a boolean question answered from the user. |
217 | 175 | 202 | ||
218 | @@ -190,8 +217,11 @@ | |||
219 | 190 | def recommend_upgrade(self, | 217 | def recommend_upgrade(self, |
220 | 191 | current_format_name, | 218 | current_format_name, |
221 | 192 | basedir): | 219 | basedir): |
223 | 193 | # this should perhaps be in the TextUIFactory and the default can do | 220 | # XXX: this should perhaps be in the TextUIFactory and the default can do |
224 | 194 | # nothing | 221 | # nothing |
225 | 222 | # | ||
226 | 223 | # XXX: Change to show_user_warning - that will accomplish the previous | ||
227 | 224 | # xxx. -- mbp 2010-02-25 | ||
228 | 195 | trace.warning("%s is deprecated " | 225 | trace.warning("%s is deprecated " |
229 | 196 | "and a better format is available.\n" | 226 | "and a better format is available.\n" |
230 | 197 | "It is recommended that you upgrade by " | 227 | "It is recommended that you upgrade by " |
231 | @@ -208,13 +238,32 @@ | |||
232 | 208 | """ | 238 | """ |
233 | 209 | pass | 239 | pass |
234 | 210 | 240 | ||
235 | 241 | def show_user_warning(self, warning_id, **message_args): | ||
236 | 242 | """Show a warning to the user. | ||
237 | 243 | |||
238 | 244 | This is specifically for things that are under the user's control (eg | ||
239 | 245 | outdated formats), not for internal program warnings like deprecated | ||
240 | 246 | APIs. | ||
241 | 247 | |||
242 | 248 | This can be overridden by UIFactory subclasses to show it in some | ||
243 | 249 | appropriate way; the default UIFactory is noninteractive and does | ||
244 | 250 | nothing. format_user_warning maps it to a string, though other | ||
245 | 251 | presentations can be used for particular UIs. | ||
246 | 252 | |||
247 | 253 | :param warning_id: An identifier like 'cross_format_fetch' used to | ||
248 | 254 | check if the message is suppressed and to look up the string. | ||
249 | 255 | :param message_args: Arguments to be interpolated into the message. | ||
250 | 256 | """ | ||
251 | 257 | pass | ||
252 | 258 | |||
253 | 211 | def warn_cross_format_fetch(self, from_format, to_format): | 259 | def warn_cross_format_fetch(self, from_format, to_format): |
260 | 212 | """Warn about a potentially slow cross-format transfer""" | 260 | """Warn about a potentially slow cross-format transfer. |
261 | 213 | # See <https://launchpad.net/bugs/456077> asking for a warning here | 261 | |
262 | 214 | trace.warning("Doing on-the-fly conversion from %s to %s.\n" | 262 | This is deprecated in favor of show_user_warning, but retained for api |
263 | 215 | "This may take some time. Upgrade the repositories to the " | 263 | compatibility in 2.0 and 2.1. |
264 | 216 | "same format for better performance.\n" % | 264 | """ |
265 | 217 | (from_format, to_format)) | 265 | self.show_user_warning('cross_format_fetch', from_format=from_format, |
266 | 266 | to_format=to_format) | ||
267 | 218 | 267 | ||
268 | 219 | 268 | ||
269 | 220 | class CLIUIFactory(UIFactory): | 269 | class CLIUIFactory(UIFactory): |
270 | 221 | 270 | ||
271 | === modified file 'bzrlib/ui/text.py' | |||
272 | --- bzrlib/ui/text.py 2009-08-06 02:23:37 +0000 | |||
273 | +++ bzrlib/ui/text.py 2010-03-17 04:31:23 +0000 | |||
274 | @@ -1,4 +1,4 @@ | |||
276 | 1 | # Copyright (C) 2005, 2008, 2009 Canonical Ltd | 1 | # Copyright (C) 2005, 2008, 2009, 2010 Canonical Ltd |
277 | 2 | # | 2 | # |
278 | 3 | # This program is free software; you can redistribute it and/or modify | 3 | # This program is free software; you can redistribute it and/or modify |
279 | 4 | # it under the terms of the GNU General Public License as published by | 4 | # it under the terms of the GNU General Public License as published by |
280 | @@ -31,6 +31,7 @@ | |||
281 | 31 | progress, | 31 | progress, |
282 | 32 | osutils, | 32 | osutils, |
283 | 33 | symbol_versioning, | 33 | symbol_versioning, |
284 | 34 | trace, | ||
285 | 34 | ) | 35 | ) |
286 | 35 | 36 | ||
287 | 36 | """) | 37 | """) |
288 | @@ -190,6 +191,18 @@ | |||
289 | 190 | def _progress_all_finished(self): | 191 | def _progress_all_finished(self): |
290 | 191 | self._progress_view.clear() | 192 | self._progress_view.clear() |
291 | 192 | 193 | ||
292 | 194 | def show_user_warning(self, warning_id, **message_args): | ||
293 | 195 | """Show a text message to the user. | ||
294 | 196 | |||
295 | 197 | Explicitly not for warnings about bzr apis, deprecations or internals. | ||
296 | 198 | """ | ||
297 | 199 | # eventually trace.warning should migrate here, to avoid logging and | ||
298 | 200 | # be easier to test; that has a lot of test fallout so for now just | ||
299 | 201 | # new code can call this | ||
300 | 202 | if warning_id not in self.suppressed_warnings: | ||
301 | 203 | self.stderr.write(self.format_user_warning(warning_id, message_args) + | ||
302 | 204 | '\n') | ||
303 | 205 | |||
304 | 193 | 206 | ||
305 | 194 | class TextProgressView(object): | 207 | class TextProgressView(object): |
306 | 195 | """Display of progress bar and other information on a tty. | 208 | """Display of progress bar and other information on a tty. |
307 | 196 | 209 | ||
308 | === modified file 'bzrlib/upgrade.py' | |||
309 | --- bzrlib/upgrade.py 2009-05-07 05:08:46 +0000 | |||
310 | +++ bzrlib/upgrade.py 2010-03-17 04:31:23 +0000 | |||
311 | @@ -1,4 +1,4 @@ | |||
313 | 1 | # Copyright (C) 2005, 2008, 2009 Canonical Ltd | 1 | # Copyright (C) 2005, 2008, 2009, 2010 Canonical Ltd |
314 | 2 | # | 2 | # |
315 | 3 | # This program is free software; you can redistribute it and/or modify | 3 | # This program is free software; you can redistribute it and/or modify |
316 | 4 | # it under the terms of the GNU General Public License as published by | 4 | # it under the terms of the GNU General Public License as published by |
317 | @@ -29,6 +29,9 @@ | |||
318 | 29 | def __init__(self, url, format=None): | 29 | def __init__(self, url, format=None): |
319 | 30 | self.format = format | 30 | self.format = format |
320 | 31 | self.bzrdir = BzrDir.open_unsupported(url) | 31 | self.bzrdir = BzrDir.open_unsupported(url) |
321 | 32 | # XXX: Change to cleanup | ||
322 | 33 | warning_id = 'cross_format_fetch' | ||
323 | 34 | saved_warning = warning_id in ui.ui_factory.suppressed_warnings | ||
324 | 32 | if isinstance(self.bzrdir, RemoteBzrDir): | 35 | if isinstance(self.bzrdir, RemoteBzrDir): |
325 | 33 | self.bzrdir._ensure_real() | 36 | self.bzrdir._ensure_real() |
326 | 34 | self.bzrdir = self.bzrdir._real_bzrdir | 37 | self.bzrdir = self.bzrdir._real_bzrdir |
327 | @@ -36,10 +39,13 @@ | |||
328 | 36 | raise errors.UpgradeReadonly | 39 | raise errors.UpgradeReadonly |
329 | 37 | self.transport = self.bzrdir.root_transport | 40 | self.transport = self.bzrdir.root_transport |
330 | 38 | self.pb = ui.ui_factory.nested_progress_bar() | 41 | self.pb = ui.ui_factory.nested_progress_bar() |
331 | 42 | ui.ui_factory.suppressed_warnings.add(warning_id) | ||
332 | 39 | try: | 43 | try: |
333 | 40 | self.convert() | 44 | self.convert() |
334 | 41 | finally: | 45 | finally: |
335 | 42 | self.pb.finished() | 46 | self.pb.finished() |
336 | 47 | if not saved_warning: | ||
337 | 48 | ui.ui_factory.suppressed_warnings.remove(warning_id) | ||
338 | 43 | 49 | ||
339 | 44 | def convert(self): | 50 | def convert(self): |
340 | 45 | try: | 51 | try: |
This fixes https:/ /bugs.edge. launchpad. net/bzr/ +bug/456077 properly by giving a message about cross-format conversions earlier in fetch, and https:/ /bugs.edge. launchpad. net/bzr/ +bug/515356 by showing the remote repository network name.