~ubuntu-branches/debian/sid/trac-bzr/sid

« back to all changes in this revision

Viewing changes to tracbzr/tests/test_repository.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2009-12-25 15:37:57 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20091225153757-n8v0lixk6pwxep36
Tags: 0.3.0-1
* New upstream release.
* Add watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
        return self.tree.commit('tree contents', rev_id='foo%bar')
53
53
 
54
54
    def commit_foo_bar_baz(self):
55
 
        """Create a simple revision"""
 
55
        """Create a repo with two branches.
 
56
 
 
57
        - tree:
 
58
          1       foo%bar
 
59
            1.1.1 baz
 
60
          2       qux
 
61
 
 
62
        - other:
 
63
          1       foo%bar
 
64
          2       baz
 
65
        """
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())
118
128
 
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'))
 
136
 
 
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, 
129
143
                          'tree,255')
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'))
162
176
 
163
177
    def test_string_rev(self):
164
178
        self.tree.commit('Commit with comma in revid', rev_id='hi,there')