714
def _open_dir(self, url):
715
"""Simple BzrDir.open clone that only uses self.probers.
717
:param url: URL to open
718
:return: ControlDir instance
720
def redirected(transport, e, redirection_notice):
721
self._opener_policy.checkOneURL(e.target)
722
redirected_transport = transport._redirected_to(
724
if redirected_transport is None:
725
raise NotBranchError(e.source)
726
self._logger.info('%s is%s redirected to %s',
727
transport.base, e.permanently, redirected_transport.base)
728
return redirected_transport
730
def find_format(transport):
732
for prober_kls in self.probers:
733
prober = prober_kls()
735
return transport, prober.probe_transport(transport)
736
except NotBranchError, e:
740
transport = get_transport_from_url(url)
741
transport, format = do_catching_redirections(find_format, transport,
743
return format.open(transport)
745
714
def _doImport(self):
746
715
self._logger.info("Starting job.")
747
716
saved_factory = bzrlib.ui.ui_factory
748
opener = SafeBranchOpener(self._opener_policy)
717
opener = SafeBranchOpener(self._opener_policy, self.probers)
749
718
bzrlib.ui.ui_factory = LoggingUIFactory(logger=self._logger)
751
720
self._logger.info(
752
721
"Getting exising bzr branch from central store.")
753
722
bazaar_branch = self.getBazaarBranch()
755
remote_branch = opener.open(
756
self.source_details.url, self._open_dir)
724
remote_branch = opener.open(self.source_details.url)
757
725
except TooManyRedirections:
758
726
self._logger.info("Too many redirections.")
759
727
return CodeImportWorkerExitCode.FAILURE_INVALID