~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Aaron Bentley
  • Date: 2007-07-10 21:18:54 UTC
  • mto: This revision was merged to the branch mainline in revision 2606.
  • Revision ID: abentley@panoramicfeedback.com-20070710211854-93ofaa70day2p8d3
Start eliminating the use of None to indicate null revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
457
457
        if ph:
458
458
            return ph[-1]
459
459
        else:
460
 
            return None
 
460
            return _mod_revision.NULL_REVISION
461
461
 
462
462
    def last_revision_info(self):
463
463
        """Return information about the last revision.
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()
701
701
        :param revision_id: The revision-id to truncate history at.  May
702
702
          be None to copy complete history.
703
703
        """
 
704
        if revision_id == _mod_revision.NULL_REVISION:
 
705
            new_history = []
704
706
        new_history = self.revision_history()
705
 
        if revision_id is not None:
 
707
        if revision_id is not None and new_history != []:
706
708
            revision_id = osutils.safe_revision_id(revision_id)
707
709
            try:
708
710
                new_history = new_history[:new_history.index(revision_id) + 1]
1404
1406
                          other_branch=None):
1405
1407
        # stop_revision must be a descendant of last_revision
1406
1408
        stop_graph = self.repository.get_revision_graph(revision_id)
1407
 
        if last_rev is not None and last_rev not in stop_graph:
 
1409
        if not _mod_revision.is_null(last_rev) and last_rev not in stop_graph:
1408
1410
            # our previous tip is not merged into stop_revision
1409
1411
            raise errors.DivergedBranches(self, other_branch)
1410
1412
        # make a new revision history from the graph
1780
1782
        # other_last_rev is not in our history, and do it without pulling
1781
1783
        # history around
1782
1784
        last_rev = self.last_revision()
1783
 
        if last_rev is not None:
 
1785
        if not _mod_revision.is_null(last_rev):
1784
1786
            other.lock_read()
1785
1787
            try:
1786
1788
                other_last_rev = other.last_revision()
1787
 
                if other_last_rev is not None:
 
1789
                if not _mod_revision.is_null(other_last_rev):
1788
1790
                    # neither branch is new, we have to do some work to
1789
1791
                    # ascertain diversion.
1790
1792
                    remote_graph = other.repository.get_revision_graph(
1934
1936
    def last_revision(self):
1935
1937
        """Return last revision id, or None"""
1936
1938
        revision_id = self.last_revision_info()[1]
1937
 
        if revision_id == _mod_revision.NULL_REVISION:
1938
 
            revision_id = None
1939
1939
        return revision_id
1940
1940
 
1941
1941
    def _write_last_revision_info(self, revno, revision_id):