/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_commit.py

  • Committer: Robert Collins
  • Date: 2006-03-03 02:09:49 UTC
  • mto: (1594.2.4 integration)
  • mto: This revision was merged to the branch mainline in revision 1596.
  • Revision ID: robertc@robertcollins.net-20060303020949-0ddc6f33d0a43943
Smoke test for RevisionStore factories creating revision stores.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import bzrlib
21
21
from bzrlib.tests import TestCaseWithTransport
22
22
from bzrlib.branch import Branch
23
 
from bzrlib.bzrdir import BzrDir, BzrDirMetaFormat1
24
23
from bzrlib.workingtree import WorkingTree
25
24
from bzrlib.commit import Commit
26
25
from bzrlib.config import BranchConfig
27
 
from bzrlib.errors import (PointlessCommit, BzrError, SigningFailed, 
28
 
                           LockContention)
 
26
from bzrlib.errors import PointlessCommit, BzrError, SigningFailed
29
27
 
30
28
 
31
29
# TODO: Test commit with some added, and added-but-missing files
310
308
        wt = self.make_branch_and_tree('.')
311
309
        branch = wt.branch
312
310
        wt.commit("base", allow_pointless=True, rev_id='A')
313
 
        self.failIf(branch.repository.has_signature_for_revision_id('A'))
 
311
        self.failIf(branch.repository.revision_store.has_id('A', 'sig'))
314
312
        try:
315
313
            from bzrlib.testament import Testament
316
314
            # monkey patch gpg signing mechanism
321
319
                                                      working_tree=wt)
322
320
            self.assertEqual(Testament.from_revision(branch.repository,
323
321
                             'B').as_short_text(),
324
 
                             branch.repository.get_signature_text('B'))
 
322
                             branch.repository.revision_store.get('B', 
 
323
                                                               'sig').read())
325
324
        finally:
326
325
            bzrlib.gpg.GPGStrategy = oldstrategy
327
326
 
332
331
        wt = self.make_branch_and_tree('.')
333
332
        branch = wt.branch
334
333
        wt.commit("base", allow_pointless=True, rev_id='A')
335
 
        self.failIf(branch.repository.has_signature_for_revision_id('A'))
 
334
        self.failIf(branch.repository.revision_store.has_id('A', 'sig'))
336
335
        try:
337
336
            from bzrlib.testament import Testament
338
337
            # monkey patch gpg signing mechanism
346
345
                              working_tree=wt)
347
346
            branch = Branch.open(self.get_url('.'))
348
347
            self.assertEqual(branch.revision_history(), ['A'])
349
 
            self.failIf(branch.repository.has_revision('B'))
 
348
            self.failIf(branch.repository.revision_store.has_id('B'))
350
349
        finally:
351
350
            bzrlib.gpg.GPGStrategy = oldstrategy
352
351
 
367
366
            self.assertEqual(['called', 'called'], calls)
368
367
        finally:
369
368
            del bzrlib.ahook
370
 
 
371
 
    def test_commit_object_doesnt_set_nick(self):
372
 
        # using the Commit object directly does not set the branch nick.
373
 
        wt = self.make_branch_and_tree('.')
374
 
        c = Commit()
375
 
        c.commit(working_tree=wt, message='empty tree', allow_pointless=True)
376
 
        self.assertEquals(wt.branch.revno(), 1)
377
 
        self.assertEqual({},
378
 
                         wt.branch.repository.get_revision(
379
 
                            wt.branch.last_revision()).properties)
380
 
 
381
 
    def test_safe_master_lock(self):
382
 
        os.mkdir('master')
383
 
        master = BzrDirMetaFormat1().initialize('master')
384
 
        master.create_repository()
385
 
        master_branch = master.create_branch()
386
 
        master.create_workingtree()
387
 
        bound = master.sprout('bound')
388
 
        wt = bound.open_workingtree()
389
 
        wt.branch.set_bound_location(os.path.realpath('master'))
390
 
        master_branch.lock_write()
391
 
        try:
392
 
            self.assertRaises(LockContention, wt.commit, 'silly')
393
 
        finally:
394
 
            master_branch.unlock()