From e1ec844468d10010ed297e1c83de41c4f123bc1d Mon Sep 17 00:00:00 2001 From: Jerry Zhang Date: Tue, 2 Jul 2024 10:25:55 -0700 Subject: [PATCH] upload: Add a --push-only flag This is similar to to dry-run except it will also push your branches for you. This can be used to either create PRS manually in github or with other code review backends that we haven't integrated yet. Topic: ponly Fixes: #179 --- docs/upload.md | 6 +++++- revup/revup.py | 1 + revup/upload.py | 9 +++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/upload.md b/docs/upload.md index 5c8fd3d..9540044 100644 --- a/docs/upload.md +++ b/docs/upload.md @@ -6,7 +6,7 @@ revup upload - Modify or create code reviews. `revup [--verbose] [--keep-temp]` : `upload [--help] [--base-branch=
] [--relative-branch=
]` -`[--rebase] [--relative-chain] [--skip-confirm] [--dry-run]` +`[--rebase] [--relative-chain] [--skip-confirm] [--dry-run] [--push-only]` `[--status] [--no-cherry-pick] [--no-update-pr-body] [--review-graph]` `[--trim-tags] [--create-local-branches] [--patchsets] [--auto-add-users=]` `[--labels=] []` @@ -162,6 +162,10 @@ github. This means that changes are still cherry-picked if necessary, and the command can still fail if there are conflicts. This will also skip the confirmation step and only print topic info. +**--push-only, -p** +: Like --dry-run except this also pushes branches to the git remote, but +does not issue any github queries or attempt rebase detection. + **--status, -t** : Print out status info of pull requests for existing topics but don't attempt to push or update them. diff --git a/revup/revup.py b/revup/revup.py index 390be67..d58681f 100755 --- a/revup/revup.py +++ b/revup/revup.py @@ -258,6 +258,7 @@ async def main() -> int: upload_parser.add_argument("--rebase", "-r", action="store_true") upload_parser.add_argument("--skip-confirm", "-s", action="store_true") upload_parser.add_argument("--dry-run", "-d", action="store_true") + upload_parser.add_argument("--push-only", action="store_true") upload_parser.add_argument("--status", "-t", action="store_true") upload_parser.add_argument("--update-pr-body", action="store_true", default=True) upload_parser.add_argument("--create-local-branches", action="store_true") diff --git a/revup/upload.py b/revup/upload.py index 7aa9bd5..39e8217 100644 --- a/revup/upload.py +++ b/revup/upload.py @@ -46,7 +46,7 @@ async def main( branch_format=args.branch_format, ) - if not args.dry_run: + if not args.dry_run and not args.push_only: with get_console().status("Querying github…"): await topics.query_github() # Fetch uses the oid results from the query @@ -69,7 +69,8 @@ async def main( topics.print(not args.verbose) return 0 - topics.populate_update_info(args.update_pr_body) + if not args.push_only: + topics.populate_update_info(args.update_pr_body) if not args.skip_confirm and topics.num_reviews_changed() > 0: topics.print(not args.verbose) if git_ctx.sh.wait_for_confirmation(): @@ -97,6 +98,10 @@ async def main( # Must push refs after creating them. Includes the virtual diff branch for patchsets. await topics.push_git_refs(git_ctx.author, args.create_local_branches) + if args.push_only: + topics.print(not args.verbose) + return 0 + try: # Must create PRs after refs are pushed, and must update PRs after creating them. with get_console().status("Updating github PRs…"):