def test_simple(self): # Even the simplest of pulls should call progressMade at least once. b1 = self.make_branch('some-branch') b2_tree = self.make_branch_and_tree('some-other-branch') b2_tree.commit('rev1', allow_pointless=True) p = self.StubProtocol() install_worker_ui_factory(p) b1.pull(b2_tree.branch) self.assertPositive(len(p.calls))
def test_network(self): # Even the simplest of pulls over a transport that reports activity # (here, HTTP) should call progressMade with a type of 'activity'. b1 = self.make_branch('some-branch') b2_tree = self.make_branch_and_tree('some-other-branch') b2_tree.commit('rev1', allow_pointless=True) http_server = self.getHttpServerForCwd() p = self.StubProtocol() install_worker_ui_factory(p) b2_http = bzrlib.branch.Branch.open( http_server.get_url() + 'some-other-branch') b1.pull(b2_http) self.assertSubset([WORKER_ACTIVITY_NETWORK], p.calls)
def test_network(self): # Even the simplest of pulls over a transport that reports activity # (here, HTTP) should call progressMade with a type of 'activity'. b1 = self.make_branch('some-branch') b2_tree = self.make_branch_and_tree('some-other-branch') b2_tree.commit('rev1', allow_pointless=True) http_server = self.getHttpServerForCwd() p = self.StubProtocol() install_worker_ui_factory(p) b2_http = bzrlib.branch.Branch.open(http_server.get_url() + 'some-other-branch') b1.pull(b2_http) self.assertSubset([WORKER_ACTIVITY_NETWORK], p.calls)
# There is no test for this (it would involve a great number of moving # parts) but it has been verified to work on production. Also see # https://bugs.launchpad.net/bzr/+bug/82086 from bzrlib.transport import register_lazy_transport register_lazy_transport('http://', 'bzrlib.transport.http._urllib', 'HttpTransport_urllib') register_lazy_transport('https://', 'bzrlib.transport.http._urllib', 'HttpTransport_urllib') if __name__ == '__main__': parser = OptionParser() (options, arguments) = parser.parse_args() (source_url, destination_url, branch_id, unique_name, branch_type_name, default_stacked_on_url) = arguments branch_type = BranchType.items[branch_type_name] if branch_type == BranchType.IMPORTED and 'http_proxy' in os.environ: del os.environ['http_proxy'] section_name = 'supermirror_%s_puller' % branch_type_map[branch_type] globalErrorUtility.configure(section_name) shut_up_deprecation_warning() force_bzr_to_use_urllib() resource.setrlimit(resource.RLIMIT_AS, (1500000000, 1500000000)) protocol = PullerWorkerProtocol(sys.stdout) install_worker_ui_factory(protocol) PullerWorker(source_url, destination_url, int(branch_id), unique_name, branch_type, default_stacked_on_url, protocol).mirror()
# parts) but it has been verified to work on production. Also see # https://bugs.launchpad.net/bzr/+bug/82086 from bzrlib.transport import register_lazy_transport register_lazy_transport('http://', 'bzrlib.transport.http._urllib', 'HttpTransport_urllib') register_lazy_transport('https://', 'bzrlib.transport.http._urllib', 'HttpTransport_urllib') if __name__ == '__main__': parser = OptionParser() (options, arguments) = parser.parse_args() (source_url, destination_url, branch_id, unique_name, branch_type_name, default_stacked_on_url) = arguments branch_type = BranchType.items[branch_type_name] if branch_type == BranchType.IMPORTED and 'http_proxy' in os.environ: del os.environ['http_proxy'] section_name = 'supermirror_%s_puller' % branch_type_map[branch_type] globalErrorUtility.configure(section_name) shut_up_deprecation_warning() force_bzr_to_use_urllib() resource.setrlimit(resource.RLIMIT_AS, (1500000000, 1500000000)) protocol = PullerWorkerProtocol(sys.stdout) install_worker_ui_factory(protocol) PullerWorker( source_url, destination_url, int(branch_id), unique_name, branch_type, default_stacked_on_url, protocol).mirror()