62
62
tree = b2.revision_tree('revision-1')
63
63
eq(tree.get_file_text('foo-id'), 'hello')
65
def test_push_stores(self):
66
"""Copy the stores from one branch to another"""
65
def get_unbalanced_branch_pair(self):
66
"""Return two branches, a and b, with one file in a."""
68
68
br_a = Branch.initialize("a")
69
69
file('a/b', 'wb').write('b')
71
commit(br_a, "silly commit")
71
commit(br_a, "silly commit", rev_id='A')
74
73
br_b = Branch.initialize("b")
76
def get_balanced_branch_pair(self):
77
"""Returns br_a, br_b as with one commit in a, and b has a's stores."""
78
br_a, br_b = self.get_unbalanced_branch_pair()
79
br_a.push_stores(br_b)
82
def test_push_stores(self):
83
"""Copy the stores from one branch to another"""
84
br_a, br_b = self.get_unbalanced_branch_pair()
85
# ensure the revision is missing.
75
86
self.assertRaises(NoSuchRevision, br_b.get_revision,
76
87
br_a.revision_history()[0])
77
88
br_a.push_stores(br_b)
89
# check that b now has all the data from a's first commit.
78
90
rev = br_b.get_revision(br_a.revision_history()[0])
79
91
tree = br_b.revision_tree(br_a.revision_history()[0])
80
92
for file_id in tree:
85
97
def test_copy_branch(self):
86
98
"""Copy the stores from one branch to another"""
87
br_a, br_b = self.test_push_stores()
99
br_a, br_b = self.get_balanced_branch_pair()
88
100
commit(br_b, "silly commit")
90
102
br_c = copy_branch(br_a, 'c', basis_branch=br_b)