~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Aaron Bentley
  • Date: 2012-06-15 21:12:23 UTC
  • mto: This revision was merged to the branch mainline in revision 6526.
  • Revision ID: aaron@aaronbentley.com-20120615211223-jwz54mjqvv9kqggk
Implement branchname support in config files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3444
3444
 
3445
3445
class LocationSection(Section):
3446
3446
 
3447
 
    def __init__(self, section, extra_path):
 
3447
    def __init__(self, section, extra_path, branch_name=None):
3448
3448
        super(LocationSection, self).__init__(section.id, section.options)
3449
3449
        self.extra_path = extra_path
3450
3450
        self.locals = {'relpath': extra_path,
3451
 
                       'basename': urlutils.basename(extra_path)}
 
3451
                       'basename': urlutils.basename(extra_path),
 
3452
                       'branchname': branch_name}
3452
3453
 
3453
3454
    def get(self, name, default=None, expand=True):
3454
3455
        value = super(LocationSection, self).get(name, default)
3524
3525
 
3525
3526
    def __init__(self, store, location):
3526
3527
        super(LocationMatcher, self).__init__(store)
 
3528
        url, params = urlutils.split_segment_parameters(location)
 
3529
        self.branch_name = params.get('branch')
 
3530
        self.orig_location = location
3527
3531
        if location.startswith('file://'):
3528
3532
            location = urlutils.local_path_from_url(location)
3529
3533
        self.location = location
3558
3562
            while True:
3559
3563
                section = iter_all_sections.next()
3560
3564
                if section_id == section.id:
3561
 
                    matching_sections.append(
3562
 
                        (length, LocationSection(section, extra_path)))
 
3565
                    section = LocationSection(section, extra_path,
 
3566
                                              self.branch_name)
 
3567
                    matching_sections.append((length, section))
3563
3568
                    break
3564
3569
        return matching_sections
3565
3570