~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commit.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-14 16:16:53 UTC
  • mto: (1946.2.6 reduce-knit-churn)
  • mto: This revision was merged to the branch mainline in revision 1919.
  • Revision ID: john@arbash-meinel.com-20060814161653-54cdcdadcd4e9003
Remove bogus entry from BRANCH.TODO

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 by Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
import os
19
19
 
20
20
import bzrlib
21
 
from bzrlib import (
22
 
    errors,
23
 
    lockdir,
24
 
    )
 
21
from bzrlib.tests import TestCaseWithTransport
25
22
from bzrlib.branch import Branch
26
23
from bzrlib.bzrdir import BzrDir, BzrDirMetaFormat1
 
24
from bzrlib.workingtree import WorkingTree
27
25
from bzrlib.commit import Commit, NullCommitReporter
28
26
from bzrlib.config import BranchConfig
29
27
from bzrlib.errors import (PointlessCommit, BzrError, SigningFailed, 
30
28
                           LockContention)
31
 
from bzrlib.tests import TestCaseWithTransport
32
 
from bzrlib.workingtree import WorkingTree
33
29
 
34
30
 
35
31
# TODO: Test commit with some added, and added-but-missing files
411
407
        bound = master.sprout('bound')
412
408
        wt = bound.open_workingtree()
413
409
        wt.branch.set_bound_location(os.path.realpath('master'))
414
 
 
415
 
        orig_default = lockdir._DEFAULT_TIMEOUT_SECONDS
416
410
        master_branch.lock_write()
417
411
        try:
418
 
            lockdir._DEFAULT_TIMEOUT_SECONDS = 1
419
412
            self.assertRaises(LockContention, wt.commit, 'silly')
420
413
        finally:
421
 
            lockdir._DEFAULT_TIMEOUT_SECONDS = orig_default
422
414
            master_branch.unlock()
423
415
 
424
416
    def test_commit_bound_merge(self):
444
436
        # do a merge into the bound branch from other, and then change the
445
437
        # content file locally to force a new revision (rather than using the
446
438
        # revision from other). This forces extra processing in commit.
447
 
        bound_tree.merge_from_branch(other_tree.branch)
 
439
        self.merge(other_tree.branch, bound_tree)
448
440
        self.build_tree_contents([('bound/content_file', 'change in bound\n')])
449
441
 
450
442
        # before #34959 was fixed, this failed with 'revision not present in
498
490
            other_tree.commit('modify all sample files and dirs.')
499
491
        finally:
500
492
            other_tree.unlock()
501
 
        this_tree.merge_from_branch(other_tree.branch)
 
493
        self.merge(other_tree.branch, this_tree)
502
494
        reporter = CapturingReporter()
503
495
        this_tree.commit('do the commit', reporter=reporter)
504
496
        self.assertEqual([
505
 
            ('change', 'unchanged', ''),
506
497
            ('change', 'unchanged', 'dirtoleave'),
507
498
            ('change', 'unchanged', 'filetoleave'),
508
499
            ('change', 'modified', 'filetomodify'),
551
542
        timestamp = rev.timestamp
552
543
        timestamp_1ms = round(timestamp, 3)
553
544
        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'])