24
24
from bzrlib.fetch import greedy_fetch
26
26
from bzrlib.selftest import TestCaseInTempDir
27
from bzrlib.selftest.HTTPTestUtil import TestCaseWithWebserver
29
30
def has_revision(branch, revision_id):
98
99
class TestFetch(TestCaseInTempDir):
100
101
def test_fetch(self):
102
102
#highest indices a: 5, b: 7
103
103
br_a, br_b = make_branches()
104
104
fetch_steps(self, br_a, br_b, br_a)
107
class TestHttpFetch(TestCaseWithWebserver):
110
super(TestHttpFetch, self).setUp()
113
def test_fetch(self):
114
#highest indices a: 5, b: 7
115
br_a, br_b = make_branches()
116
br_rem_a = Branch.open(self.get_remote_url(br_a._transport.base))
117
fetch_steps(self, br_rem_a, br_b, br_a)
119
def log(self, *args):
120
"""Capture web server log messages for introspection."""
121
super(TestHttpFetch, self).log(*args)
122
if args[0].startswith("webserver"):
123
self.weblogs.append(args[0])
125
def test_weaves_are_retrieved_once(self):
126
self.build_tree(("source/", "source/file", "target/"))
127
branch = Branch.initialize("source")
128
branch.add(["file"], ["id"])
129
branch.commit("added file")
130
print >>open("source/file", 'w'), "blah"
131
branch.commit("changed file")
132
target = Branch.initialize("target/")
133
source = Branch.open(self.get_remote_url("source/"))
134
source.weave_store.enable_cache = False
135
self.assertEqual(greedy_fetch(target, source), (2, []))
136
weave_suffix = 'weaves/id.weave HTTP/1.1" 200 -'
138
len([log for log in self.weblogs if log.endswith(weave_suffix)]))