52
52
return self.tree.commit('tree contents', rev_id='foo%bar')
54
54
def commit_foo_bar_baz(self):
55
"""Create a simple revision"""
55
"""Create a repo with two branches.
56
66
self.commit_foo_bar()
57
67
other = self.tree.bzrdir.sprout('repo/other').open_workingtree()
58
68
treeshape.build_tree_contents([
116
126
self.assertEqual(CURRENT_REVISION, self.trac_repo().get_youngest_rev())
117
127
self.assertEqual('tree,1', self.trac_repo().get_oldest_rev())
119
def test_next_prev(self):
129
def test_previous_rev(self):
120
130
self.commit_foo_bar_baz()
121
131
repo = self.trac_repo()
122
self.assertEqual('other,2', repo.previous_rev('tree,2'))
123
self.assertEqual('tree,1', repo.previous_rev('other,2'))
124
self.assertEqual(NULL_REVISION, repo.previous_rev('tree,1'))
132
self.assertEqual('tree,1', repo.previous_rev('tree,2'))
133
self.assertEqual('other,1', repo.previous_rev('other,2'))
134
self.assertEqual('tree,0', repo.previous_rev('tree,1'))
125
135
self.assertEqual(None, repo.previous_rev(NULL_REVISION))
126
self.assertEqual('tree,1.1.1', repo.next_rev('tree,1', 'tree'))
137
def test_next_rev(self):
138
self.commit_foo_bar_baz()
139
repo = self.trac_repo()
140
self.assertEqual('tree,2', repo.next_rev('tree,1', 'tree'))
127
141
self.assertEqual(None, repo.next_rev('tree,2'))
128
142
self.assertRaises(versioncontrol.NoSuchChangeset, repo.next_rev,
158
172
repo = self.trac_repo()
159
173
self.assertEqual('1', repo.short_rev('tree,1'))
160
174
self.assertEqual('2', repo.short_rev('tree,qux'))
161
self.assertEqual('~1', repo.short_rev('tree,baz'))
175
self.assertEqual('1.1.1', repo.short_rev('tree,baz'))
163
177
def test_string_rev(self):
164
178
self.tree.commit('Commit with comma in revid', rev_id='hi,there')