bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
1740.3.1
by Jelmer Vernooij
Introduce and use CommitBuilder objects. |
1 |
# Copyright (C) 2006 by Canonical Ltd
|
2 |
#
|
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
17 |
"""Tests for repository commit builder."""
|
|
18 |
||
|
1740.3.9
by Jelmer Vernooij
Make the commit message the first argument of CommitBuilder.commit(). |
19 |
from bzrlib.errors import UnsupportedOperation |
|
1740.3.1
by Jelmer Vernooij
Introduce and use CommitBuilder objects. |
20 |
from bzrlib.repository import CommitBuilder |
21 |
from bzrlib.tests.repository_implementations.test_repository import TestCaseWithRepository |
|
22 |
||
23 |
||
24 |
class TestCommitBuilder(TestCaseWithRepository): |
|
|
1740.3.3
by Jelmer Vernooij
Move storing directories and links to commit builder. |
25 |
|
|
1740.3.10
by Jelmer Vernooij
Fix some minor issues pointed out by j-a-m. |
26 |
def test_get_commit_builder(self): |
|
1740.3.7
by Jelmer Vernooij
Move committer, log, revprops, timestamp and timezone to CommitBuilder. |
27 |
tree = self.make_branch_and_tree(".") |
28 |
builder = tree.branch.get_commit_builder([]) |
|
|
1740.3.1
by Jelmer Vernooij
Introduce and use CommitBuilder objects. |
29 |
self.assertIsInstance(builder, CommitBuilder) |
|
1740.3.3
by Jelmer Vernooij
Move storing directories and links to commit builder. |
30 |
|
|
1740.3.10
by Jelmer Vernooij
Fix some minor issues pointed out by j-a-m. |
31 |
def test_finish_inventory(self): |
|
1740.3.7
by Jelmer Vernooij
Move committer, log, revprops, timestamp and timezone to CommitBuilder. |
32 |
tree = self.make_branch_and_tree(".") |
33 |
builder = tree.branch.get_commit_builder([]) |
|
|
1740.3.8
by Jelmer Vernooij
Move make_revision() to commit builder. |
34 |
builder.finish_inventory() |
|
1740.3.3
by Jelmer Vernooij
Move storing directories and links to commit builder. |
35 |
|
|
1740.3.10
by Jelmer Vernooij
Fix some minor issues pointed out by j-a-m. |
36 |
def test_commit_message(self): |
|
1740.3.7
by Jelmer Vernooij
Move committer, log, revprops, timestamp and timezone to CommitBuilder. |
37 |
tree = self.make_branch_and_tree(".") |
|
1740.3.9
by Jelmer Vernooij
Make the commit message the first argument of CommitBuilder.commit(). |
38 |
builder = tree.branch.get_commit_builder([]) |
39 |
builder.finish_inventory() |
|
40 |
rev_id = builder.commit('foo bar blah') |
|
41 |
rev = tree.branch.repository.get_revision(rev_id) |
|
42 |
self.assertEqual('foo bar blah', rev.message) |
|
43 |
||
|
1740.3.10
by Jelmer Vernooij
Fix some minor issues pointed out by j-a-m. |
44 |
def test_commit_with_revision_id(self): |
|
1740.3.9
by Jelmer Vernooij
Make the commit message the first argument of CommitBuilder.commit(). |
45 |
tree = self.make_branch_and_tree(".") |
46 |
try: |
|
47 |
builder = tree.branch.get_commit_builder([], revision_id="foo") |
|
48 |
except UnsupportedOperation: |
|
49 |
# This format doesn't support supplied revision ids
|
|
50 |
return
|
|
51 |
builder.finish_inventory() |
|
52 |
self.assertEqual("foo", builder.commit('foo bar')) |
|
53 |
self.assertTrue(tree.branch.repository.has_revision("foo")) |
|
|
1740.3.8
by Jelmer Vernooij
Move make_revision() to commit builder. |
54 |
|
|
1740.3.10
by Jelmer Vernooij
Fix some minor issues pointed out by j-a-m. |
55 |
def test_commit(self): |
|
1740.3.8
by Jelmer Vernooij
Move make_revision() to commit builder. |
56 |
tree = self.make_branch_and_tree(".") |
|
1740.3.9
by Jelmer Vernooij
Make the commit message the first argument of CommitBuilder.commit(). |
57 |
builder = tree.branch.get_commit_builder([]) |
|
1740.3.8
by Jelmer Vernooij
Move make_revision() to commit builder. |
58 |
builder.finish_inventory() |
|
1740.3.9
by Jelmer Vernooij
Make the commit message the first argument of CommitBuilder.commit(). |
59 |
rev_id = builder.commit('foo bar') |
60 |
self.assertNotEqual(None, rev_id) |
|
61 |
self.assertTrue(tree.branch.repository.has_revision(rev_id)) |