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

  • Committer: Jelmer Vernooij
  • Date: 2020-07-18 23:14:00 UTC
  • mfrom: (7490.40.62 work)
  • mto: This revision was merged to the branch mainline in revision 7519.
  • Revision ID: jelmer@jelmer.uk-20200718231400-jaes9qltn8oi8xss
Merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1362
1362
    return unicode_or_utf8_string.encode('utf-8')
1363
1363
 
1364
1364
 
1365
 
def safe_revision_id(unicode_or_utf8_string):
1366
 
    """Revision ids should now be utf8, but at one point they were unicode.
1367
 
 
1368
 
    :param unicode_or_utf8_string: A possibly Unicode revision_id. (can also be
1369
 
        utf8 or None).
1370
 
    :return: None or a utf8 revision id.
1371
 
    """
1372
 
    if (unicode_or_utf8_string is None
1373
 
            or unicode_or_utf8_string.__class__ == bytes):
1374
 
        return unicode_or_utf8_string
1375
 
    raise TypeError('Unicode revision ids are no longer supported. '
1376
 
                    'Revision id generators should be creating utf8 revision '
1377
 
                    'ids.')
1378
 
 
1379
 
 
1380
 
def safe_file_id(unicode_or_utf8_string):
1381
 
    """File ids should now be utf8, but at one point they were unicode.
1382
 
 
1383
 
    This is the same as safe_utf8, except it uses the cached encode functions
1384
 
    to save a little bit of performance.
1385
 
 
1386
 
    :param unicode_or_utf8_string: A possibly Unicode file_id. (can also be
1387
 
        utf8 or None).
1388
 
    :return: None or a utf8 file id.
1389
 
    """
1390
 
    if (unicode_or_utf8_string is None
1391
 
            or unicode_or_utf8_string.__class__ == bytes):
1392
 
        return unicode_or_utf8_string
1393
 
    raise TypeError('Unicode file ids are no longer supported. '
1394
 
                    'File id generators should be creating utf8 file ids.')
1395
 
 
1396
 
 
1397
1365
_platform_normalizes_filenames = False
1398
1366
if sys.platform == 'darwin':
1399
1367
    _platform_normalizes_filenames = True