~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/branch_implementations/test_branch.py

  • Committer: Martin Pool
  • Date: 2006-06-20 05:32:16 UTC
  • mfrom: (1797 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1798.
  • Revision ID: mbp@sourcefrog.net-20060620053216-817857d7ca3e9d1f
[merge] bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
from bzrlib import branch, bzrdir, errors, gpg, transactions, repository
23
23
from bzrlib.branch import Branch, needs_read_lock, needs_write_lock
 
24
from bzrlib.delta import TreeDelta
24
25
from bzrlib.errors import (FileExists,
25
26
                           NoSuchRevision,
26
27
                           NoSuchFile,
96
97
        tree = b2.repository.revision_tree('revision-1')
97
98
        self.assertEqual(tree.get_file_text('foo-id'), 'hello')
98
99
 
 
100
    def test_get_revision_delta(self):
 
101
        tree_a = self.make_branch_and_tree('a')
 
102
        self.build_tree(['a/foo'])
 
103
        tree_a.add('foo', 'file1')
 
104
        tree_a.commit('rev1', rev_id='rev1')
 
105
        self.build_tree(['a/vla'])
 
106
        tree_a.add('vla', 'file2')
 
107
        tree_a.commit('rev2', rev_id='rev2')
 
108
 
 
109
        delta = tree_a.branch.get_revision_delta(1)
 
110
        self.assertIsInstance(delta, TreeDelta)
 
111
        self.assertEqual([('foo', 'file1', 'file')], delta.added)
 
112
        delta = tree_a.branch.get_revision_delta(2)
 
113
        self.assertIsInstance(delta, TreeDelta)
 
114
        self.assertEqual([('vla', 'file2', 'file')], delta.added)
 
115
 
99
116
    def get_unbalanced_tree_pair(self):
100
117
        """Return two branches, a and b, with one file in a."""
101
118
        get_transport(self.get_url()).mkdir('a')
467
484
        self.assertEqual(None, self.get_branch().get_push_location())
468
485
 
469
486
    def test_get_push_location_exact(self):
470
 
        from bzrlib.config import (branches_config_filename,
 
487
        from bzrlib.config import (locations_config_filename,
471
488
                                   ensure_config_dir_exists)
472
489
        ensure_config_dir_exists()
473
 
        fn = branches_config_filename()
 
490
        fn = locations_config_filename()
474
491
        print >> open(fn, 'wt'), ("[%s]\n"
475
492
                                  "push_location=foo" %
476
493
                                  self.get_branch().base[:-1])
477
494
        self.assertEqual("foo", self.get_branch().get_push_location())
478
495
 
479
496
    def test_set_push_location(self):
480
 
        from bzrlib.config import (branches_config_filename,
 
497
        from bzrlib.config import (locations_config_filename,
481
498
                                   ensure_config_dir_exists)
482
499
        ensure_config_dir_exists()
483
 
        fn = branches_config_filename()
 
500
        fn = locations_config_filename()
484
501
        self.get_branch().set_push_location('foo')
485
502
        self.assertFileEqual("[%s]\n"
486
503
                             "push_location = foo" % self.get_branch().base[:-1],