Merge branch 'stable-2.7'

* stable-2.7:
  Bump openid4java dependency to 0.9.8
  Provide direct link to REST API documentation
  init: Gracefully handle missing browser
  Improve explanation of path conflicts in project config doc
  init: Don't set username on upgrade if database.type is JDBC

Change-Id: Ia48eb8428588b598cb10a9ed1d4079a6abf42580
This commit is contained in:
Shawn Pearce
2013-05-14 16:23:51 -07:00
11 changed files with 63 additions and 57 deletions

View File

@@ -108,9 +108,11 @@ then the change is automatically rebased and then the branch is
fast-forwarded to the change.
When Gerrit tries to do a merge, by default the merge will only
succeed if there is no path conflict. By selecting the checkbox
`Automatically resolve conflicts` Gerrit will try do a content merge
if a path conflict occurs.
succeed if there is no path conflict. A path conflict occurs when
the same file has also been changed on the other side of the merge.
If `Automatically resolve conflicts` is enabled, Gerrit will try
to do a content merge when a path conflict occurs.
Registering Additional Branches

View File

@@ -14,7 +14,7 @@ java_test(
'//lib:h2',
'//lib:junit',
'//lib/jgit:junit',
'//lib/openid:http-client',
'//lib/openid:httpclient',
],
source_under_test = TEST,
labels = ['slow'],

View File

@@ -688,6 +688,7 @@ public class Gerrit implements EntryPoint {
addDocLink(m, C.menuDocumentationSearch(), "user-search.html");
addDocLink(m, C.menuDocumentationUpload(), "user-upload.html");
addDocLink(m, C.menuDocumentationAccess(), "access-control.html");
addDocLink(m, C.menuDocumentationAPI(), "rest-api.html");
menuLeft.add(m, C.menuDocumentation());
}

View File

@@ -88,6 +88,7 @@ public interface GerritConstants extends Constants {
String menuDocumentationSearch();
String menuDocumentationUpload();
String menuDocumentationAccess();
String menuDocumentationAPI();
String searchHint();
String searchButton();

View File

@@ -71,6 +71,7 @@ menuDocumentationIndex = Index
menuDocumentationSearch = Searching
menuDocumentationUpload = Uploading
menuDocumentationAccess = Access Controls
menuDocumentationAPI = REST API
searchHint = Change #, SHA-1, tr:id or owner:email
searchButton = Search

View File

@@ -51,8 +51,7 @@ limitations under the License.
<dependency>
<groupId>org.openid4java</groupId>
<artifactId>openid4java-consumer</artifactId>
<type>pom</type>
<artifactId>openid4java</artifactId>
</dependency>
<dependency>

View File

@@ -14,6 +14,7 @@
package com.google.gerrit.pgm.init;
import com.google.common.base.Strings;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.inject.Inject;
@@ -42,7 +43,6 @@ public class Browser {
if (url == null) {
return;
}
if (url.startsWith("proxy-")) {
url = url.substring("proxy-".length());
}
@@ -54,15 +54,19 @@ public class Browser {
System.err.println("error: invalid httpd.listenUrl: " + url);
return;
}
final String hostname = uri.getHost();
final int port = InitUtil.portOf(uri);
waitForServer(uri);
openBrowser(uri, link);
}
System.err.print("Waiting for server to start ... ");
private void waitForServer(URI uri) throws IOException {
String host = uri.getHost();
int port = InitUtil.portOf(uri);
System.err.format("Waiting for server on %s:%d ... ", host, port);
System.err.flush();
for (;;) {
final Socket s;
Socket s;
try {
s = new Socket(hostname, port);
s = new Socket(host, port);
} catch (IOException e) {
try {
Thread.sleep(100);
@@ -74,18 +78,33 @@ public class Browser {
break;
}
System.err.println("OK");
}
url = cfg.getString("gerrit", null, "canonicalWebUrl");
if (url == null || url.isEmpty()) {
private String resolveUrl(URI uri, String link) {
String url = cfg.getString("gerrit", null, "canonicalWebUrl");
if (Strings.isNullOrEmpty(url)) {
url = uri.toString();
}
if (!url.endsWith("/")) {
url += "/";
}
if (link != null && !link.isEmpty()) {
if (!Strings.isNullOrEmpty(link)) {
url += "#" + link;
}
System.err.println("Opening browser ...");
org.h2.tools.Server.openBrowser(url);
return url;
}
private void openBrowser(URI uri, String link) {
String url = resolveUrl(uri, link);
System.err.format("Opening %s ...", url);
System.err.flush();
try {
org.h2.tools.Server.openBrowser(url);
System.err.println("OK");
} catch (Exception e) {
System.err.println("FAILED");
System.err.println("Open Gerrit with a JavaScript capable browser:");
System.err.println(" " + url);
}
}
}

View File

@@ -21,10 +21,11 @@ import com.google.common.base.Strings;
class JDBCInitializer implements DatabaseConfigInitializer {
@Override
public void initConfig(Section database) {
boolean hasUrl = Strings.emptyToNull(database.get("url")) != null;
database.string("URL", "url", null);
guessDriver(database);
database.string("Driver class name", "driver", null);
database.string("Database username", "username", username());
database.string("Database username", "username", hasUrl ? null : username());
database.password("username", "password");
}

View File

@@ -38,10 +38,8 @@ log4j.logger.eu.medsea.mimeutil=WARN
# Silence non-critical messages from openid4java
#
log4j.logger.org.apache.http=WARN
log4j.logger.org.apache.xml=WARN
log4j.logger.httpclient.wire=WARN
log4j.logger.org.apache.commons.httpclient=WARN
log4j.logger.org.apache.commons.httpclient.HttpMethodBase=ERROR
log4j.logger.org.openid4java=WARN
log4j.logger.org.openid4java.consumer.ConsumerManager=FATAL
log4j.logger.org.openid4java.discovery.Discovery=ERROR

View File

@@ -1,25 +1,18 @@
include_defs('//lib/maven.defs')
java_library(
name = 'consumer',
deps = [
':http-client',
':nekohtml',
':nodeps',
],
visibility = ['PUBLIC'],
)
maven_jar(
name = 'nodeps',
id = 'org.openid4java:openid4java-nodeps:0.9.6',
sha1 = '52ca394f5f6d38b78e35a5a6a0a341dc5b3aaf34',
name = 'consumer',
id = 'org.openid4java:openid4java:0.9.8',
sha1 = 'de4f1b33d3b0f0b2ab1d32834ec1190b39db4160',
license = 'Apache2.0',
deps = [
':httpclient',
':nekohtml',
':xerces',
'//lib/commons:logging',
'//lib/guice:guice',
],
visibility = [],
visibility = ['PUBLIC'],
)
maven_jar(
@@ -42,32 +35,30 @@ maven_jar(
)
maven_jar(
name = 'http-client',
id = 'org.apache.httpcomponents:httpclient:4.0',
sha1 = 'a76d7fd8033d48b4c67b4ccf159abb080c1059b6',
name = 'httpclient',
id = 'org.apache.httpcomponents:httpclient:4.1',
sha1 = '93cd011acb220de08b57d96106e5800d7097742b',
license = 'Apache2.0',
deps = [
':http-core',
':httpcore',
'//lib/commons:codec',
'//lib/commons:logging',
],
exclude = [
'META-INF/DEPENDENCIES',
'META-INF/LICENSE',
'META-INF/NOTICE',
'META-INF/LICENSE.txt',
'META-INF/NOTICE.txt',
],
visibility = ['//gerrit-acceptance-tests:'],
)
maven_jar(
name = 'http-core',
id = 'org.apache.httpcomponents:httpcore:4.0.1',
sha1 = 'e813b8722c387b22e1adccf7914729db09bcb4a9',
name = 'httpcore',
id = 'org.apache.httpcomponents:httpcore:4.1',
sha1 = '33fc26c02f8043ab0ede19eadc8c9885386b255c',
license = 'Apache2.0',
exclude = [
'META-INF/DEPENDENCIES',
'META-INF/LICENSE',
'META-INF/NOTICE',
'META-INF/LICENSE.txt',
'META-INF/NOTICE.txt',
],
visibility = [],
)

11
pom.xml
View File

@@ -526,9 +526,8 @@ limitations under the License.
<dependency>
<groupId>org.openid4java</groupId>
<artifactId>openid4java-consumer</artifactId>
<version>0.9.6</version>
<type>pom</type>
<artifactId>openid4java</artifactId>
<version>0.9.8</version>
<exclusions>
<exclusion>
<!-- conflicts with our use of guice 3.0 -->
@@ -574,12 +573,6 @@ limitations under the License.
<version>0.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>