Add a --remote switch to new_proposal.py (#4681)

If the user's fork is not named 'origin' then the script will fail and
needs to know the user's remote name.

Fixes #1899
This commit is contained in:
Dana Jansens
2024-12-13 15:46:27 +00:00
committed by GitHub
parent c7ae2a7b18
commit 18d99350a9
+8 -1
View File
@@ -55,6 +55,13 @@ def _parse_args(args: Optional[List[str]] = None) -> argparse.Namespace:
help="The name of the branch. Automatically generated from the title "
"by default.",
)
parser.add_argument(
"--remote",
metavar="REMOTE",
default="origin",
help="The git remote name where the branch will be pushed. Defaults to "
"'origin'.",
)
parser.add_argument(
"--proposals-dir",
metavar="PROPOSALS_DIR",
@@ -177,7 +184,7 @@ def main() -> None:
_run(
[git_bin, "switch", "--create", branch, parsed_args.branch_start_point]
)
_run([git_bin, "push", "-u", "origin", branch])
_run([git_bin, "push", "-u", parsed_args.remote, branch])
# Copy template.md to a temp file.
template_path = os.path.join(proposals_dir, "scripts/template.md")