/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: Andrew Bennetts
  • Date: 2008-05-07 22:47:56 UTC
  • mfrom: (3412 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3414.
  • Revision ID: andrew.bennetts@canonical.com-20080507224756-upxgmud0bdo4ysuf
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
from bzrlib.decorators import needs_read_lock, needs_write_lock
43
43
from bzrlib.hooks import Hooks
44
 
from bzrlib.symbol_versioning import (deprecated_method,
45
 
                                      zero_sixteen,
46
 
                                      )
47
44
from bzrlib.trace import mutter, mutter_callsite, note, is_quiet
48
45
 
49
46
 
323
320
            raise errors.InvalidRevisionNumber(revno)
324
321
        return self.repository.get_revision_delta(rh[revno-1])
325
322
 
326
 
    @deprecated_method(zero_sixteen)
327
 
    def get_root_id(self):
328
 
        """Return the id of this branches root
329
 
 
330
 
        Deprecated: branches don't have root ids-- trees do.
331
 
        Use basis_tree().get_root_id() instead.
332
 
        """
333
 
        raise NotImplementedError(self.get_root_id)
334
 
 
335
323
    def print_file(self, file, revision_id):
336
324
        """Print `file` to stdout."""
337
325
        raise NotImplementedError(self.print_file)
704
692
        :return: A BranchCheckResult.
705
693
        """
706
694
        mainline_parent_id = None
707
 
        for revision_id in self.revision_history():
 
695
        last_revno, last_revision_id = self.last_revision_info()
 
696
        real_rev_history = list(self.repository.iter_reverse_revision_history(
 
697
                                last_revision_id))
 
698
        real_rev_history.reverse()
 
699
        if len(real_rev_history) != last_revno:
 
700
            raise errors.BzrCheckError('revno does not match len(mainline)'
 
701
                ' %s != %s' % (last_revno, len(real_rev_history)))
 
702
        # TODO: We should probably also check that real_rev_history actually
 
703
        #       matches self.revision_history()
 
704
        for revision_id in real_rev_history:
708
705
            try:
709
706
                revision = self.repository.get_revision(revision_id)
710
707
            except errors.NoSuchRevision, e:
783
780
            basis_tree.unlock()
784
781
        return tree
785
782
 
 
783
    @needs_write_lock
 
784
    def reconcile(self, thorough=True):
 
785
        """Make sure the data stored in this branch is consistent."""
 
786
        from bzrlib.reconcile import BranchReconciler
 
787
        reconciler = BranchReconciler(self, thorough=thorough)
 
788
        reconciler.reconcile()
 
789
        return reconciler
 
790
 
786
791
    def reference_parent(self, file_id, path):
787
792
        """Return the parent branch for a tree-reference file_id
788
793
        :param file_id: The file_id of the tree reference
1348
1353
        """See Branch.abspath."""
1349
1354
        return self.control_files._transport.abspath(name)
1350
1355
 
1351
 
 
1352
 
    @deprecated_method(zero_sixteen)
1353
 
    @needs_read_lock
1354
 
    def get_root_id(self):
1355
 
        """See Branch.get_root_id."""
1356
 
        tree = self.repository.revision_tree(self.last_revision())
1357
 
        return tree.get_root_id()
1358
 
 
1359
1356
    def is_locked(self):
1360
1357
        return self.control_files.is_locked()
1361
1358
 
1703
1700
        # TODO: Maybe delete old location files?
1704
1701
        # URLs should never be unicode, even on the local fs,
1705
1702
        # FIXUP this and get_parent in a future branch format bump:
1706
 
        # read and rewrite the file, and have the new format code read
1707
 
        # using .get not .get_utf8. RBC 20060125
 
1703
        # read and rewrite the file. RBC 20060125
1708
1704
        if url is not None:
1709
1705
            if isinstance(url, unicode):
1710
1706
                try: 
1769
1765
 
1770
1766
    def get_bound_location(self):
1771
1767
        try:
1772
 
            return self.control_files.get_utf8('bound').read()[:-1]
 
1768
            return self._transport.get_bytes('bound')[:-1]
1773
1769
        except errors.NoSuchFile:
1774
1770
            return None
1775
1771