Fix `rbt api-get` with repo-based server detection.
Review Request #13101 — Created June 6, 2023 and submitted — Latest diff uploaded
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 thereviewboard.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, theapi-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 ranrbt 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.