~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commit.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import os
19
19
 
20
20
import bzrlib
21
 
from bzrlib.tests import TestCaseWithTransport
 
21
from bzrlib import (
 
22
    errors,
 
23
    lockdir,
 
24
    )
22
25
from bzrlib.branch import Branch
23
26
from bzrlib.bzrdir import BzrDir, BzrDirMetaFormat1
24
 
from bzrlib.workingtree import WorkingTree
25
27
from bzrlib.commit import Commit, NullCommitReporter
26
28
from bzrlib.config import BranchConfig
27
29
from bzrlib.errors import (PointlessCommit, BzrError, SigningFailed, 
28
30
                           LockContention)
 
31
from bzrlib.tests import TestCaseWithTransport
 
32
from bzrlib.workingtree import WorkingTree
29
33
 
30
34
 
31
35
# TODO: Test commit with some added, and added-but-missing files
407
411
        bound = master.sprout('bound')
408
412
        wt = bound.open_workingtree()
409
413
        wt.branch.set_bound_location(os.path.realpath('master'))
 
414
 
 
415
        orig_default = lockdir._DEFAULT_TIMEOUT_SECONDS
410
416
        master_branch.lock_write()
411
417
        try:
 
418
            lockdir._DEFAULT_TIMEOUT_SECONDS = 1
412
419
            self.assertRaises(LockContention, wt.commit, 'silly')
413
420
        finally:
 
421
            lockdir._DEFAULT_TIMEOUT_SECONDS = orig_default
414
422
            master_branch.unlock()
415
423
 
416
424
    def test_commit_bound_merge(self):
543
551
        timestamp = rev.timestamp
544
552
        timestamp_1ms = round(timestamp, 3)
545
553
        self.assertEqual(timestamp_1ms, timestamp)
 
554
 
 
555
    def test_commit_unversioned_specified(self):
 
556
        """Commit should raise if specified files isn't in basis or worktree"""
 
557
        tree = self.make_branch_and_tree('.')
 
558
        self.assertRaises(errors.PathsNotVersionedError, tree.commit, 
 
559
                          'message', specific_files=['bogus'])