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

  • Committer: Breezy landing bot
  • Author(s): Martin
  • Date: 2017-06-11 01:56:34 UTC
  • mfrom: (6684.1.5 py3_bootstrap2)
  • Revision ID: breezy.the.bot@gmail.com-20170611015634-9eeh86thh073hcko
More progress towards Python 3 support

Merged from https://code.launchpad.net/~gz/brz/py3_bootstrap2/+merge/325452

Show diffs side-by-side

added added

removed removed

Lines of Context:
477
477
        If no username can be found, errors.NoWhoami exception is raised.
478
478
        """
479
479
        v = os.environ.get('BRZ_EMAIL')
480
 
        if v and not PY3:
481
 
            return v.decode(osutils.get_user_encoding())
 
480
        if v:
 
481
            if not PY3:
 
482
                v = v.decode(osutils.get_user_encoding())
 
483
            return v
482
484
        v = self._get_user_id()
483
 
        if v and not PY3:
 
485
        if v:
484
486
            return v
485
487
        return default_email()
486
488
 
1497
1499
 
1498
1500
def default_email():
1499
1501
    v = os.environ.get('BRZ_EMAIL')
1500
 
    if v and not PY3:
1501
 
        return v.decode(osutils.get_user_encoding())
 
1502
    if v:
 
1503
        if not PY3:
 
1504
            v = v.decode(osutils.get_user_encoding())
 
1505
        return v
1502
1506
    v = os.environ.get('EMAIL')
1503
 
    if v and not PY3:
1504
 
        return v.decode(osutils.get_user_encoding())
 
1507
    if v:
 
1508
        if not PY3:
 
1509
            v = v.decode(osutils.get_user_encoding())
 
1510
        return v
1505
1511
    name, email = _auto_user_id()
1506
1512
    if name and email:
1507
1513
        return u'%s <%s>' % (name, email)