~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_fetch.py

  • Committer: v.ladeuil+lp at free
  • Date: 2006-11-08 07:44:30 UTC
  • mfrom: (2123 +trunk)
  • mto: (2145.1.1 keepalive)
  • mto: This revision was merged to the branch mainline in revision 2146.
  • Revision ID: v.ladeuil+lp@free.fr-20061108074430-a9c08d4a475bd97f
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import re
19
19
import sys
20
20
 
 
21
from bzrlib import bzrdir, repository
21
22
from bzrlib.branch import Branch
22
23
from bzrlib.bzrdir import BzrDir
23
24
from bzrlib.builtins import merge
26
27
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver
27
28
from bzrlib.tests.test_revision import make_branches
28
29
from bzrlib.trace import mutter
 
30
from bzrlib.upgrade import Convert
29
31
from bzrlib.workingtree import WorkingTree
30
32
 
31
33
 
114
116
        wt = self.make_branch_and_tree('br')
115
117
        self.assertEqual(wt.branch.fetch(wt.branch), (0, []))
116
118
 
 
119
    def test_fetch_root_knit(self):
 
120
        """Ensure that knit2.fetch() updates the root knit
 
121
        
 
122
        This tests the case where the root has a new revision, but there are no
 
123
        corresponding filename, parent, contents or other changes.
 
124
        """
 
125
        knit1_format = bzrdir.BzrDirMetaFormat1()
 
126
        knit1_format.repository_format = repository.RepositoryFormatKnit1()
 
127
        knit2_format = bzrdir.BzrDirMetaFormat1()
 
128
        knit2_format.repository_format = repository.RepositoryFormatKnit2()
 
129
        # we start with a knit1 repository because that causes the
 
130
        # root revision to change for each commit, even though the content,
 
131
        # parent, name, and other attributes are unchanged.
 
132
        tree = self.make_branch_and_tree('tree', knit1_format)
 
133
        tree.set_root_id('tree-root')
 
134
        tree.commit('rev1', rev_id='rev1')
 
135
        tree.commit('rev2', rev_id='rev2')
 
136
 
 
137
        # Now we convert it to a knit2 repository so that it has a root knit
 
138
        Convert(tree.basedir, knit2_format)
 
139
        tree = WorkingTree.open(tree.basedir)
 
140
        branch = self.make_branch('branch', format=knit2_format)
 
141
        branch.pull(tree.branch, stop_revision='rev1')
 
142
        repo = branch.repository
 
143
        root_knit = repo.weave_store.get_weave('tree-root',
 
144
                                                repo.get_transaction())
 
145
        # Make sure fetch retrieved only what we requested
 
146
        self.assertTrue('rev1' in root_knit)
 
147
        self.assertTrue('rev2' not in root_knit)
 
148
        branch.pull(tree.branch)
 
149
        root_knit = repo.weave_store.get_weave('tree-root',
 
150
                                                repo.get_transaction())
 
151
        # Make sure that the next revision in the root knit was retrieved,
 
152
        # even though the text, name, parent_id, etc., were unchanged.
 
153
        self.assertTrue('rev2' in root_knit)
 
154
 
117
155
 
118
156
class TestMergeFetch(TestCaseWithTransport):
119
157