~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

Merge Tree.changes_from work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
367
367
                        ' to ~/.bazaar/locations.conf')
368
368
            name_generator = branches_config_filename
369
369
        super(LocationConfig, self).__init__(name_generator)
 
370
        # local file locations are looked up by local path, rather than
 
371
        # by file url. This is because the config file is a user
 
372
        # file, and we would rather not expose the user to file urls.
 
373
        if location.startswith('file://'):
 
374
            location = urlutils.local_path_from_url(location)
370
375
        self.location = location
371
376
 
372
377
    def _get_section(self):
382
387
            del location_names[-1]
383
388
        matches=[]
384
389
        for section in sections:
385
 
            section_names = section.split('/')
 
390
            # location is a local path if possible, so we need
 
391
            # to convert 'file://' urls to local paths if necessary.
 
392
            # This also avoids having file:///path be a more exact
 
393
            # match than '/path'.
 
394
            if section.startswith('file://'):
 
395
                section_path = urlutils.local_path_from_url(section)
 
396
            else:
 
397
                section_path = section
 
398
            section_names = section_path.split('/')
386
399
            if section.endswith('/'):
387
400
                del section_names[-1]
388
401
            names = zip(location_names, section_names)
604
617
    return pathjoin(config_dir(), 'locations.conf')
605
618
 
606
619
 
 
620
def user_ignore_config_filename():
 
621
    """Return the user default ignore filename"""
 
622
    return pathjoin(config_dir(), 'ignore')
 
623
 
 
624
 
607
625
def _auto_user_id():
608
626
    """Calculate automatic user identification.
609
627