Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upload: Add a --push-only flag #180

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading