~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-16 22:00:19 UTC
  • mto: This revision was merged to the branch mainline in revision 1942.
  • Revision ID: john@arbash-meinel.com-20060816220019-541cb90093258ac3
Using real utf8 and cache_utf8 has similar performance, 272ms, and 363ms

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
create_signatures - this option controls whether bzr will always create 
50
50
                    gpg signatures, never create them, or create them if the
51
51
                    branch is configured to require them.
52
 
log_format - This options set the default log format.  Options are long, 
53
 
             short, line, or a plugin can register new formats
 
52
log_format - this option sets the default log format.  Possible values are
 
53
             long, short, line, or a plugin can register new formats.
54
54
 
55
55
In bazaar.conf you can also define aliases in the ALIASES sections, example
56
56
 
70
70
from StringIO import StringIO
71
71
 
72
72
import bzrlib
73
 
import bzrlib.errors as errors
 
73
from bzrlib import errors, urlutils
74
74
from bzrlib.osutils import pathjoin
75
75
from bzrlib.trace import mutter, warning
76
76
import bzrlib.util.configobj.configobj as configobj
167
167
    
168
168
        Something similar to 'Martin Pool <mbp@sourcefrog.net>'
169
169
        
170
 
        $BZREMAIL can be set to override this, then
 
170
        $BZR_EMAIL can be set to override this (as well as the
 
171
        deprecated $BZREMAIL), then
171
172
        the concrete policy type is checked, and finally
172
173
        $EMAIL is examined.
173
174
        If none is found, a reasonable default is (hopefully)
175
176
    
176
177
        TODO: Check it's reasonably well-formed.
177
178
        """
 
179
        v = os.environ.get('BZR_EMAIL')
 
180
        if v:
 
181
            return v.decode(bzrlib.user_encoding)
178
182
        v = os.environ.get('BZREMAIL')
179
183
        if v:
 
184
            warning('BZREMAIL is deprecated in favor of BZR_EMAIL. Please update your configuration.')
180
185
            return v.decode(bzrlib.user_encoding)
181
186
    
182
187
        v = self._get_user_id()
367
372
                        ' to ~/.bazaar/locations.conf')
368
373
            name_generator = branches_config_filename
369
374
        super(LocationConfig, self).__init__(name_generator)
 
375
        # local file locations are looked up by local path, rather than
 
376
        # by file url. This is because the config file is a user
 
377
        # file, and we would rather not expose the user to file urls.
 
378
        if location.startswith('file://'):
 
379
            location = urlutils.local_path_from_url(location)
370
380
        self.location = location
371
381
 
372
382
    def _get_section(self):
382
392
            del location_names[-1]
383
393
        matches=[]
384
394
        for section in sections:
385
 
            section_names = section.split('/')
 
395
            # location is a local path if possible, so we need
 
396
            # to convert 'file://' urls to local paths if necessary.
 
397
            # This also avoids having file:///path be a more exact
 
398
            # match than '/path'.
 
399
            if section.startswith('file://'):
 
400
                section_path = urlutils.local_path_from_url(section)
 
401
            else:
 
402
                section_path = section
 
403
            section_names = section_path.split('/')
386
404
            if section.endswith('/'):
387
405
                del section_names[-1]
388
406
            names = zip(location_names, section_names)
604
622
    return pathjoin(config_dir(), 'locations.conf')
605
623
 
606
624
 
 
625
def user_ignore_config_filename():
 
626
    """Return the user default ignore filename"""
 
627
    return pathjoin(config_dir(), 'ignore')
 
628
 
 
629
 
607
630
def _auto_user_id():
608
631
    """Calculate automatic user identification.
609
632