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
114
116
wt = self.make_branch_and_tree('br')
115
117
self.assertEqual(wt.branch.fetch(wt.branch), (0, []))
119
def test_fetch_root_knit(self):
120
"""Ensure that knit2.fetch() updates the root knit
122
This tests the case where the root has a new revision, but there are no
123
corresponding filename, parent, contents or other changes.
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')
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)
118
156
class TestMergeFetch(TestCaseWithTransport):