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. fast-forwarded to the change.
When Gerrit tries to do a merge, by default the merge will only When Gerrit tries to do a merge, by default the merge will only
succeed if there is no path conflict. By selecting the checkbox succeed if there is no path conflict. A path conflict occurs when
`Automatically resolve conflicts` Gerrit will try do a content merge the same file has also been changed on the other side of the merge.
if a path conflict occurs.
If `Automatically resolve conflicts` is enabled, Gerrit will try
to do a content merge when a path conflict occurs.
Registering Additional Branches Registering Additional Branches

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -14,6 +14,7 @@
package com.google.gerrit.pgm.init; package com.google.gerrit.pgm.init;
import com.google.common.base.Strings;
import com.google.gerrit.server.config.GerritServerConfig; import com.google.gerrit.server.config.GerritServerConfig;
import com.google.inject.Inject; import com.google.inject.Inject;
@@ -42,7 +43,6 @@ public class Browser {
if (url == null) { if (url == null) {
return; return;
} }
if (url.startsWith("proxy-")) { if (url.startsWith("proxy-")) {
url = url.substring("proxy-".length()); url = url.substring("proxy-".length());
} }
@@ -54,15 +54,19 @@ public class Browser {
System.err.println("error: invalid httpd.listenUrl: " + url); System.err.println("error: invalid httpd.listenUrl: " + url);
return; return;
} }
final String hostname = uri.getHost(); waitForServer(uri);
final int port = InitUtil.portOf(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(); System.err.flush();
for (;;) { for (;;) {
final Socket s; Socket s;
try { try {
s = new Socket(hostname, port); s = new Socket(host, port);
} catch (IOException e) { } catch (IOException e) {
try { try {
Thread.sleep(100); Thread.sleep(100);
@@ -74,18 +78,33 @@ public class Browser {
break; break;
} }
System.err.println("OK"); System.err.println("OK");
}
url = cfg.getString("gerrit", null, "canonicalWebUrl"); private String resolveUrl(URI uri, String link) {
if (url == null || url.isEmpty()) { String url = cfg.getString("gerrit", null, "canonicalWebUrl");
if (Strings.isNullOrEmpty(url)) {
url = uri.toString(); url = uri.toString();
} }
if (!url.endsWith("/")) { if (!url.endsWith("/")) {
url += "/"; url += "/";
} }
if (link != null && !link.isEmpty()) { if (!Strings.isNullOrEmpty(link)) {
url += "#" + link; url += "#" + link;
} }
System.err.println("Opening browser ..."); return url;
org.h2.tools.Server.openBrowser(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 { class JDBCInitializer implements DatabaseConfigInitializer {
@Override @Override
public void initConfig(Section database) { public void initConfig(Section database) {
boolean hasUrl = Strings.emptyToNull(database.get("url")) != null;
database.string("URL", "url", null); database.string("URL", "url", null);
guessDriver(database); guessDriver(database);
database.string("Driver class name", "driver", null); 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"); database.password("username", "password");
} }

View File

@@ -38,10 +38,8 @@ log4j.logger.eu.medsea.mimeutil=WARN
# Silence non-critical messages from openid4java # Silence non-critical messages from openid4java
# #
log4j.logger.org.apache.http=WARN
log4j.logger.org.apache.xml=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=WARN
log4j.logger.org.openid4java.consumer.ConsumerManager=FATAL log4j.logger.org.openid4java.consumer.ConsumerManager=FATAL
log4j.logger.org.openid4java.discovery.Discovery=ERROR log4j.logger.org.openid4java.discovery.Discovery=ERROR

View File

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

11
pom.xml
View File

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