浏览代码

Update new_proposal script with --branch-start-point (#450)

* Allow configuration of start point.

* Use git switch --create.

* Maybe fix string type.

* Fix wrong flag.

* Add --dry_run flag.

* Not sure if this is needed.

* Dry run should be safe even with uncommitted changes.

* Remove side effects with --dry_run.

* Checkpoint progress.

* Make `dry_run` parameter optional so tests pass.

* Implement suggestions from code review.

* Checkpoint progress.

* Remove new dry_run_pr_number option.

* Rename --start_point to --branch_start_point.
josh11b 5 年之前
父节点
当前提交
160c5d06d3
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 10 1
      proposals/scripts/new_proposal.py

+ 10 - 1
proposals/scripts/new_proposal.py

@@ -65,6 +65,13 @@ def _parse_args(args=None):
         help="The proposals directory, mainly for testing cross-repository. "
         "Automatically found by default.",
     )
+    parser.add_argument(
+        "--branch-start-point",
+        metavar="BRANCH_START_POINT",
+        default="trunk",
+        type=str,
+        help="The starting point for the new branch.",
+    )
     return parser.parse_args(args=args)
 
 
@@ -165,7 +172,9 @@ def main():
         _exit("ERROR: Cancelled")
 
     # Create a proposal branch.
-    _run([git_bin, "checkout", "-b", branch, "trunk"])
+    _run(
+        [git_bin, "switch", "--create", branch, parsed_args.branch_start_point]
+    )
     _run([git_bin, "push", "-u", "origin", branch])
 
     # Copy template.md to a temp file.