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