bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
| 
1773.4.1
by Martin Pool
 Add pyflakes makefile target; fix many warnings  | 
1  | 
# Copyright (C) 2006 Canonical Ltd
 | 
| 
1563.1.4
by Robert Collins
 Fix 'bzr pull' on metadir trees.  | 
2  | 
# Authors:  Robert Collins <robert.collins@canonical.com>
 | 
3  | 
#
 | 
|
4  | 
# This program is free software; you can redistribute it and/or modify
 | 
|
5  | 
# it under the terms of the GNU General Public License as published by
 | 
|
6  | 
# the Free Software Foundation; either version 2 of the License, or
 | 
|
7  | 
# (at your option) any later version.
 | 
|
8  | 
#
 | 
|
9  | 
# This program is distributed in the hope that it will be useful,
 | 
|
10  | 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|
11  | 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|
12  | 
# GNU General Public License for more details.
 | 
|
13  | 
#
 | 
|
14  | 
# You should have received a copy of the GNU General Public License
 | 
|
15  | 
# along with this program; if not, write to the Free Software
 | 
|
16  | 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|
17  | 
||
18  | 
from cStringIO import StringIO  | 
|
19  | 
import os  | 
|
20  | 
||
| 
1773.4.1
by Martin Pool
 Add pyflakes makefile target; fix many warnings  | 
21  | 
from bzrlib import errors  | 
| 
1563.1.4
by Robert Collins
 Fix 'bzr pull' on metadir trees.  | 
22  | 
from bzrlib.errors import NotBranchError, NotVersionedError  | 
23  | 
from bzrlib.osutils import basename  | 
|
24  | 
from bzrlib.tests import TestSkipped  | 
|
25  | 
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree  | 
|
26  | 
from bzrlib.trace import mutter  | 
|
27  | 
from bzrlib.transport import get_transport  | 
|
28  | 
||
29  | 
||
30  | 
class TestPull(TestCaseWithWorkingTree):  | 
|
31  | 
||
32  | 
def get_pullable_trees(self):  | 
|
33  | 
self.build_tree(['from/', 'from/file', 'to/'])  | 
|
34  | 
tree = self.make_branch_and_tree('from')  | 
|
35  | 
tree.add('file')  | 
|
36  | 
tree.commit('foo', rev_id='A')  | 
|
37  | 
tree_b = self.make_branch_and_tree('to')  | 
|
38  | 
return tree, tree_b  | 
|
39  | 
||
40  | 
def test_pull(self):  | 
|
41  | 
tree_a, tree_b = self.get_pullable_trees()  | 
|
42  | 
tree_b.pull(tree_a.branch)  | 
|
43  | 
self.failUnless(tree_b.branch.repository.has_revision('A'))  | 
|
| 
1908.7.6
by Robert Collins
 Deprecate WorkingTree.last_revision.  | 
44  | 
self.assertEqual(['A'], tree_b.get_parent_ids())  | 
| 
1563.1.4
by Robert Collins
 Fix 'bzr pull' on metadir trees.  | 
45  | 
|
46  | 
def test_pull_overwrites(self):  | 
|
47  | 
tree_a, tree_b = self.get_pullable_trees()  | 
|
48  | 
tree_b.commit('foo', rev_id='B')  | 
|
49  | 
self.assertEqual(['B'], tree_b.branch.revision_history())  | 
|
50  | 
tree_b.pull(tree_a.branch, overwrite=True)  | 
|
51  | 
self.failUnless(tree_b.branch.repository.has_revision('A'))  | 
|
52  | 
self.failUnless(tree_b.branch.repository.has_revision('B'))  | 
|
| 
1908.7.6
by Robert Collins
 Deprecate WorkingTree.last_revision.  | 
53  | 
self.assertEqual(['A'], tree_b.get_parent_ids())  | 
| 
1563.1.4
by Robert Collins
 Fix 'bzr pull' on metadir trees.  | 
54  | 
|
55  | 
def test_pull_merges_tree_content(self):  | 
|
56  | 
tree_a, tree_b = self.get_pullable_trees()  | 
|
57  | 
tree_b.pull(tree_a.branch)  | 
|
58  | 
self.assertFileEqual('contents of from/file\n', 'to/file')  | 
|
59  |