/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branch.py

  • Committer: Aaron Bentley
  • Date: 2007-02-13 22:25:26 UTC
  • mto: (2230.3.47 branch6)
  • mto: This revision was merged to the branch mainline in revision 2290.
  • Revision ID: abentley@panoramicfeedback.com-20070213222526-ztxquwl9cax22cbf
Change asserts to specific errors for left-hand history violations

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
from bzrlib import (
28
28
    branch as _mod_branch,
 
29
    bzrdir,
 
30
    errors,
29
31
    urlutils,
30
32
    )
31
33
import bzrlib.branch
32
34
from bzrlib.branch import (BzrBranch5, 
33
35
                           BzrBranchFormat5)
34
 
import bzrlib.bzrdir as bzrdir
35
36
from bzrlib.bzrdir import (BzrDirMetaFormat1, BzrDirMeta1, 
36
37
                           BzrDir, BzrDirFormat)
37
38
from bzrlib.errors import (NotBranchError,
207
208
        self.failIfExists('a/.bzr/branch/bound')
208
209
        self.assertEqual('ftp://bazaar-vcs.org', branch.get_bound_location())
209
210
 
210
 
 
 
211
    def test_set_revision_history(self):
 
212
        tree = self.make_branch_and_memory_tree('.',
 
213
            format='experimental-branch6')
 
214
        tree.lock_write()
 
215
        try:
 
216
            tree.add('.')
 
217
            tree.commit('foo', rev_id='foo')
 
218
            tree.commit('bar', rev_id='bar')
 
219
            tree.branch.set_revision_history(['foo', 'bar'])
 
220
            tree.branch.set_revision_history(['foo'])
 
221
            self.assertRaises(errors.NotLefthandHistory,
 
222
                              tree.branch.set_revision_history, ['bar'])
 
223
        finally:
 
224
            tree.unlock()
 
225
 
 
226
 
 
227
    def test_append_revision(self):
 
228
        tree = self.make_branch_and_tree('branch1',
 
229
            format='experimental-branch6')
 
230
        tree.lock_write()
 
231
        try:
 
232
            tree.add('.')
 
233
            tree.commit('foo', rev_id='foo')
 
234
            tree.commit('bar', rev_id='bar')
 
235
            tree.commit('baz', rev_id='baz')
 
236
            tree.set_last_revision('bar')
 
237
            tree.branch.set_last_revision('bar')
 
238
            tree.commit('qux', rev_id='qux')
 
239
            tree.add_parent_tree_id('baz')
 
240
            tree.commit('qux', rev_id='quxx')
 
241
            tree.branch.set_last_revision('null:')
 
242
            self.assertRaises(errors.NotLeftParentDescendant,
 
243
                              tree.branch.append_revision, 'bar')
 
244
            tree.branch.append_revision('foo')
 
245
            self.assertRaises(errors.NotLeftParentDescendant,
 
246
                              tree.branch.append_revision, 'baz')
 
247
            tree.branch.append_revision('bar')
 
248
            tree.branch.append_revision('baz')
 
249
            self.assertRaises(errors.NotLeftParentDescendant,
 
250
                              tree.branch.append_revision, 'quxx')
 
251
        finally:
 
252
            tree.unlock()
211
253
class TestBranchReference(TestCaseWithTransport):
212
254
    """Tests for the branch reference facility."""
213
255