/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-06-01 21:57:00 UTC
  • mfrom: (7490.39.3 move-launchpad)
  • Revision ID: breezy.the.bot@gmail.com-20200601215700-joxuzo6w172gq74v
Move launchpad hoster support to the launchpad plugin.

Merged from https://code.launchpad.net/~jelmer/brz/move-launchpad/+merge/384931

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
 
1365
1397
_platform_normalizes_filenames = False
1366
1398
if sys.platform == 'darwin':
1367
1399
    _platform_normalizes_filenames = True