Lines Matching +full:repo +full:- +full:name
3 # Use of this source code is governed by a BSD-style license that can be
20 def IsFullGitSHA(s: str) -> bool:
25 def CreateBranch(repo: Union[Path, str], branch: str) -> None:
26 """Creates a branch in the given repo.
29 repo: The absolute path to the repo.
30 branch: The name of the branch to create.
33 ValueError: Failed to create a repo in that directory.
36 if not os.path.isdir(repo):
37 raise ValueError("Invalid directory path provided: %s" % repo)
39 subprocess.check_output(["git", "-C", repo, "reset", "HEAD", "--hard"])
41 subprocess.check_output(["repo", "start", branch], cwd=repo)
44 def DeleteBranch(repo: Union[Path, str], branch: str) -> None:
45 """Deletes a branch in the given repo.
48 repo: The absolute path of the repo.
49 branch: The name of the branch to delete.
52 ValueError: Failed to delete the repo in that directory.
55 if not os.path.isdir(repo):
56 raise ValueError("Invalid directory path provided: %s" % repo)
59 subprocess.run(["git", "-C", repo] + cmd, check=True)
61 run_checked(["checkout", "-q", "m/main"])
62 run_checked(["reset", "-q", "HEAD", "--hard"])
63 run_checked(["branch", "-q", "-D", branch])
67 repo: Union[Path, str], commit_messages: Iterable[str]
68 ) -> None:
72 repo: The absolute path to the repo where changes were made.
75 if not os.path.isdir(repo):
76 raise ValueError("Invalid path provided: %s" % repo)
79 with tempfile.NamedTemporaryFile(mode="w+t", encoding="utf-8") as f:
83 subprocess.check_output(["git", "commit", "-F", f.name], cwd=repo)
87 repo: Union[Path, str],
92 ) -> CommitContents:
93 """Uploads the changes in the specifed branch of the given repo for review.
96 repo: The absolute path to the repo where changes were made.
97 branch: The name of the branch to upload.
101 wip: Whether to upload the change as a work-in-progress.
111 if not os.path.isdir(repo):
112 raise ValueError("Invalid path provided: %s" % repo)
116 "repo",
118 "--yes",
119 f'--reviewers={",".join(reviewers)}' if reviewers else "--ne",
120 "--no-verify",
121 f"--br={branch}",
125 git_args.append(f'--cc={",".join(cc)}')
127 git_args.append("--wip")
132 cwd=repo,
133 encoding="utf-8",
139 r"https?://[\w-]*-review.googlesource.com/c/.*/([0-9]+)",