Skip to content

Commit

Permalink
upload: Add a --push-only flag
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jerry-skydio committed Jul 2, 2024
1 parent 71ca5eb commit e1ec844
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion docs/upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ revup upload - Modify or create code reviews.

`revup [--verbose] [--keep-temp]`
: `upload [--help] [--base-branch=<br>] [--relative-branch=<br>]`
`[--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=<o>]`
`[--labels=<labels>] [<topics>]`
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions revup/revup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
9 changes: 7 additions & 2 deletions revup/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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():
Expand Down Expand Up @@ -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…"):
Expand Down

0 comments on commit e1ec844

Please sign in to comment.