/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/cache_utf8.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:
21
21
 
22
22
import codecs
23
23
 
24
 
 
25
24
_utf8_encode = codecs.utf_8_encode
26
25
_utf8_decode = codecs.utf_8_decode
 
26
 
 
27
 
27
28
def _utf8_decode_with_None(bytestring, _utf8_decode=_utf8_decode):
28
29
    """wrap _utf8_decode to support None->None for optional strings.
29
30
 
35
36
    else:
36
37
        return _utf8_decode(bytestring)[0]
37
38
 
 
39
 
38
40
# Map revisions from and to utf8 encoding
39
41
# Whenever we do an encode/decode operation, we save the result, so that
40
42
# we don't have to do it again.
107
109
    # real Unicode string. Unicode and plain strings of this type will have the
108
110
    # same hash, so we can just use it as the key in _uni_to_utf8, but we need
109
111
    # the return value to be different in _utf8_to_uni
110
 
    ascii_str = _uni_to_utf8.setdefault(ascii_str, ascii_str)
111
 
    _utf8_to_uni.setdefault(ascii_str, unicode(ascii_str))
 
112
    uni_str = ascii_str.decode('ascii')
 
113
    ascii_str = _uni_to_utf8.setdefault(uni_str, ascii_str)
 
114
    _utf8_to_uni.setdefault(ascii_str, uni_str)
112
115
    return ascii_str
113
116
 
114
117