From a36766d153ebaddae9e2d085621ef32f548c3986 Mon Sep 17 00:00:00 2001 From: svlandeg Date: Thu, 10 Sep 2020 12:00:34 +0200 Subject: [PATCH] hookup branch --- spacy/cli/_util.py | 3 ++- spacy/cli/project/clone.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/spacy/cli/_util.py b/spacy/cli/_util.py index ae39f7ecb..b03f3eb69 100644 --- a/spacy/cli/_util.py +++ b/spacy/cli/_util.py @@ -337,7 +337,8 @@ def git_sparse_checkout(repo: str, subpath: str, dest: Path, *, branch: str = "m missings = " ".join([x[1:] for x in ret.stdout.split() if x.startswith("?")]) if not missings: err = f"Could not find any relevant files for '{subpath}'. " \ - f"Did you specify a correct and complete path within repo '{repo}'?" + f"Did you specify a correct and complete path within repo '{repo}' " \ + f"and branch {branch}?" msg.fail(err, exits=1) cmd = f"git -C {tmp_dir} fetch-pack {git_repo} {missings}" _attempt_run_command(cmd) diff --git a/spacy/cli/project/clone.py b/spacy/cli/project/clone.py index c6d261097..427df490f 100644 --- a/spacy/cli/project/clone.py +++ b/spacy/cli/project/clone.py @@ -28,7 +28,7 @@ def project_clone_cli( """ if dest is None: dest = Path.cwd() / name - project_clone(name, dest, repo=repo) + project_clone(name, dest, repo=repo, branch=branch) def project_clone( @@ -43,13 +43,14 @@ def project_clone( name (str): Name of subdirectory to clone. dest (Path): Destination path of cloned project. repo (str): URL of Git repo containing project templates. + branch (str): The branch to clone from """ dest = ensure_path(dest) check_clone(name, dest, repo) project_dir = dest.resolve() repo_name = re.sub(r"(http(s?)):\/\/github.com/", "", repo) try: - git_sparse_checkout(repo, name, dest) + git_sparse_checkout(repo, name, dest, branch=branch) except subprocess.CalledProcessError: err = f"Could not clone '{name}' from repo '{repo_name}'" msg.fail(err, exits=1)