/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/text.py

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Text UI, write output to the console."""
18
18
 
19
 
from __future__ import absolute_import
20
 
 
21
19
import codecs
 
20
import io
22
21
import os
23
22
import sys
24
23
import warnings
39
38
    osutils,
40
39
    trace,
41
40
    )
42
 
from ..sixish import (
43
 
    text_type,
44
 
    )
45
41
from . import (
46
42
    NullProgressView,
47
43
    UIFactory,
324
320
        :param kwargs: Dictionary of arguments to insert into the prompt,
325
321
            to allow UIs to reformat the prompt.
326
322
        """
327
 
        if not isinstance(prompt, text_type):
 
323
        if not isinstance(prompt, str):
328
324
            raise ValueError("prompt %r not a unicode string" % prompt)
329
325
        if kwargs:
330
326
            # See <https://launchpad.net/bugs/365891>
668
664
def _wrap_in_stream(stream, encoding=None, errors='replace'):
669
665
    if encoding is None:
670
666
        encoding = _get_stream_encoding(stream)
671
 
    encoded_stream = codecs.getreader(encoding)(stream, errors=errors)
672
 
    encoded_stream.encoding = encoding
673
 
    return encoded_stream
 
667
    # Attempt to wrap using io.open if possible, since that can do
 
668
    # line-buffering.
 
669
    try:
 
670
        fileno = stream.fileno()
 
671
    except io.UnsupportedOperation:
 
672
        encoded_stream = codecs.getreader(encoding)(stream, errors=errors)
 
673
        encoded_stream.encoding = encoding
 
674
        return encoded_stream
 
675
    else:
 
676
        return io.open(fileno, encoding=encoding, errors=errors, mode='r', buffering=1)
674
677
 
675
678
 
676
679
def _wrap_out_stream(stream, encoding=None, errors='replace'):