def import_command(args): "Process logs of repositories and put them into the database" store = SqliteStore(args.dir) host_info, projects = _host_info_and_projects(store, args) if not projects: projects = _projects_from_store(store, host_info) if not projects and not args.only_this_step: list_command(args) projects = _projects_from_store(store, host_info) if projects: for prj in projects: projectid, _ = store.add_project(host_info.id, prj) path = host_info.project_local_path(args.dir, prj) if not os.path.exists(os.path.join(path, '.hg')) and not args.only_this_step: source = host_info.project_remote_url(prj) mirror_repo(source, path) with Timer('Process logs %s' % (path)): import_log(store, projectid, path)
def mirror_command(args): "Make a local mirror of repositories for later processing" store = SqliteStore(args.dir) host_info, projects = _host_info_and_projects(store, args) if not projects: projects = _projects_from_store(store, host_info) if not projects and not args.only_this_step: # Try to get a listing of projects list_command(args) projects = _projects_from_store(store, host_info) if projects: for prj in projects: source = host_info.project_remote_url(prj) dest = host_info.project_local_path(args.dir, prj) with Timer('Mirror %s' % (source)): mirror_repo(source, dest, max_commits=args.commits) else: print 'Warning: No projects found or given'