1
# Copyright (C) 2007, 2009, 2010, 2011, 2016 Canonical Ltd
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.
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.
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
27
class TestPull(transport_util.TestCaseWithConnectionHookedTransport):
30
wt1 = self.make_branch_and_tree('branch1')
31
tip = wt1.commit('empty commit')
32
wt2 = self.make_branch_and_tree('branch2')
34
self.start_logging_connections()
36
cmd = builtins.cmd_pull()
37
# We don't care about the ouput but 'outf' should be defined
38
cmd.outf = ui_testing.StringIOWithEncoding()
39
cmd.run(self.get_url('branch1'), directory='branch2')
40
self.assertEqual(1, len(self.connections))
42
def test_pull_with_bound_branch(self):
44
master_wt = self.make_branch_and_tree('master')
45
local_wt = self.make_branch_and_tree('local')
46
master_branch = branch.Branch.open(self.get_url('master'))
47
local_wt.branch.bind(master_branch)
49
remote_wt = self.make_branch_and_tree('remote')
50
remote_wt.commit('empty commit')
52
self.start_logging_connections()
54
pull = builtins.cmd_pull()
55
# We don't care about the ouput but 'outf' should be defined
56
pull.outf = ui_testing.StringIOWithEncoding()
57
pull.run(self.get_url('remote'), directory='local')
58
self.assertEqual(2, len(self.connections))