bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
2487.2.1
by John Arbash Meinel
Move the Branch.sprout tests into their own folder. |
1 |
# Copyright (C) 2007 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 Branch.sprout()"""
|
|
18 |
||
|
2487.2.2
by John Arbash Meinel
Adding a simple sprout test to make sure it creates the target branch with the right format |
19 |
from bzrlib import ( |
20 |
remote, |
|
21 |
tests, |
|
22 |
)
|
|
|
2487.2.1
by John Arbash Meinel
Move the Branch.sprout tests into their own folder. |
23 |
from bzrlib.tests.branch_implementations import TestCaseWithBranch |
24 |
||
25 |
||
26 |
class TestSprout(TestCaseWithBranch): |
|
27 |
||
28 |
def test_sprout_branch_nickname(self): |
|
29 |
# test the nick name is reset always
|
|
30 |
raise tests.TestSkipped('XXX branch sprouting is not yet tested..') |
|
31 |
||
32 |
def test_sprout_branch_parent(self): |
|
33 |
source = self.make_branch('source') |
|
34 |
target = source.bzrdir.sprout(self.get_url('target')).open_branch() |
|
35 |
self.assertEqual(source.bzrdir.root_transport.base, target.get_parent()) |
|
36 |
||
|
2487.2.2
by John Arbash Meinel
Adding a simple sprout test to make sure it creates the target branch with the right format |
37 |
def test_sprout_preserves_kind(self): |
38 |
branch1 = self.make_branch('branch1') |
|
39 |
target_repo = self.make_repository('branch2') |
|
40 |
target_repo.fetch(branch1.repository) |
|
41 |
branch2 = branch1.sprout(target_repo.bzrdir) |
|
42 |
if isinstance(branch1, remote.RemoteBranch): |
|
43 |
branch1._ensure_real() |
|
44 |
target_class = branch1._real_branch.__class__ |
|
45 |
else: |
|
46 |
target_class = branch1.__class__ |
|
47 |
self.assertIsInstance(branch2, target_class) |
|
48 |
||
|
2487.2.1
by John Arbash Meinel
Move the Branch.sprout tests into their own folder. |
49 |
def test_sprout_partial(self): |
50 |
# test sprouting with a prefix of the revision-history.
|
|
51 |
# also needs not-on-revision-history behaviour defined.
|
|
52 |
wt_a = self.make_branch_and_tree('a') |
|
53 |
self.build_tree(['a/one']) |
|
54 |
wt_a.add(['one']) |
|
55 |
wt_a.commit('commit one', rev_id='1') |
|
56 |
self.build_tree(['a/two']) |
|
57 |
wt_a.add(['two']) |
|
58 |
wt_a.commit('commit two', rev_id='2') |
|
59 |
repo_b = self.make_repository('b') |
|
60 |
repo_a = wt_a.branch.repository |
|
61 |
repo_a.copy_content_into(repo_b) |
|
62 |
br_b = wt_a.branch.sprout(repo_b.bzrdir, revision_id='1') |
|
63 |
self.assertEqual('1', br_b.last_revision()) |