docs: def import_repo(self, from_file, noop=False, query='/repositories/'):
          """
          `from_file` - JSON file of repo definitions
          `noop` - Boolean, if true don't actually create/update repos, just show what would have happened
          """
          try:
              repo_defs = juicer.utils.ValidateRepoDef.validate_document(from_file)
          except JuicerRepoDefError, e:
              juicer.utils.Log.log_error("Could not load repo defs from %s:" % from_file)
              raise e
          else:
              juicer.utils.Log.log_debug("Loaded and validated repo defs from %s" % from_file)
  
          # All our known envs, for cases where no value is supplied for 'env'
          all_envs = juicer.utils.get_environments()
  
          # Repos to create/update, sorted by environment.
          repo_objects_create = []
          repo_objects_update = {}
          for env in all_envs:
              repo_objects_update[env] = []
  
          # All repo defs as Repo objects
          all_repos = [JuicerRepo(repo['name'], repo_def=repo) for repo in repo_defs]
  
          # Detailed information on all existing repos
          existing_repos = {}
          repo_pool = ThreadPool()
  
          # Parallelize getting the repo lists
          env_results = [repo_pool.apply_async(self.list_repos, tuple(), kwds={'envs': [er]}, callback=existing_repos.update) for er in all_envs]
          repo_pool.close()
  
          for result_async in env_results:
              result_async.wait()
  
          repo_pool.join()
  
          for repo in all_repos:
              # 'env' is all environments if: 'env' is not defined; 'env' is an empty list
              current_env = repo.get('env', [])
              if current_env == []:
                  juicer.utils.Log.log_debug("Setting 'env' to all_envs for repo: %s" % repo['name'])
                  repo['env'] = all_envs
  
          #  Assemble a set of all specified environments.
          defined_envs = juicer.utils.unique_repo_def_envs(all_repos)
          juicer.utils.Log.log_notice("Discovered environments: %s" % ", ".join(list(defined_envs)))
  
          widgets = [
              "Importing: ",
              progressbar.Percentage(),
              " ",
              "(",
              progressbar.SimpleProgress(),
              ") ",
              progressbar.ETA()
          ]
          progress_bar = JuiceBar(len(all_repos), widgets)
          repos_processed = juicer.admin.ThreaddedQuery.LookupObject()
          repos_processed.processed = 0
          # sort out new vs. existing
          # Break these into batches we can process at once
          for chunks in juicer.utils.chunks(all_repos, multiprocessing.cpu_count() - 1):
              crud_pool = ThreadPool()
              crud_args = (all_repos, all_envs, existing_repos, self, repo_objects_create, repo_objects_update, repos_processed, progress_bar)
              calculate_results = [crud_pool.apply_async(juicer.admin.ThreaddedQuery.calculate_create_and_update,
                                                         crud_args,
                                                         kwds={'repo': repo},
                                                         callback=juicer.admin.ThreaddedQuery.crud_progress_updater)
                                   for repo in chunks]
              crud_pool.close()
              to_process = len(calculate_results)
              juicer.utils.Log.log_debug("And we started the pool; items: %s" % len(calculate_results))
              while to_process > 0:
                  for thingy in calculate_results:
                      thingy.wait(0.5)
                      if thingy.ready():
                          to_process -= 1
              crud_pool.join()
  
          juicer.utils.Log.log_debug("And we joined all threads")
          """repo_objects_update looks like this:
  
          {'environment': [repo_update_spec, ...]}
  
          repo_update_spec :: [env, repo_diff_spec, pulp_repo]
  
          env :: environment to apply diff to
  
          repo_diff_spec :: {
              'distributor': {'distributor_config': {PARAMETERS_TO_UPDATE: VALUES}},
              'importer': {'importer_config': {PARAMETERS_TO_UPDATE: VALUES}
              }
          }
  
          pulp_repo :: Json serialization of a repo as returned from pulp (or juicer-admin repo show --json)
          """
          return (repo_objects_create, repo_objects_update)