/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Aaron Bentley
  • Date: 2007-07-17 13:27:14 UTC
  • mfrom: (2624 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2631.
  • Revision ID: abentley@panoramicfeedback.com-20070717132714-tmzx9khmg9501k51
Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
172
172
        return self.get_config().get_nickname()
173
173
 
174
174
    def _set_nick(self, nick):
175
 
        self.get_config().set_user_option('nickname', nick)
 
175
        self.get_config().set_user_option('nickname', nick, warn_masked=True)
176
176
 
177
177
    nick = property(_get_nick, _set_nick)
178
178
 
505
505
 
506
506
    def revision_id_to_revno(self, revision_id):
507
507
        """Given a revision id, return its revno"""
508
 
        if revision_id is None:
 
508
        if _mod_revision.is_null(revision_id):
509
509
            return 0
510
510
        revision_id = osutils.safe_revision_id(revision_id)
511
511
        history = self.revision_history()
584
584
            url = ''
585
585
        elif make_relative:
586
586
            url = urlutils.relative_url(self.base, url)
587
 
        config.set_user_option(name, url)
 
587
        config.set_user_option(name, url, warn_masked=True)
588
588
 
589
589
    def _get_config_location(self, name, config=None):
590
590
        if config is None:
610
610
        pattern is that the user can override it by specifying a
611
611
        location.
612
612
        """
613
 
        self.get_config().set_user_option('submit_branch', location)
 
613
        self.get_config().set_user_option('submit_branch', location,
 
614
            warn_masked=True)
614
615
 
615
616
    def get_public_branch(self):
616
617
        """Return the public location of the branch.
700
701
        :param revision_id: The revision-id to truncate history at.  May
701
702
          be None to copy complete history.
702
703
        """
 
704
        if revision_id == _mod_revision.NULL_REVISION:
 
705
            new_history = []
703
706
        new_history = self.revision_history()
704
 
        if revision_id is not None:
 
707
        if revision_id is not None and new_history != []:
705
708
            revision_id = osutils.safe_revision_id(revision_id)
706
709
            try:
707
710
                new_history = new_history[:new_history.index(revision_id) + 1]
1403
1406
                          other_branch=None):
1404
1407
        # stop_revision must be a descendant of last_revision
1405
1408
        stop_graph = self.repository.get_revision_graph(revision_id)
1406
 
        if last_rev is not None and last_rev not in stop_graph:
 
1409
        if (last_rev is not None and last_rev != _mod_revision.NULL_REVISION
 
1410
            and last_rev not in stop_graph):
1407
1411
            # our previous tip is not merged into stop_revision
1408
1412
            raise errors.DivergedBranches(self, other_branch)
1409
1413
        # make a new revision history from the graph
1448
1452
                stop_revision = osutils.safe_revision_id(stop_revision)
1449
1453
            # whats the current last revision, before we fetch [and change it
1450
1454
            # possibly]
1451
 
            last_rev = self.last_revision()
 
1455
            last_rev = _mod_revision.ensure_null(self.last_revision())
1452
1456
            # we fetch here regardless of whether we need to so that we pickup
1453
1457
            # filled in ghosts.
1454
1458
            self.fetch(other, stop_revision)
1778
1782
        # last_rev is not in the other_last_rev history, AND
1779
1783
        # other_last_rev is not in our history, and do it without pulling
1780
1784
        # history around
1781
 
        last_rev = self.last_revision()
1782
 
        if last_rev is not None:
 
1785
        last_rev = _mod_revision.ensure_null(self.last_revision())
 
1786
        if last_rev != _mod_revision.NULL_REVISION:
1783
1787
            other.lock_read()
1784
1788
            try:
1785
1789
                other_last_rev = other.last_revision()
1786
 
                if other_last_rev is not None:
 
1790
                if not _mod_revision.is_null(other_last_rev):
1787
1791
                    # neither branch is new, we have to do some work to
1788
1792
                    # ascertain diversion.
1789
1793
                    remote_graph = other.repository.get_revision_graph(
1812
1816
        if master is not None:
1813
1817
            old_tip = self.last_revision()
1814
1818
            self.pull(master, overwrite=True)
1815
 
            if old_tip in self.repository.get_ancestry(self.last_revision(),
1816
 
                                                       topo_sorted=False):
 
1819
            if old_tip in self.repository.get_ancestry(
 
1820
                _mod_revision.ensure_null(self.last_revision()),
 
1821
                topo_sorted=False):
1817
1822
                return None
1818
1823
            return old_tip
1819
1824
        return None
1960
1965
        self._clear_cached_state()
1961
1966
 
1962
1967
    def _check_history_violation(self, revision_id):
1963
 
        last_revision = self.last_revision()
1964
 
        if last_revision is None:
 
1968
        last_revision = _mod_revision.ensure_null(self.last_revision())
 
1969
        if _mod_revision.is_null(last_revision):
1965
1970
            return
1966
1971
        if last_revision not in self._lefthand_history(revision_id):
1967
1972
            raise errors.AppendRevisionsOnlyViolation(self.base)
2031
2036
            if config.get_user_option('bound') != 'True':
2032
2037
                return False
2033
2038
            else:
2034
 
                config.set_user_option('bound', 'False')
 
2039
                config.set_user_option('bound', 'False', warn_masked=True)
2035
2040
                return True
2036
2041
        else:
2037
2042
            self._set_config_location('bound_location', location,
2038
2043
                                      config=config)
2039
 
            config.set_user_option('bound', 'True')
 
2044
            config.set_user_option('bound', 'True', warn_masked=True)
2040
2045
        return True
2041
2046
 
2042
2047
    def _get_bound_location(self, bound):
2062
2067
            value = 'True'
2063
2068
        else:
2064
2069
            value = 'False'
2065
 
        self.get_config().set_user_option('append_revisions_only', value)
 
2070
        self.get_config().set_user_option('append_revisions_only', value,
 
2071
            warn_masked=True)
2066
2072
 
2067
2073
    def _get_append_revisions_only(self):
2068
2074
        value = self.get_config().get_user_option('append_revisions_only')