~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Martin Pool
  • Date: 2006-06-20 04:45:30 UTC
  • mto: This revision was merged to the branch mainline in revision 1798.
  • Revision ID: mbp@sourcefrog.net-20060620044530-6e8a6f4b6f3bc525
Cleanup of imports; undeprecate all_revision_ids()

Thanks to John for review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from warnings import warn
22
22
 
23
23
import bzrlib
24
 
import bzrlib.bzrdir as bzrdir
 
24
from bzrlib import bzrdir, errors, lockdir, osutils, revision, \
 
25
        tree, \
 
26
        ui, \
 
27
        urlutils
25
28
from bzrlib.config import TreeConfig
26
29
from bzrlib.decorators import needs_read_lock, needs_write_lock
27
30
from bzrlib.delta import compare_trees
28
 
import bzrlib.errors as errors
29
31
from bzrlib.errors import (InvalidRevisionNumber,
30
32
                           NotBranchError,
31
33
                           DivergedBranches,
32
34
                           NoSuchFile,
33
35
                           NoWorkingTree)
34
36
from bzrlib.lockable_files import LockableFiles, TransportLock
35
 
from bzrlib.lockdir import LockDir
36
 
from bzrlib.osutils import (
37
 
                            rmtree,
38
 
                            )
39
 
from bzrlib.revision import (
40
 
                             NULL_REVISION,
41
 
                             )
42
37
from bzrlib.symbol_versioning import (deprecated_function,
43
38
                                      deprecated_method,
44
39
                                      DEPRECATED_PARAMETER,
46
41
                                      zero_eight,
47
42
                                      )
48
43
from bzrlib.trace import mutter, note
49
 
from bzrlib.tree import EmptyTree
50
 
import bzrlib.ui as ui
51
 
import bzrlib.urlutils as urlutils
52
44
 
53
45
 
54
46
BZR_BRANCH_FORMAT_4 = "Bazaar-NG branch, format 0.0.4\n"
219
211
                    last_revision = from_history[-1]
220
212
                else:
221
213
                    # no history in the source branch
222
 
                    last_revision = NULL_REVISION
 
214
                    last_revision = revision.NULL_REVISION
223
215
            return self.repository.fetch(from_branch.repository,
224
216
                                         revision_id=last_revision,
225
217
                                         pb=nested_pb)
741
733
        utf8_files = [('revision-history', ''),
742
734
                      ('branch-name', ''),
743
735
                      ]
744
 
        control_files = LockableFiles(branch_transport, 'lock', LockDir)
 
736
        control_files = LockableFiles(branch_transport, 'lock', lockdir.LockDir)
745
737
        control_files.create_lock()
746
738
        control_files.lock_write()
747
739
        control_files.put_utf8('format', self.get_format_string())
766
758
            format = BranchFormat.find_format(a_bzrdir)
767
759
            assert format.__class__ == self.__class__
768
760
        transport = a_bzrdir.get_branch_transport(None)
769
 
        control_files = LockableFiles(transport, 'lock', LockDir)
 
761
        control_files = LockableFiles(transport, 'lock', lockdir.LockDir)
770
762
        return BzrBranch5(_format=self,
771
763
                          _control_files=control_files,
772
764
                          a_bzrdir=a_bzrdir,
936
928
        # XXX: cache_root seems to be unused, 2006-01-13 mbp
937
929
        if hasattr(self, 'cache_root') and self.cache_root is not None:
938
930
            try:
939
 
                rmtree(self.cache_root)
 
931
                osutils.rmtree(self.cache_root)
940
932
            except:
941
933
                pass
942
934
            self.cache_root = None
1072
1064
 
1073
1065
        new_tree = self.repository.revision_tree(rh[revno-1])
1074
1066
        if revno == 1:
1075
 
            old_tree = EmptyTree()
 
1067
            old_tree = tree.EmptyTree()
1076
1068
        else:
1077
1069
            old_tree = self.repository.revision_tree(rh[revno-2])
1078
1070
        return compare_trees(old_tree, new_tree)
1121
1113
            # make a new revision history from the graph
1122
1114
            current_rev_id = stop_revision
1123
1115
            new_history = []
1124
 
            while current_rev_id not in (None, NULL_REVISION):
 
1116
            while current_rev_id not in (None, revision.NULL_REVISION):
1125
1117
                new_history.append(current_rev_id)
1126
1118
                current_rev_id_parents = stop_graph[current_rev_id]
1127
1119
                try: