/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/ui/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-16 19:47:19 UTC
  • mfrom: (7178 work)
  • mto: This revision was merged to the branch mainline in revision 7179.
  • Revision ID: jelmer@jelmer.uk-20181116194719-m5ut2wfuze5x9s1p
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
 
149
149
    _user_warning_templates = dict(
150
150
        cross_format_fetch=("Doing on-the-fly conversion from "
151
 
            "%(from_format)s to %(to_format)s.\n"
152
 
            "This may take some time. Upgrade the repositories to the "
153
 
            "same format for better performance."
154
 
            ),
 
151
                            "%(from_format)s to %(to_format)s.\n"
 
152
                            "This may take some time. Upgrade the repositories to the "
 
153
                            "same format for better performance."
 
154
                            ),
155
155
        experimental_format_fetch=("Fetching into experimental format "
156
 
            "%(to_format)s.\n"
157
 
            "This format may be unreliable or change in the future "
158
 
            "without an upgrade path.\n"),
 
156
                                   "%(to_format)s.\n"
 
157
                                   "This format may be unreliable or change in the future "
 
158
                                   "without an upgrade path.\n"),
159
159
        deprecated_command=(
160
160
            "The command 'brz %(deprecated_name)s' "
161
161
            "has been deprecated in brz %(deprecated_in_version)s. "
165
165
            "has been deprecated in brz %(deprecated_in_version)s. "
166
166
            "Please use '%(recommended_name)s' instead."),
167
167
        recommend_upgrade=("%(current_format_name)s is deprecated "
168
 
            "and a better format is available.\n"
169
 
            "It is recommended that you upgrade by "
170
 
            "running the command\n"
171
 
            "  brz upgrade %(basedir)s"),
 
168
                           "and a better format is available.\n"
 
169
                           "It is recommended that you upgrade by "
 
170
                           "running the command\n"
 
171
                           "  brz upgrade %(basedir)s"),
172
172
        locks_steal_dead=(
173
173
            u"Stole dead lock %(lock_url)s %(other_holder_info)s."),
174
174
        not_checking_ssl_cert=(
186
186
        Override in a concrete factory class if initialisation before use is
187
187
        needed.
188
188
        """
189
 
        return self # This is bound to the 'as' clause in a with statement.
 
189
        return self  # This is bound to the 'as' clause in a with statement.
190
190
 
191
191
    def __exit__(self, exc_type, exc_val, exc_tb):
192
192
        """Context manager exit support.
195
195
        self.clear_term() is needed when the UIFactory is finished with.
196
196
        """
197
197
        self.clear_term()
198
 
        return False # propogate exceptions.
 
198
        return False  # propogate exceptions.
199
199
 
200
200
    def be_quiet(self, state):
201
201
        """Tell the UI to be more quiet, or not.
265
265
 
266
266
    def _make_output_stream_explicit(self, encoding, encoding_type):
267
267
        raise NotImplementedError("%s doesn't support make_output_stream"
268
 
            % (self.__class__.__name__))
 
268
                                  % (self.__class__.__name__))
269
269
 
270
270
    def nested_progress_bar(self):
271
271
        """Return a nested progress bar.
284
284
        """Called by the ProgressTask when it finishes"""
285
285
        if not self._task_stack:
286
286
            warnings.warn("%r finished but nothing is active"
287
 
                % (task,))
 
287
                          % (task,))
288
288
        if task in self._task_stack:
289
289
            self._task_stack.remove(task)
290
290
        else:
291
291
            warnings.warn("%r is not in active stack %r"
292
 
                % (task, self._task_stack))
 
292
                          % (task, self._task_stack))
293
293
        if not self._task_stack:
294
294
            self._progress_all_finished()
295
295
 
317
317
            template = self._user_warning_templates[warning_id]
318
318
        except KeyError:
319
319
            fail = "brz warning: %r, %r" % (warning_id, message_args)
320
 
            warnings.warn("no template for warning: " + fail)   # so tests will fail etc
 
320
            warnings.warn("no template for warning: "
 
321
                          + fail)   # so tests will fail etc
321
322
            return text_type(fail)
322
323
        try:
323
324
            return text_type(template) % message_args
382
383
        :param basedir: Location of the control dir
383
384
        """
384
385
        self.show_user_warning('recommend_upgrade',
385
 
            current_format_name=current_format_name, basedir=basedir)
 
386
                               current_format_name=current_format_name, basedir=basedir)
386
387
 
387
388
    def report_transport_activity(self, transport, byte_count, direction):
388
389
        """Called by transports as they do IO.
509
510
    def assert_all_input_consumed(self):
510
511
        if self.responses:
511
512
            raise AssertionError("expected all input in %r to be consumed"
512
 
                % (self,))
 
513
                                 % (self,))
513
514
 
514
515
 
515
516
ui_factory = SilentUIFactory()