~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/fetch.py

  • Committer: aaron.bentley at utoronto
  • Date: 2005-08-20 01:56:53 UTC
  • mto: (1092.1.41) (1185.3.4) (974.1.47)
  • mto: This revision was merged to the branch mainline in revision 1110.
  • Revision ID: aaron.bentley@utoronto.ca-20050820015653-8da4baa8ca6b04a9
factored install_revisions out of update_revisions, updated test cases for greedy_fetch

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
from bzrlib.selftest.testrevision import make_branches
18
18
from bzrlib.trace import mutter
19
19
from bzrlib.branch import Branch
 
20
from bzrlib.progress import ProgressBar
20
21
import sys
21
22
import os
22
23
 
31
32
            missing.append(rev_id)
32
33
 
33
34
    while len(missing) > 0:
34
 
        to_branch.update_revisions(from_branch, revision_ids=missing)
 
35
        to_branch.install_revisions(from_branch, revision_ids=missing)
35
36
        new_missing = []
36
37
        for rev_id in missing:
37
38
            try:
57
58
 
58
59
class TestFetch(InTempDir):
59
60
    def runTest(self):
 
61
        def new_branch(name):
 
62
            os.mkdir(name)
 
63
            return Branch(name, init=True)
 
64
            
 
65
        #highest indices a: 3, b: 4
60
66
        br_a, br_b = make_branches()
61
67
        assert not has_revision(br_b, br_a.revision_history()[3])
62
68
        assert has_revision(br_b, br_a.revision_history()[2])
 
69
        assert len(br_b.revision_history()) == 5
63
70
        greedy_fetch(br_a, br_b, br_a.revision_history()[2])
 
71
 
 
72
        # greedy_fetch is not supposed to alter the revision history
 
73
        assert len(br_b.revision_history()) == 5
64
74
        assert not has_revision(br_b, br_a.revision_history()[3])
 
75
 
 
76
        assert len(br_b.revision_history()) == 5
65
77
        greedy_fetch(br_a, br_b, br_a.revision_history()[3])
66
78
        assert has_revision(br_b, br_a.revision_history()[3])
67
79
        assert not has_revision(br_a, br_b.revision_history()[3])
69
81
        greedy_fetch(br_b, br_a)
70
82
        assert has_revision(br_a, br_b.revision_history()[3])
71
83
        assert has_revision(br_a, br_b.revision_history()[4])
72
 
        os.mkdir('branchc')
73
 
        br_c = Branch("branchc", init=True)
74
 
        greedy_fetch(br_b, br_c)
75
 
        assert has_revision(br_c, br_b.revision_history()[5])
76
 
        assert has_revision(br_c, br_a.revision_history()[4])
77
 
        os.mkdir('branchd')
78
 
        br_d = Branch("branchd", init=True)
79
 
        greedy_fetch(br_a, br_d)
80
 
        assert has_revision(br_d, br_b.revision_history()[5])
81
 
        assert has_revision(br_d, br_a.revision_history()[4])
 
84
 
 
85
        br_b2 = new_branch('br_b2')
 
86
        greedy_fetch(br_b, br_b2)
 
87
        assert has_revision(br_b2, br_b.revision_history()[4])
 
88
        assert has_revision(br_b2, br_a.revision_history()[2])
 
89
        assert not has_revision(br_b2, br_a.revision_history()[3])
 
90
 
 
91
        br_a2 = new_branch('br_a2')
 
92
        greedy_fetch(br_a, br_a2)
 
93
        assert has_revision(br_a2, br_b.revision_history()[4])
 
94
        assert has_revision(br_a2, br_a.revision_history()[3])
82
95
 
83
96
 
84
97