~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_push.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-05-19 08:15:16 UTC
  • mfrom: (1714.1.3 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060519081516-cd19bd125a53a4d2
Merge low hanging fruit optimisation of 'bzr add' (Robert Collins, Martin Pool).

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
import bzrlib
24
24
from bzrlib.branch import Branch
25
 
from bzrlib.bzrdir import BzrDirMetaFormat1
26
25
from bzrlib.osutils import abspath
27
 
from bzrlib.repository import RepositoryFormatKnit1
28
26
from bzrlib.tests.blackbox import ExternalBase
29
27
from bzrlib.uncommit import uncommit
30
 
from bzrlib.workingtree import WorkingTree
31
28
 
32
29
 
33
30
class TestPush(ExternalBase):
97
94
        os.chdir('..')
98
95
        self.assertEqual('', out)
99
96
        self.assertEqual('1 revision(s) pushed.\n', err)
100
 
 
101
 
    def test_push_only_pushes_history(self):
102
 
        # Knit branches should only push the history for the current revision.
103
 
        format = BzrDirMetaFormat1()
104
 
        format.repository_format = RepositoryFormatKnit1()
105
 
        shared_repo = self.make_repository('repo', format=format, shared=True)
106
 
        shared_repo.set_make_working_trees(True)
107
 
 
108
 
        def make_shared_tree(path):
109
 
            shared_repo.bzrdir.root_transport.mkdir(path)
110
 
            shared_repo.bzrdir.create_branch_convenience('repo/' + path)
111
 
            return WorkingTree.open('repo/' + path)
112
 
        tree_a = make_shared_tree('a')
113
 
        self.build_tree(['repo/a/file'])
114
 
        tree_a.add('file')
115
 
        tree_a.commit('commit a-1', rev_id='a-1')
116
 
        f = open('repo/a/file', 'ab')
117
 
        f.write('more stuff\n')
118
 
        f.close()
119
 
        tree_a.commit('commit a-2', rev_id='a-2')
120
 
 
121
 
        tree_b = make_shared_tree('b')
122
 
        self.build_tree(['repo/b/file'])
123
 
        tree_b.add('file')
124
 
        tree_b.commit('commit b-1', rev_id='b-1')
125
 
 
126
 
        self.assertTrue(shared_repo.has_revision('a-1'))
127
 
        self.assertTrue(shared_repo.has_revision('a-2'))
128
 
        self.assertTrue(shared_repo.has_revision('b-1'))
129
 
 
130
 
        # Now that we have a repository with shared files, make sure
131
 
        # that things aren't copied out by a 'push'
132
 
        os.chdir('repo/b')
133
 
        self.run_bzr('push', '../../push-b')
134
 
        pushed_tree = WorkingTree.open('../../push-b')
135
 
        pushed_repo = pushed_tree.branch.repository
136
 
        self.assertFalse(pushed_repo.has_revision('a-1'))
137
 
        self.assertFalse(pushed_repo.has_revision('a-2'))
138
 
        self.assertTrue(pushed_repo.has_revision('b-1'))
139