Nicely print the web login URL when authenticating rbt post.
Review Request #14600 — Created Sept. 8, 2025 and submitted
In rbt post, a progress bar for commit validation starts up before we
know whether the client is authenticated or not. While the progress bar
is active, we'll prompt for auth credentials. When we prompt for web
login authentication, the "Please log in to the Review Board ..." line
gets printed onto the same line as the progress bar, since the cursor is
set by the bar who is not expected to deal with any external input/output.
When we prompt for username/password authentication, the line
gets printed onto the next line because we write a new line to STDOUT
before prompting for the credentials.This change makes the web login logs prettier by checking if a progress
bar is active and then logging a new line if so for the web-login flow.
We are using an internal attribute to check if a bar is active, since I
couldn't find any public API for this. This should be fine for our
purposes, if anything changes with that attribute then we'll just get the
ugly printing again.
Made sure things looked nice when using
rbt postand other commands
(rbt login,rbt status) when passing--web-loginand when using
username and password prompting.
| Summary | ID |
|---|---|
| bcbdd77bce4fac78a85eac5e32415cff9783b3a6 |
| Description | From | Last Updated |
|---|---|---|
|
The reason that's happened is most likely due to the following conditions: The progress bar is keeping the cursor position … |
|
|
|
Can we import at the top of the module, or does it need to be here? |
|
|
|
Seems like we could just import this as tqdm without the underscore. |
|
|
|
I realize I don't even need to do this weird import, I'll just import tqdm like we normally do. |
|
-
-
The reason that's happened is most likely due to the following conditions:
-
The progress bar is keeping the cursor position set within the bar, for the next chunk, expecting to own all input/output.
-
The "Please log in" is a standard print, so it starts at the cursor position.
-
The prompt is more special. I believe it takes care to ensure it's on its own line, and uses hints to notify the terminal that input is to be provided for this. It can use readline to handle this, which is likely what's managing that.
-
- Description:
-
In rbt post, a progress bar for commit validation starts up before we
know whether the client is authenticated or not. While the progress bar is active, we'll prompt for auth credentials. When we prompt for web ~ login authentication, for some reason the "Please log in to the Review ~ Board ..." line gets printed onto the same line as the progress bar. ~ However when we prompt for username/password authentication, the line ~ gets printed onto the next line (as it should). I couldn't exactly ~ figure out why these two differed, but this fixes that issue by checking ~ if a progress bar is active and then logging a new line if so for the ~ web-login flow. We are using an internal attribute to check if a bar is ~ active, since I couldn't find any public API for this. This should be ~ fine for our purposes, if anything changes with that attribute then ~ we'll just get the ugly printing again. ~ login authentication, the "Please log in to the Review Board ..." line ~ gets printed onto the same line as the progress bar, since the cursor is ~ set by the bar who is not expected to deal with any external input/output. ~ When we prompt for username/password authentication, the line ~ gets printed onto the next line because we write a new line to STDOUT ~ before prompting for the credentials. ~ ~ This change makes the web login logs prettier by checking if a progress
~ bar is active and then logging a new line if so for the web-login flow. ~ We are using an internal attribute to check if a bar is active, since I + couldn't find any public API for this. This should be fine for our + purposes, if anything changes with that attribute then we'll just get the + ugly printing again. - Commits:
-
Summary ID 1238f0ad60cf67b83a7ed4fa4355a5ce5fb77a10 62194eab65c4f4027b1789d6cb42f1fab545fce6 - Diff:
-
Revision 2 (+14)
Checks run (2 succeeded)
- Change Summary:
-
Have a better tqdm import.
- Commits:
-
Summary ID 62194eab65c4f4027b1789d6cb42f1fab545fce6 bcbdd77bce4fac78a85eac5e32415cff9783b3a6 - Diff:
-
Revision 3 (+14)