Example #1
0
def run(args: argparse.Namespace) -> None:
    force = args.force
    update_manifest = args.update_manifest
    groups = args.groups
    all_cloned = args.all_cloned
    regex = args.regex
    iregex = args.iregex
    workspace = get_workspace(args)
    num_jobs = get_num_jobs(args)

    if update_manifest:
        ui.info_2("Updating manifest")
        workspace.update_manifest()
    else:
        ui.info_2("Not updating manifest")

    workspace.repos = resolve_repos(workspace,
                                    groups=groups,
                                    all_cloned=all_cloned,
                                    regex=regex,
                                    iregex=iregex)

    workspace.clone_missing(num_jobs=num_jobs)
    workspace.set_remotes(num_jobs=num_jobs)
    workspace.sync(force=force, num_jobs=num_jobs)
    workspace.perform_filesystem_operations()
    ui.info_1("Workspace synchronized")
Example #2
0
def run(args: argparse.Namespace) -> None:
    manifest = tsrc.manifest.load(args.manifest_path)
    workspace = get_workspace(args)
    workspace.repos = repos_from_config(manifest, workspace.config)
    workspace.clone_missing()
    workspace.set_remotes()
    workspace.perform_filesystem_operations(manifest=manifest)
Example #3
0
def run(args: argparse.Namespace) -> None:
    manifest = load_manifest(args.manifest_path)
    num_jobs = get_num_jobs(args)
    workspace = get_workspace(args)
    workspace.repos = repos_from_config(manifest, workspace.config)
    workspace.clone_missing(num_jobs=num_jobs)
    workspace.set_remotes(num_jobs=num_jobs)
    workspace.perform_filesystem_operations(manifest=manifest)
Example #4
0
def sync(
    workspace_path: Optional[Path] = None,
    groups: Optional[List[str]] = None,
    all_cloned: bool = False,
    force: bool = False,
) -> None:
    """ synchronize the current workspace with the manifest """
    workspace = get_workspace(workspace_path)

    ui.info_2("Updating manifest")
    workspace.update_manifest()

    workspace.repos = resolve_repos(workspace,
                                    groups=groups,
                                    all_cloned=all_cloned)
    workspace.clone_missing()
    workspace.set_remotes()
    workspace.sync(force=force)
    workspace.perform_filesystem_operations()
    ui.info("Done", ui.check)
Example #5
0
def run(args: argparse.Namespace) -> None:
    force = args.force
    update_manifest = args.update_manifest
    groups = args.groups
    all_cloned = args.all_cloned

    workspace = get_workspace(args)

    if update_manifest:
        ui.info_2("Updating manifest")
        workspace.update_manifest()
    else:
        ui.info_2("Not updating manifest")

    workspace.repos = resolve_repos(workspace,
                                    groups=groups,
                                    all_cloned=all_cloned)

    workspace.clone_missing()
    workspace.set_remotes()
    workspace.sync(force=force)
    workspace.perform_filesystem_operations()
    ui.info("Done", ui.check)
Example #6
0
def local_sync(
    workspace_path: Optional[Path] = None,
    groups: Optional[List[str]] = None,
    all_cloned: bool = False,
    force: bool = False,
) -> None:
    """ synchronize the current workspace with the manifest """

    try:
        remote_url = subprocess.check_output('git config --get remote.origin.url', shell=True).decode('utf-8').replace('\n', '')
        cmd_string = "git rev-parse --abbrev-ref HEAD"
        remote_branch = subprocess.check_output(cmd_string, shell=True).decode('utf-8').replace('\n', '')
    except Exception:
        remote_url = False
        remote_branch = False

    workspace_config = WorkspaceConfig(
        manifest_url=remote_url,
        manifest_branch=remote_branch,
        clone_all_repos=False,
        repo_groups=[],
        shallow_clones=False,
        singular_remote=None,
    )
    cfg_path = Path(os.getcwd()) / ".tsrc" / "config.yml"
    workspace_config.save_to_file(cfg_path)

    workspace = get_workspace(workspace_path, local_file=True)
    update_manifest_local()

    workspace.repos = resolve_repos(workspace, groups=groups, all_cloned=all_cloned)
    workspace.clone_missing()
    workspace.set_remotes()
    workspace.sync(force=force)
    workspace.perform_filesystem_operations()
    ui.info("Done", ui.check)