Lines Matching +full:delete +full:- +full:branch
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.
30 branch: The name of the branch to create.
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.
49 branch: The name of the branch to delete.
52 ValueError: Failed to delete the repo in that directory.
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])
68 ) -> None:
79 with tempfile.NamedTemporaryFile(mode="w+t", encoding="utf-8") as f:
83 subprocess.check_output(["git", "commit", "-F", f.name], cwd=repo)
88 branch: str,
92 ) -> CommitContents:
93 """Uploads the changes in the specifed branch of the given repo for review.
97 branch: The name of the branch to upload.
101 wip: Whether to upload the change as a work-in-progress.
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")
133 encoding="utf-8",
139 r"https?://[\w-]*-review.googlesource.com/c/.*/([0-9]+)",