[Qt-creator] REST support in Gerrit dialog

Tobias Hunger Tobias.Hunger at qt.io
Thu Feb 16 14:13:29 CET 2017


On Wed, 2017-02-15 at 12:26 +0200, Orgad Shaneh wrote:
> Hi,
> 
> The Gerrit dialog was improved recently, and it now connects to the
> remote[s] according to the origin url of the active repository. This
> currently supports SSH remotes only.
> 
> I'd like to add support for querying using gerrit's REST API in the Gerrit
> dialog.
> 
> This has the following advantages:
> 
>    - It is typically faster than SSH
>    - It is typically *not* blocked by firewalls
>    - It is more advanced (we can get more data than by ssh query)
>    - Some servers (like gerrit-review.googlesource.com) support *only* HTTP

Sounds nice:-)

> In order to use REST, the user must generate HTTP password in gerrit's
> preferences, and configure it locally.
> 
>    - On linux, ~/.netrc should contain a line like:
>    machine codereview.qt-project.org login <username> password <password>
>    - On Git for Windows it's similar, but the file is named ~/_netrc. In
>    addition, if git is configured to use the Git Credentials Manager, then the
>    user will be asked for the credentials on first connection to the server
>    using Git (usually on git fetch).
>    - On macOS I have no idea, but it's likely to be similar to linux (macOS
>    users, please approve).
> 
> Apart from that, Gerrit uses Digest authentication by default, but can be
> configured to use Basic auth (for example, to enable LDAP authentication).
> 
> Now, since this is not a trivial task user-wise, I'd like to hear your
> opinions.
> 
>    1. Should Qt Creator ask for the user's credentials and configure them
>    automatically (if they're not present in .netrc)?

Yes.

>    2. Does it make sense to have some kind of a wizard when a new server is
>    discovered, to guide the user through generating the password etc.?

Yes.

>    3. When should we test (and configure if needed) the connection to the
>    server?
>       1. Right when the user chooses the server?
>       2. When hitting the "Refresh"  button?
>       3. Add a new button for that, next to the remotes list?

1) makes the most sense to me.

>    4. Where/how do we store the list of "supported" servers? What I
>    currently have in mind is Qtc configuration, in sections like
>    GitServers/<host>/GerritRest = 1 etc.

Can't you try to connect using REST on first connect and then cache that
information going forward?

>    5. Is it ok to use curl on all platforms, or do we have a reliable Qt
>    HTTP transport, which supports Basic/Digest authentications (gerrit uses
>    Digest by default, but can be configured for Basic)?

Qt has no support for HTTP? That would be surprising:-) But I admit I never
tried.

Best Regards,
Tobias

-- 
Tobias Hunger, Senior Software Engineer | The Qt Company
The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Mika Harjuaho. Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B


More information about the Qt-creator mailing list