~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Patch Queue Manager
  • Date: 2012-06-20 15:48:57 UTC
  • mfrom: (6524.2.6 config-branchname)
  • Revision ID: pqm@pqm.ubuntu.com-20120620154857-e8a2fxwsgdxm87y1
(abentley) Add branchname config variable (Aaron Bentley)

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
        if branch_name is None:
 
3451
            branch_name = ''
3450
3452
        self.locals = {'relpath': extra_path,
3451
 
                       'basename': urlutils.basename(extra_path)}
 
3453
                       'basename': urlutils.basename(extra_path),
 
3454
                       'branchname': branch_name}
3452
3455
 
3453
3456
    def get(self, name, default=None, expand=True):
3454
3457
        value = super(LocationSection, self).get(name, default)
3524
3527
 
3525
3528
    def __init__(self, store, location):
3526
3529
        super(LocationMatcher, self).__init__(store)
 
3530
        url, params = urlutils.split_segment_parameters(location)
3527
3531
        if location.startswith('file://'):
3528
3532
            location = urlutils.local_path_from_url(location)
3529
3533
        self.location = location
 
3534
        branch_name = params.get('branch')
 
3535
        if branch_name is None:
 
3536
            self.branch_name = urlutils.basename(self.location)
 
3537
        else:
 
3538
            self.branch_name = urlutils.unescape(branch_name)
3530
3539
 
3531
3540
    def _get_matching_sections(self):
3532
3541
        """Get all sections matching ``location``."""
3558
3567
            while True:
3559
3568
                section = iter_all_sections.next()
3560
3569
                if section_id == section.id:
3561
 
                    matching_sections.append(
3562
 
                        (length, LocationSection(section, extra_path)))
 
3570
                    section = LocationSection(section, extra_path,
 
3571
                                              self.branch_name)
 
3572
                    matching_sections.append((length, section))
3563
3573
                    break
3564
3574
        return matching_sections
3565
3575