~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Aaron Bentley
  • Date: 2007-03-09 21:46:40 UTC
  • mto: (2323.6.9 0.15-integration)
  • mto: This revision was merged to the branch mainline in revision 2330.
  • Revision ID: abentley@panoramicfeedback.com-20070309214640-nnxk7g37bygoz50c
Add (set|get)_public_branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
455
455
        """
456
456
        raise NotImplementedError(self.get_parent)
457
457
 
 
458
    def _set_config_location(self, name, url, config=None,
 
459
                             make_relative=False):
 
460
        if config is None:
 
461
            config = self.get_config()
 
462
        if url is None:
 
463
            url = ''
 
464
        elif make_relative:
 
465
            url = urlutils.relative_url(self.base, url)
 
466
        config.set_user_option(name, url)
 
467
 
 
468
    def _get_config_location(self, name, config=None):
 
469
        if config is None:
 
470
            config = self.get_config()
 
471
        location = config.get_user_option(name)
 
472
        if location == '':
 
473
            location = None
 
474
        return location
 
475
 
458
476
    def get_submit_branch(self):
459
477
        """Return the submit location of the branch.
460
478
 
473
491
        """
474
492
        self.get_config().set_user_option('submit_branch', location)
475
493
 
 
494
    def get_public_branch(self):
 
495
        """Return the public location of the branch.
 
496
 
 
497
        This is is used by merge directives.
 
498
        """
 
499
        return self._get_config_location('public_branch')
 
500
 
 
501
    def set_public_branch(self, location):
 
502
        """Return the submit location of the branch.
 
503
 
 
504
        This is the default location for bundle.  The usual
 
505
        pattern is that the user can override it by specifying a
 
506
        location.
 
507
        """
 
508
        self._set_config_location('public_branch', location)
 
509
 
476
510
    def get_push_location(self):
477
511
        """Return the None or the location to push this branch to."""
478
512
        raise NotImplementedError(self.get_push_location)
1948
1982
        self.set_last_revision_info(prev_revno + len(revision_ids),
1949
1983
                                    revision_ids[-1])
1950
1984
 
1951
 
    def _set_config_location(self, name, url, config=None,
1952
 
                             make_relative=False):
1953
 
        if config is None:
1954
 
            config = self.get_config()
1955
 
        if url is None:
1956
 
            url = ''
1957
 
        elif make_relative:
1958
 
            url = urlutils.relative_url(self.base, url)
1959
 
        config.set_user_option(name, url)
1960
 
 
1961
 
 
1962
 
    def _get_config_location(self, name, config=None):
1963
 
        if config is None:
1964
 
            config = self.get_config()
1965
 
        location = config.get_user_option(name)
1966
 
        if location == '':
1967
 
            location = None
1968
 
        return location
1969
 
 
1970
1985
    @needs_write_lock
1971
1986
    def _set_parent_location(self, url):
1972
1987
        """Set the parent branch"""