~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testfetch.py

  • Committer: Robert Collins
  • Date: 2005-10-04 04:49:21 UTC
  • Revision ID: robertc@robertcollins.net-20051004044921-45fd2dc3f70abe59
remove debug print statement

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
from bzrlib.fetch import greedy_fetch
25
25
 
26
26
from bzrlib.selftest import TestCaseInTempDir
27
 
from bzrlib.selftest.HTTPTestUtil import TestCaseWithWebserver
28
27
 
29
28
 
30
29
def has_revision(branch, revision_id):
56
55
    assert has_revision(br_a, br_b.revision_history()[5])
57
56
 
58
57
    # When a non-branch ancestor is missing, it should be unlisted...
59
 
    # as its not reference from the inventory weave.
 
58
    # as its not present in the ancestry weave.
60
59
    br_b4 = new_branch('br_4')
61
60
    count, failures = greedy_fetch(br_b4, br_b)
62
61
    self.assertEqual(count, 7)
99
98
class TestFetch(TestCaseInTempDir):
100
99
 
101
100
    def test_fetch(self):
 
101
        
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)
105
 
 
106
 
 
107
 
class TestHttpFetch(TestCaseWithWebserver):
108
 
 
109
 
    def setUp(self):
110
 
        super(TestHttpFetch, self).setUp()
111
 
        self.weblogs = []
112
 
 
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)
118
 
 
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])
124
 
 
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 -'
137
 
        self.assertEqual(1,
138
 
            len([log for log in self.weblogs if log.endswith(weave_suffix)]))