Fix `rbt api-get` with repo-based server detection.

Review Request #13101 — Created June 6, 2023 and submitted

Information

RBTools
release-4.x

Reviewers

A user reported that the api-get command was failing with an error
attempting to run without explicitly listing the server name in the
command-line arguments or .reviewboardrc. In this case, they were
using the reviewboard.url perforce counter to define the server name
for their repository.

When there's no explicit server name configured, we will initialize the
repository client(s) in order to use them to detect the server name.
Unfortunately, the api-get command didn't include the repository
command-line arguments (because why would it), and the code path that
does this was assuming that it existed.

This change fixes it so we only conditionally look for the value of the
--repository-type argument inside the argparse results. If not found,
we'll then proceed through our normal repository detection code.

Set up a perforce server that defined the reviewboard.url counter, and
then ran rbt api-get users from within a perforce client. Saw that it
correctly determined my Review Board host to use, rather than crashing
with an AttributeError.

Summary ID
Fix `rbt api-get` with repo-based server detection.
A user reported that the `api-get` command was failing with an error attempting to run without explicitly listing the server name in the command-line arguments or `.reviewboardrc`. In this case, they were using the `reviewboard.url` perforce counter to define the server name for their repository. When there's no explicit server name configured, we will initialize the repository client(s) in order to use them to detect the server name. Unfortunately, the `api-get` command didn't include the repository command-line arguments (because why would it), and the code path that does this was assuming that it existed. This change fixes it so we only conditionally look for the value of the --repository-type argument inside the argparse results. If not found, we'll then proceed through our normal repository detection code. Testing Done: Set up a perforce server that defined the `reviewboard.url` counter, and then ran `rbt api-get users` from within a perforce client. Saw that it correctly determined my Review Board host to use, rather than crashing with an AttributeError.
c5205fd6999822337e5d8c9824b67af3239cacad
chipx86
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.x (fb5c0d9)