~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Vincent Ladeuil
  • Date: 2011-01-12 00:58:05 UTC
  • mfrom: (5582.7.1 675652-bzr-columns-0)
  • mto: This revision was merged to the branch mainline in revision 5598.
  • Revision ID: v.ladeuil+lp@free.fr-20110112005805-tzclc2wogqef8zty
Accept 0 to mean no limit for BZR_COLUMNS

Show diffs side-by-side

added added

removed removed

Lines of Context:
1461
1461
    # a similar effect.
1462
1462
 
1463
1463
    # If BZR_COLUMNS is set, take it, user is always right
 
1464
    # Except if they specified 0 in which case, impose no limit here
1464
1465
    try:
1465
 
        return int(os.environ['BZR_COLUMNS'])
 
1466
        width = int(os.environ['BZR_COLUMNS'])
1466
1467
    except (KeyError, ValueError):
1467
 
        pass
 
1468
        width = None
 
1469
    if width is not None:
 
1470
        if width > 0:
 
1471
            return width
 
1472
        else:
 
1473
            return None
1468
1474
 
1469
1475
    isatty = getattr(sys.stdout, 'isatty', None)
1470
1476
    if isatty is None or not isatty():