~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_commit.py

  • Committer: Robert Collins
  • Date: 2006-08-08 23:19:29 UTC
  • mfrom: (1884 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1912.
  • Revision ID: robertc@robertcollins.net-20060808231929-4e3e298190214b3a
current status

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# (C) 2005,2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
2
# Authors:  Robert Collins <robert.collins@canonical.com>
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
18
18
from cStringIO import StringIO
19
19
import os
20
20
 
21
 
import bzrlib
22
 
import bzrlib.branch
23
 
from bzrlib.branch import Branch
24
 
import bzrlib.bzrdir as bzrdir
25
 
from bzrlib.bzrdir import BzrDir
26
 
import bzrlib.errors as errors
 
21
from bzrlib import branch, bzrdir, errors, ui, workingtree
27
22
from bzrlib.errors import (NotBranchError, NotVersionedError, 
28
23
                           UnsupportedOperation)
29
24
from bzrlib.osutils import pathjoin, getcwd, has_symlinks
30
25
from bzrlib.tests import TestSkipped, TestCase
31
26
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
32
27
from bzrlib.trace import mutter
33
 
import bzrlib.ui as ui
34
 
import bzrlib.workingtree as workingtree
35
28
from bzrlib.workingtree import (TreeEntry, TreeDirectory, TreeFile, TreeLink,
36
29
                                WorkingTree)
37
30
 
89
82
 
90
83
    def test_commit_sets_last_revision(self):
91
84
        tree = self.make_branch_and_tree('tree')
92
 
        tree.commit('foo', rev_id='foo', allow_pointless=True)
 
85
        committed_id = tree.commit('foo', rev_id='foo', allow_pointless=True)
93
86
        self.assertEqual('foo', tree.last_revision())
 
87
        # the commit should have returned the same id we asked for.
 
88
        self.assertEqual('foo', committed_id)
 
89
 
 
90
    def test_commit_returns_revision_id(self):
 
91
        tree = self.make_branch_and_tree('.')
 
92
        committed_id = tree.commit('message', allow_pointless=True)
 
93
        self.assertTrue(tree.branch.repository.has_revision(committed_id))
 
94
        self.assertNotEqual(None, committed_id)
94
95
 
95
96
    def test_commit_local_unbound(self):
96
97
        # using the library api to do a local commit on unbound branches is