~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_controldir/test_push.py

  • Committer: Alexander Belchenko
  • Date: 2006-07-30 16:43:12 UTC
  • mto: (1711.2.111 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1906.
  • Revision ID: bialix@ukr.net-20060730164312-b025fd3ff0cee59e
rename  gpl.txt => COPYING.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009, 2010 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
 
 
17
 
"""Tests for bzrdir implementations - push."""
18
 
 
19
 
from bzrlib.tests.per_controldir import (
20
 
    TestCaseWithControlDir,
21
 
    )
22
 
 
23
 
 
24
 
class TestPush(TestCaseWithControlDir):
25
 
 
26
 
    def create_simple_tree(self):
27
 
        tree = self.make_branch_and_tree('tree')
28
 
        self.build_tree(['tree/a'])
29
 
        tree.add(['a'], ['a-id'])
30
 
        tree.commit('one', rev_id='r1')
31
 
        return tree
32
 
 
33
 
    def test_push_new_branch(self):
34
 
        tree = self.create_simple_tree()
35
 
        dir = self.make_repository('dir').bzrdir
36
 
        result = dir.push_branch(tree.branch)
37
 
        self.assertEquals(tree.branch, result.source_branch)
38
 
        self.assertEquals(dir.open_branch().base, result.target_branch.base)
39
 
        self.assertEquals(dir.open_branch().base,
40
 
            tree.branch.get_push_location())
41
 
 
42
 
    def test_push_new_empty(self):
43
 
        tree = self.make_branch_and_tree('tree')
44
 
        dir = self.make_repository('dir').bzrdir
45
 
        result = dir.push_branch(tree.branch)
46
 
        self.assertEquals(tree.branch.base, result.source_branch.base)
47
 
        self.assertEquals(dir.open_branch().base,
48
 
            result.target_branch.base)
49
 
 
50
 
    def test_push_incremental(self):
51
 
        tree = self.create_simple_tree()
52
 
        dir = self.make_repository('dir').bzrdir
53
 
        dir.push_branch(tree.branch)
54
 
        self.build_tree(['tree/b'])
55
 
        tree.add(['b'])
56
 
        tree.commit('two', rev_id='r2')
57
 
        result = dir.push_branch(tree.branch)
58
 
        self.assertEquals(tree.last_revision(),
59
 
            result.branch_push_result.new_revid)
60
 
        self.assertEquals(2, result.branch_push_result.new_revno)
61
 
        self.assertEquals(tree.branch.base, result.source_branch.base)
62
 
        self.assertEquals(dir.open_branch().base, result.target_branch.base)