DESCRIPTION

Auto-configure Gerrit configuration if repository is cloned from Gerrit

If a repository is cloned over http or https protocol use Gerrit's
REST API endpoint "Get Version" [1] to find out if the repository is
hosted by a Gerrit server.

Implement a shortcut for https and ssh endpoint of the Eclipse Gerrit
server.

If we detect the repository was cloned from a Gerrit server auto
configure the repository for Gerrit. Configure the push refspec to
HEAD:refs/for/master which should be ok in most cases.

[1] https://gerrit-documentation.storage.googleapis.com/Documentation/2.11/rest-api-config.html#get-version

Bug: 460423
Change-Id: I30b916e279e0bc84f86abbffae241f8aab3fa8df
Signed-off-by: Douglas Trujillo xxx@xxx.xxx
Also-by: Jayvion Booth xxx@xxx.xxx


COMMENTS

author: Douglas Trujillo
date: 2015-02-26 10:15:29.000000000

Uploaded patch set 10.

-------------------------------------
author: Brenden Conley
date: 2015-02-26 10:15:36.000000000

Patch Set 10:

Build Started https://hudson.eclipse.org/egit/job/egit-stable.gerrit/650/

-------------------------------------
author: Douglas Trujillo
date: 2015-02-26 10:16:23.000000000

Patch Set 10: Code-Review+1

added timeout for remote operations

-------------------------------------
author: Brenden Conley
date: 2015-02-26 10:31:59.000000000

Patch Set 10: Verified+1

Build Successful 

https://hudson.eclipse.org/egit/job/egit-stable.gerrit/650/ : temporary update site https://hudson.eclipse.org/egit/job/egit-stable.gerrit/${BUILD_NUMBER}/artifact/org.eclipse.egit.repository/target/repository/

-------------------------------------
author: Jayvion Booth
date: 2015-02-26 10:35:59.000000000

Patch Set 10:

(1 comment)

Line:137, org.eclipse.egit.core/src/org/eclipse/egit/core/op/ConfigureGerritAfterCloneTask.java -> 1000 * seconds? Isn't that too much? What is the default timeout?
Or is the timeout javadoc wrong and it must be milliseconds?

-------------------------------------
author: Douglas Trujillo
date: 2015-02-26 11:26:04.000000000

Patch Set 10:

(1 comment)

Line:137, org.eclipse.egit.core/src/org/eclipse/egit/core/op/ConfigureGerritAfterCloneTask.java -> we store timeout in preferences in seconds and HttURLConnection wants it in milliseconds hence we have to multiply by 1000 here. Default is 30 sec and timeout can be adjusted in EGit preferences.

-------------------------------------
author: Jayvion Booth
date: 2015-02-26 11:39:31.000000000

Patch Set 10:

(1 comment)

Line:71, org.eclipse.egit.core/src/org/eclipse/egit/core/op/ConfigureGerritAfterCloneTask.java -> Javadoc must be fixed - timeout is in *milli*seconds, see comments below.

-------------------------------------
author: Douglas Trujillo
date: 2015-02-26 11:48:13.000000000

Patch Set 10:

(1 comment)

Line:71, org.eclipse.egit.core/src/org/eclipse/egit/core/op/ConfigureGerritAfterCloneTask.java -> so you want me to move the multiplication by 1000 to the caller ?

-------------------------------------
author: Jayvion Booth
date: 2015-02-26 12:02:59.000000000

Patch Set 10:

(1 comment)

Line:71, org.eclipse.egit.core/src/org/eclipse/egit/core/op/ConfigureGerritAfterCloneTask.java -> Initially it was not clear for me that code below uses milliseconds, because code above says that incoming value is in seconds, so multiplication seem to be redundant or even dangerous for me.

So *if* the incoming value is in milliseconds I would let the multiplication at same place as it today BUT the javadoc above should be fixed because javadoc and code are not consistent regarding units.

-------------------------------------
author: Douglas Trujillo
date: 2015-02-26 12:19:32.000000000

Patch Set 10:

(1 comment)

Line:71, org.eclipse.egit.core/src/org/eclipse/egit/core/op/ConfigureGerritAfterCloneTask.java -> the incoming value is in seconds, we also store the timeout in EGit preferences in seconds, hence javadoc says timeout is in seconds.

HTTPURL Connection.setReadTimeout() wants the timeout in milliseconds so I multiply the value which was passed to the constructor ConfigureGerritAfterCloneTask() e.g. 30 (sec) by 1000 to yield 30000 (ms) for HTTPURLConnection which wants milliseconds.

-------------------------------------
author: Jayvion Booth
date: 2015-02-26 12:29:56.000000000

Patch Set 10: Code-Review+1

> HTTPURL Connection.setReadTimeout() wants the timeout in milliseconds

OK, now I've got it. Somehow I've got that it expects *seconds*. Sorry for the noise.

-------------------------------------
author: Douglas Trujillo
date: 2015-02-26 13:08:36.000000000

Patch Set 10: Code-Review+2

-------------------------------------
author: Douglas Trujillo
date: 2015-02-26 13:08:42.000000000

Change has been successfully merged into the git repository.

-------------------------------------
