You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor: Refine error reporting for auto-detection failures
- Removes `parser.print_help()` calls for specific auto-detection failures:
- When the repository owner/name cannot be determined automatically and is not specified by the user.
- When the current git branch cannot be determined (and --pull_number is not provided).
- The script will still print a targeted error message and exit with an error code in these scenarios.
- Other error conditions (e.g., invalid explicit arguments, or no PR found for a valid detected branch) will continue to print full usage information.
sys.stderr.write("Error: Could not determine repository. Please specify --url, OR both --owner and --repo, OR ensure git remote 'origin' is configured correctly.\n")
323
-
parser.print_help()
324
-
sys.exit(1)
323
+
sys.exit(1) # No print_help() here, as per request
325
324
326
325
ifnotset_repo_url_standalone(final_owner, final_repo): # Sets global OWNER and REPO
327
326
sys.stderr.write(f"Error: Could not set repository to {final_owner}/{final_repo}. Ensure owner/repo are correct.\n")
328
327
sys.exit(1)
329
328
330
329
pull_request_number=args.pull_number
330
+
current_branch_for_pr_check=None# Used to improve final error message
331
331
ifnotpull_request_number:
332
332
sys.stderr.write("Pull number not specified, attempting to find PR for current branch...\n")
333
-
current_branch=get_current_branch_name()
334
-
ifcurrent_branch:
335
-
sys.stderr.write(f"Current git branch is: {current_branch}\n")
336
-
# Pass global OWNER and REPO which are set by set_repo_url_standalone
0 commit comments