def main(self):
     force_bzr_to_use_urllib()
     set_default_timeout_function(lambda: 60.0)
     source_details = CodeImportSourceDetails.fromArguments(self.args)
     if source_details.rcstype == 'git':
         if source_details.target_rcstype == 'bzr':
             import_worker_cls = GitImportWorker
         else:
             import_worker_cls = GitToGitImportWorker
     elif source_details.rcstype == 'bzr-svn':
         import_worker_cls = BzrSvnImportWorker
     elif source_details.rcstype == 'bzr':
         import_worker_cls = BzrImportWorker
     elif source_details.rcstype == 'cvs':
         import_worker_cls = CSCVSImportWorker
     else:
         raise AssertionError('unknown rcstype %r' % source_details.rcstype)
     opener_policy = opener_policies[self.options.access_policy](
         source_details.rcstype, source_details.target_rcstype)
     if source_details.target_rcstype == 'bzr':
         import_worker = import_worker_cls(
             source_details,
             get_transport(config.codeimport.foreign_tree_store),
             get_default_bazaar_branch_store(), self.logger, opener_policy)
     else:
         import_worker = import_worker_cls(source_details, self.logger,
                                           opener_policy)
     return import_worker.run()
Example #2
0
 def assertBranchImportedOKForCodeImport(self, code_import):
     """Assert that a branch was pushed into the default branch store."""
     if IBranch.providedBy(code_import.target):
         url = get_default_bazaar_branch_store()._getMirrorURL(
             code_import.branch.id)
         branch = Branch.open(url)
         commit_count = branch.revno()
     else:
         repo_path = os.path.join(self.target_store,
                                  code_import.target.unique_name)
         commit_count = int(
             subprocess.check_output(["git", "rev-list", "--count", "HEAD"],
                                     cwd=repo_path,
                                     universal_newlines=True))
     self.assertEqual(self.foreign_commit_count, commit_count)
 def main(self):
     force_bzr_to_use_urllib()
     source_details = CodeImportSourceDetails.fromArguments(self.args)
     if source_details.rcstype == 'git':
         import_worker_cls = GitImportWorker
     elif source_details.rcstype == 'bzr-svn':
         import_worker_cls = BzrSvnImportWorker
     elif source_details.rcstype == 'bzr':
         import_worker_cls = BzrImportWorker
     elif source_details.rcstype in ['cvs', 'svn']:
         import_worker_cls = CSCVSImportWorker
     else:
         raise AssertionError(
             'unknown rcstype %r' % source_details.rcstype)
     import_worker = import_worker_cls(
         source_details,
         get_transport(config.codeimport.foreign_tree_store),
         get_default_bazaar_branch_store(), self.logger,
         opener_policies[self.options.access_policy])
     return import_worker.run()
 def assertBranchImportedOKForCodeImport(self, code_import):
     """Assert that a branch was pushed into the default branch store."""
     url = get_default_bazaar_branch_store()._getMirrorURL(
         code_import.branch.id)
     branch = Branch.open(url)
     self.assertEqual(self.foreign_commit_count, branch.revno())
Example #5
0
 def assertBranchImportedOKForCodeImport(self, code_import):
     """Assert that a branch was pushed into the default branch store."""
     url = get_default_bazaar_branch_store()._getMirrorURL(
         code_import.branch.id)
     branch = Branch.open(url)
     self.assertEqual(self.foreign_commit_count, branch.revno())