Merge "ChangeScreen2: Show rename/copy source paths in file table"
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt
index 8428a74..631fe48 100644
--- a/Documentation/config-gerrit.txt
+++ b/Documentation/config-gerrit.txt
@@ -1378,6 +1378,12 @@
Code Review's own bug tracker but could be directed to the system
administrator's ticket queue.
+[[gerrit.reportBugText]]gerrit.reportBugText::
++
+Text to be displayed in the link to the bug report URL.
++
+Defaults to "Report Bug".
+
[[gerrit.changeScreen]]gerrit.changeScreen::
+
Default change screen UI to direct users to. Valid values are
diff --git a/Documentation/dev-readme.txt b/Documentation/dev-readme.txt
index d961f70..e73e039 100644
--- a/Documentation/dev-readme.txt
+++ b/Documentation/dev-readme.txt
@@ -61,7 +61,7 @@
----
Accept defaults by pressing Enter until 'init' completes, or add
-the '\--batch' command line option to avoid them entirely. It is
+the '--batch' command line option to avoid them entirely. It is
recommended to change the listen addresses from '*' to 'localhost' to
prevent outside connections from contacting the development instance.
diff --git a/Documentation/install-quick.txt b/Documentation/install-quick.txt
index 741de35..de17abd 100644
--- a/Documentation/install-quick.txt
+++ b/Documentation/install-quick.txt
@@ -28,14 +28,14 @@
----
$ java -version
- java version "1.6.0_26"
- Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
- Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)
+ java version "1.7.0_21"
+ Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
+ Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
----
If Java isn't installed, get it:
-* JDK, minimum version 1.6 http://www.oracle.com/technetwork/java/javase/downloads/index.html[Download]
+* JDK, minimum version 1.7 http://www.oracle.com/technetwork/java/javase/downloads/index.html[Download]
[[user]]
diff --git a/Documentation/install.txt b/Documentation/install.txt
index 8e836f8..cbd9965 100644
--- a/Documentation/install.txt
+++ b/Documentation/install.txt
@@ -7,7 +7,7 @@
To run the Gerrit service, the following requirements must be met on
the host:
-* JDK, minimum version 1.6 http://www.oracle.com/technetwork/java/javase/downloads/index.html[Download]
+* JDK, minimum version 1.7 http://www.oracle.com/technetwork/java/javase/downloads/index.html[Download]
You'll also need an SQL database to house the review metadata. You have the
choice of either using the embedded H2 or to host your own MySQL or PostgreSQL.
diff --git a/Documentation/pgm-LocalUsernamesToLowerCase.txt b/Documentation/pgm-LocalUsernamesToLowerCase.txt
index bac3dc0..cd16617 100644
--- a/Documentation/pgm-LocalUsernamesToLowerCase.txt
+++ b/Documentation/pgm-LocalUsernamesToLowerCase.txt
@@ -38,11 +38,11 @@
-------
-d::
-\--site-path::
+--site-path::
Location of the gerrit.config file, and all other per-site
configuration data, supporting libraries and log files.
-\--threads::
+--threads::
Number of threads to perform the scan work with. Defaults to
twice the number of CPUs available.
diff --git a/Documentation/pgm-daemon.txt b/Documentation/pgm-daemon.txt
index 19743a5..5a43bbc 100644
--- a/Documentation/pgm-daemon.txt
+++ b/Documentation/pgm-daemon.txt
@@ -10,12 +10,12 @@
--
'java' -jar gerrit.war 'daemon'
-d <SITE_PATH>
- [\--enable-httpd | \--disable-httpd]
- [\--enable-sshd | \--disable-sshd]
- [\--console-log]
- [\--slave]
- [\--headless]
- [\--init]
+ [--enable-httpd | --disable-httpd]
+ [--enable-sshd | --disable-sshd]
+ [--console-log]
+ [--slave]
+ [--headless]
+ [--init]
[-s]
--
@@ -35,42 +35,42 @@
-------
-d::
-\--site-path::
+--site-path::
Location of the gerrit.config file, and all other per-site
configuration data, supporting libraries and log files.
-\--enable-httpd::
-\--disable-httpd::
+--enable-httpd::
+--disable-httpd::
Enable (or disable) the internal HTTP daemon, answering
web requests. Enabled by default.
-\--enable-sshd::
-\--disable-sshd::
+--enable-sshd::
+--disable-sshd::
Enable (or disable) the internal SSH daemon, answering SSH
clients and remotely executed commands. Enabled by default.
-\--slave::
+--slave::
Run in slave mode, permitting only read operations
by clients. Commands which modify state such as
link:cmd-receive-pack.html[receive-pack] (creates new changes
or updates existing ones) or link:cmd-review.html[review]
(sets approve marks) are disabled.
+
-This option automatically implies '\--disable-httpd \--enable-sshd'.
+This option automatically implies '--disable-httpd --enable-sshd'.
-\--console-log::
+--console-log::
Send log messages to the console, instead of to the standard
log file '$site_path/logs/error_log'.
-\--headless::
+--headless::
Don't start the default Gerrit UI. May be useful when Gerrit is
run with an alternative UI.
-\--init::
+--init::
Run init before starting the daemon. This will create a new site or
upgrade an existing site.
-\--s::
+--s::
Start link:dev-inspector.html[Gerrit Inspector] on the console, a
built-in interactive inspection environment to assist debugging and
troubleshooting of Gerrit code.
diff --git a/Documentation/pgm-gsql.txt b/Documentation/pgm-gsql.txt
index 0f9e5e4..a22880d 100644
--- a/Documentation/pgm-gsql.txt
+++ b/Documentation/pgm-gsql.txt
@@ -25,7 +25,7 @@
-------
-d::
-\--site-path::
+--site-path::
Location of the gerrit.config file, and all other per-site
configuration data, supporting libraries and log files.
diff --git a/Documentation/pgm-init.txt b/Documentation/pgm-init.txt
index 78e2e33..07ca154 100644
--- a/Documentation/pgm-init.txt
+++ b/Documentation/pgm-init.txt
@@ -10,10 +10,10 @@
--
'java' -jar gerrit.war 'init'
-d <SITE_PATH>
- [\--batch]
- [\--no-auto-start]
- [\--list-plugins]
- [\--install-plugin=<PLUGIN_NAME>]
+ [--batch]
+ [--no-auto-start]
+ [--list-plugins]
+ [--install-plugin=<PLUGIN_NAME>]
--
DESCRIPTION
@@ -27,7 +27,7 @@
OPTIONS
-------
-\--batch::
+--batch::
Run in batch mode, skipping interactive prompts. Reasonable
configuration defaults are chosen based on the whims of
the Gerrit developers.
@@ -37,22 +37,24 @@
SQL statements to drop these objects is provided. To drop the unused
objects these SQL statements have to be executed manually.
-\--no-auto-start::
+--no-auto-start::
Don't automatically start the daemon after initializing a
newly created site path. This permits the administrator
to inspect and modify the configuration before the daemon
is started.
-d::
-\--site-path::
+--site-path::
Location of the gerrit.config file, and all other per-site
configuration data, supporting libraries and log files.
-\--list-plugins::
+--list-plugins::
Print names of plugins that can be installed during init process.
-\--install-plugin:
+--install-plugin:
Automatically install plugin with given name without asking.
+ This option may be supplied more than once to install multiple
+ plugins.
CONTEXT
-------
diff --git a/ReleaseNotes/ReleaseNotes-2.8.1.txt b/ReleaseNotes/ReleaseNotes-2.8.1.txt
index 522e5ce..13762e3 100644
--- a/ReleaseNotes/ReleaseNotes-2.8.1.txt
+++ b/ReleaseNotes/ReleaseNotes-2.8.1.txt
@@ -14,3 +14,18 @@
* Fix plugin API packaging. Parts from JGit signed library were included in the
plugin API. As a consequence unit tests were failing to execute against it.
+
+* Fix IllegalArgumentException in task queue comparator.
++
+This could happen if you have a long queue and the state of a task (DONE, CANCELLED,
+RUNNING, READY, SLEEPING, OTHER) changes while the sorting is ongoing.
+
+* Delegate to the filters for init and destroy phases in AllRequestFilter.
++
+This fixes a bug that prevented javamelody from working properly.
+
+* Fix ArrayOutOfBoundsException on initial commits.
++
+This happened if a new patch set was given for an initial commit in a repository.
+
+* Enable syntax highlighting for CXX, HXX, Python, Go, BUCK and .gitmodules.
diff --git a/ReleaseNotes/ReleaseNotes-2.8.txt b/ReleaseNotes/ReleaseNotes-2.8.txt
index b7b868b..418edf2 100644
--- a/ReleaseNotes/ReleaseNotes-2.8.txt
+++ b/ReleaseNotes/ReleaseNotes-2.8.txt
@@ -27,6 +27,24 @@
back to the old behavior, set the parameter `remote.NAME.createMissingRepositories`
in the `replication.config` file to `false`.
+*WARNING:* The deprecated `approve` alias for the
+link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.8/cmd-review.html[
+review] SSH command has been removed. This is important for all users
+of the Jenkins link:https://wiki.jenkins-ci.org/display/JENKINS/Gerrit+Trigger[
+Gerrit Trigger Plugin] since this plugin by default uses the `approve`
+command to vote and comment on changes in Gerrit. If you use the Gerrit
+Trigger Plugin, go to its global configuration in Jenkins and adapt the
+Gerrit commands to use the `review` command instead of the `approve`
+command.
+
+*WARNING:* The new change screen only displays download commands if the
+`download-commands` core plugin or any other plugin providing download
+commands is installed. The `download-commands` plugin provides the
+standard download schemes and commands. It is packaged together with
+Gerrit and can be installed during the
+link:https://gerrit-review.googlesource.com/Documentation/pgm-init.html[
+site initialization].
+
Release Highlights
------------------
@@ -571,6 +589,32 @@
* Allow usernames to begin with digit.
+* Verify access to source ref during add branch operation.
++
+Previously Gerrit didn't check access to source ref during add branch
+operation. Because of that users could create a branch from any known
+commit SHA1, even when they didn't have access to that commit.
+
+* Fix Gerrit API sources JAR contents.
++
+The gerrit-extension-api-X.Y-all-sources.jar did not actually contain any
+sources.
+
+* Generate javadoc for Gerrit Extension and Plugin APIs.
+
+* link:https://code.google.com/p/gerrit/issues/detail?id=2244[Issue 2244]:
+Update patch status before skipping duplicate emails.
+
+* link:https://code.google.com/p/gerrit/issues/detail?id=1640[Issue 1640]:
+Catch missing LDAP accounts in group membership.
+
+* Use `rev-parse` to find gitdir when generating commit-msg hook hint.
+
+* Performance Fix: Minimize number of advertisedHaves.
++
+By filtering the refs before the objectIds are added to advertisedHaves,
+lots of time can be saved when pushing to complex Gits.
+
Configuration
~~~~~~~~~~~~~
@@ -595,6 +639,8 @@
* Do not override error and gc logging configuration provided by the
`-Dlog4j.configuration` parameter.
+* Fix JdbcSQLException when numbers are read from cache.
+
Web UI
~~~~~~
@@ -614,6 +660,12 @@
* Display "Working..." when header is hidden.
+* link:https://code.google.com/p/gerrit/issues/detail?id=2125[Issue 2125]:
+Correctly shows '-1' instead of '1' for label score.
++
+If a user voted '-1', and then another user voted '+1' for a label, the
+label was shown as a red '1' in the change list instead of red '-1'.
+
Change Screens
^^^^^^^^^^^^^^
@@ -635,6 +687,24 @@
In this case, it makes more sense for the message to say "Uploaded
patch set N" instead.
+* Make links appear with consistent colors.
+
+* Prevent duplicate permitted_labels from being shown in labels list.
+
+Diff Screens
+^^^^^^^^^^^^
+
+
+* link:https://code.google.com/p/gerrit/issues/detail?id=1233[Issue 1233]:
+Prevent expansion when whole file isn't loaded.
+
+* link:https://code.google.com/p/gerrit/issues/detail?id=2122[Issue 2122]:
+Show review comments for unchanged files.
++
+When comparing patch sets and some comment was put in one side,
+that comment was not shown if there was no code changed between
+the two patch sets
+
Project Screens
^^^^^^^^^^^^^^^
@@ -708,6 +778,8 @@
The API is simplified in the sense that one Event now corresponds to
one ref update only.
+* Make plugin servlet's context path authorization aware.
+
Review Notes
^^^^^^^^^^^^
@@ -723,6 +795,8 @@
* Create review note also when newObjectId already present in another branch.
+* Correct documentation of the export command.
+
Emails
~~~~~~
@@ -751,6 +825,9 @@
* Various spelling mistakes are corrected in the documentation and previous
release notes.
+* link:https://code.google.com/p/gerrit/issues/detail?id=2144[Issue 2144]:
+Documentation of the query operator is fixed.
+
Upgrades
--------
@@ -762,6 +839,9 @@
* Update H2 to 1.3.173
* Update bouncycastle to 1.44
* Update Apache Mina to 2.0.7
-* Update Apache SSHD to 0.9.0.201311081
+* link:https://code.google.com/p/gerrit/issues/detail?id=2232[Issue 2232]:
+Update Apache SSHD to 0.9.0.201311081
* asciidoctor 0.1.4 is now required to build the documentation
* jsr305 library was removed
+* link:https://code.google.com/p/gerrit/issues/detail?id=2232[Issue 2232]:
+Update Jsch to 1.5.0
diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/AccountInfoCache.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/AccountInfoCache.java
index 95e7587..042d08d 100644
--- a/gerrit-common/src/main/java/com/google/gerrit/common/data/AccountInfoCache.java
+++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/AccountInfoCache.java
@@ -20,7 +20,7 @@
import java.util.HashMap;
import java.util.Map;
-/** In-memory table of {@link AccountInfo}, indexed by {@link Account.Id}. */
+/** In-memory table of {@link AccountInfo}, indexed by {@code Account.Id}. */
public class AccountInfoCache {
private static final AccountInfoCache EMPTY;
static {
diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java
index df4e861..38afaab 100644
--- a/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java
+++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java
@@ -32,6 +32,7 @@
protected String switchAccountUrl;
protected String httpPasswordUrl;
protected String reportBugUrl;
+ protected String reportBugText;
protected boolean gitBasicAuth;
protected GitwebConfig gitweb;
@@ -103,6 +104,14 @@
reportBugUrl = u;
}
+ public String getReportBugText() {
+ return reportBugText;
+ }
+
+ public void setReportBugText(String t) {
+ reportBugText = t;
+ }
+
public boolean isGitBasicAuth() {
return gitBasicAuth;
}
diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/GroupInfoCache.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/GroupInfoCache.java
index 999428a..e177708 100644
--- a/gerrit-common/src/main/java/com/google/gerrit/common/data/GroupInfoCache.java
+++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/GroupInfoCache.java
@@ -20,7 +20,7 @@
import java.util.HashMap;
import java.util.Map;
-/** In-memory table of {@link GroupInfo}, indexed by {@link AccountGroup.Id}. */
+/** In-memory table of {@link GroupInfo}, indexed by {@code AccountGroup.Id}. */
public class GroupInfoCache {
private static final GroupInfoCache EMPTY;
static {
diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/safehtml/client/HighlightSuggestOracle.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/safehtml/client/HighlightSuggestOracle.java
index b8fbb8c..ed4e6cb 100644
--- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/safehtml/client/HighlightSuggestOracle.java
+++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/safehtml/client/HighlightSuggestOracle.java
@@ -23,8 +23,10 @@
* <p>
* Suggestions supplied by the implementation of
* {@link #onRequestSuggestions(Request, Callback)} are modified to wrap all
- * occurrences of the {@link SuggestOracle.Request#getQuery()} substring in HTML
- * {@code <strong>} tags, so they can be emphasized to the user.
+ * occurrences of the
+ * {@link com.google.gwt.user.client.ui.SuggestOracle.Request#getQuery()}
+ * substring in HTML {@code <strong>} tags, so they can be emphasized to
+ * the user.
*/
public abstract class HighlightSuggestOracle extends SuggestOracle {
private static String escape(String ds) {
@@ -57,9 +59,10 @@
}
/**
- * @return true if {@link SuggestOracle.Suggestion#getDisplayString()} returns
- * HTML; false if the text must be escaped before evaluating in an
- * HTML like context.
+ * @return true if
+ * {@link com.google.gwt.user.client.ui.SuggestOracle.Suggestion#getDisplayString()}
+ * returns HTML; false if the text must be escaped before evaluating
+ * in an HTML like context.
*/
protected boolean isHTML() {
return false;
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java
index f9acc8c..179adc2 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java
@@ -463,15 +463,15 @@
btmmenu.add(new InlineLabel(C.keyHelp()));
btmmenu.add(new InlineLabel(" | "));
btmmenu.add(new InlineHTML(M.poweredBy(vs)));
- if (getConfig().getReportBugUrl() != null) {
- Anchor a = new Anchor(
- C.reportBug(),
- getConfig().getReportBugUrl());
- a.setTarget("_blank");
- a.setStyleName("");
- btmmenu.add(new InlineLabel(" | "));
- btmmenu.add(a);
- }
+
+ final String reportBugText = getConfig().getReportBugText();
+ Anchor a = new Anchor(
+ reportBugText == null ? C.reportBug() : reportBugText,
+ getConfig().getReportBugUrl());
+ a.setTarget("_blank");
+ a.setStyleName("");
+ btmmenu.add(new InlineLabel(" | "));
+ btmmenu.add(a);
}
private void onModuleLoad2(HostPageData hpd) {
diff --git a/gerrit-gwtui/src/main/java/net/codemirror/lib/Loader.java b/gerrit-gwtui/src/main/java/net/codemirror/lib/Loader.java
index edf1664..e4ac7b1 100644
--- a/gerrit-gwtui/src/main/java/net/codemirror/lib/Loader.java
+++ b/gerrit-gwtui/src/main/java/net/codemirror/lib/Loader.java
@@ -95,6 +95,10 @@
km.remove(s);
}
CodeMirror.addKeyMap("vim_ro", km);
+ CodeMirror.mapVimKey("j", "gj");
+ CodeMirror.mapVimKey("k", "gk");
+ CodeMirror.mapVimKey("Down", "gj");
+ CodeMirror.mapVimKey("Up", "gk");
}
private static void error(Exception e) {
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/AllRequestFilter.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/AllRequestFilter.java
index c8d237c..3b48b65 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/AllRequestFilter.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/AllRequestFilter.java
@@ -69,10 +69,16 @@
@Override
public void init(FilterConfig config) throws ServletException {
+ for (AllRequestFilter f: filters) {
+ f.init(config);
+ }
}
@Override
public void destroy() {
+ for (AllRequestFilter f: filters) {
+ f.destroy();
+ }
}
}
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java
index 0cfdf0e..7f6a2df 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java
@@ -129,12 +129,10 @@
config.setLargeChangeSize(cfg.getInt("change", "largeChange", 500));
config.setNewFeatures(cfg.getBoolean("gerrit", "enableNewFeatures", true));
- config.setReportBugUrl(cfg.getString("gerrit", null, "reportBugUrl"));
- if (config.getReportBugUrl() == null) {
- config.setReportBugUrl("http://code.google.com/p/gerrit/issues/list");
- } else if (config.getReportBugUrl().isEmpty()) {
- config.setReportBugUrl(null);
- }
+ final String reportBugUrl = cfg.getString("gerrit", null, "reportBugUrl");
+ config.setReportBugUrl(reportBugUrl != null ?
+ reportBugUrl : "http://code.google.com/p/gerrit/issues/list");
+ config.setReportBugText(cfg.getString("gerrit", null, "reportBugText"));
config.setGitBasicAuth(authConfig.isGitBasicAuth());
diff --git a/gerrit-server/BUCK b/gerrit-server/BUCK
index 58ea18e..5e992cd9 100644
--- a/gerrit-server/BUCK
+++ b/gerrit-server/BUCK
@@ -2,10 +2,8 @@
'src/main/java/com/google/gerrit/server/documentation/Constants.java',
]
-SRCS = glob([
- 'src/main/java/**/*.java',
- 'src/test/java/com/google/gerrit/server/project/Util.java',
- ],
+SRCS = glob(
+ ['src/main/java/**/*.java'],
excludes = CONSTANTS_SRC,
)
RESOURCES = glob(['src/main/resources/**/*'])
@@ -80,7 +78,10 @@
visibility = ['PUBLIC'],
)
-TESTUTIL = glob(['src/test/java/com/google/gerrit/testutil/**/*.java'])
+TESTUTIL = glob([
+ 'src/test/java/com/google/gerrit/testutil/**/*.java',
+ 'src/test/java/com/google/gerrit/server/project/Util.java',
+ ])
java_library(
name = 'testutil',
srcs = TESTUTIL,
@@ -129,11 +130,13 @@
deps = [
':prolog_test_case',
':server',
+ ':testutil',
'//gerrit-common:server',
'//gerrit-reviewdb:server',
'//gerrit-server/src/main/prolog:common',
'//lib:gwtorm',
'//lib:junit',
+ '//lib/jgit:jgit',
'//lib/guice:guice',
'//lib/prolog:prolog-cafe',
],
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/DefaultFileExtensionRegistry.java b/gerrit-server/src/main/java/com/google/gerrit/server/DefaultFileExtensionRegistry.java
index 15062ac..bc41fea 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/DefaultFileExtensionRegistry.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/DefaultFileExtensionRegistry.java
@@ -30,12 +30,17 @@
private static final MimeType INI = newMimeType("text/x-ini", 2);
private static final MimeType PYTHON = newMimeType("text/x-python", 2);
- private static final ImmutableMap<String, MimeType> TYPES = ImmutableMap.of(
- ".gitmodules", INI,
- "project.config", INI,
- "BUCK", PYTHON,
- "defs", newMimeType(PYTHON.toString(), 1),
- "go", newMimeType("text/x-go", 1));
+ private static final ImmutableMap<String, MimeType> TYPES =
+ ImmutableMap.<String,MimeType>builder()
+ .put(".gitmodules", INI)
+ .put("project.config", INI)
+ .put("BUCK", PYTHON)
+ .put("defs", newMimeType(PYTHON.toString(), 1))
+ .put("py", newMimeType(PYTHON.toString(), 1))
+ .put("go", newMimeType("text/x-go", 1))
+ .put("cxx", newMimeType("text/x-c++src", 1))
+ .put("hxx", newMimeType("text/x-c++hdr", 1))
+ .build();
private static MimeType newMimeType(String type, final int specificity) {
return new MimeType(type) {
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/PatchSetInserter.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/PatchSetInserter.java
index 5302b65..b74c56c 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/PatchSetInserter.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/PatchSetInserter.java
@@ -365,8 +365,7 @@
public static ChangeKind getChangeKind(MergeUtil.Factory mergeUtilFactory, ProjectState project,
Repository git, RevCommit prior, RevCommit next) {
if (!next.getFullMessage().equals(prior.getFullMessage())) {
- if (next.getTree() == prior.getTree()
- && prior.getParent(0).equals(next.getParent(0))) {
+ if (next.getTree() == prior.getTree() && isSameParents(prior, next)) {
return ChangeKind.NO_CODE_CHANGE;
} else {
return ChangeKind.REWORK;
@@ -379,7 +378,7 @@
}
if (next.getTree() == prior.getTree() &&
- prior.getParent(0).equals(next.getParent(0))) {
+ isSameParents(prior, next)) {
return ChangeKind.TRIVIAL_REBASE;
}
@@ -404,6 +403,15 @@
}
}
+ private static boolean isSameParents(RevCommit prior, RevCommit next) {
+ if (prior.getParentCount() != next.getParentCount()) {
+ return false;
+ } else if (prior.getParentCount() == 0) {
+ return true;
+ }
+ return prior.getParent(0).equals(next.getParent(0));
+ }
+
public class ChangeModifiedException extends InvalidChangeOperationException {
private static final long serialVersionUID = 1L;
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/VersionedMetaData.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/VersionedMetaData.java
index 79ffb1f..0719c7d 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/VersionedMetaData.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/VersionedMetaData.java
@@ -71,18 +71,6 @@
return revision != null ? revision.copy() : null;
}
- /** Initialize in-memory as though the repository branch doesn't exist. */
- public void createInMemory() {
- try {
- revision = null;
- onLoad();
- } catch (IOException err) {
- throw new RuntimeException("Unexpected IOException", err);
- } catch (ConfigInvalidException err) {
- throw new RuntimeException("Unexpected ConfigInvalidException", err);
- }
- }
-
/**
* Load the current version from the branch.
* <p>
@@ -116,19 +104,13 @@
*/
public void load(Repository db, ObjectId id) throws IOException,
ConfigInvalidException {
- if (id != null) {
- reader = db.newObjectReader();
- try {
- revision = new RevWalk(reader).parseCommit(id);
- onLoad();
- } finally {
- reader.release();
- reader = null;
- }
- } else {
- // The branch does not yet exist.
- revision = null;
+ reader = db.newObjectReader();
+ try {
+ revision = id != null ? new RevWalk(reader).parseCommit(id) : null;
onLoad();
+ } finally {
+ reader.release();
+ reader = null;
}
}
diff --git a/gerrit-server/src/test/java/com/google/gerrit/rules/GerritCommonTest.java b/gerrit-server/src/test/java/com/google/gerrit/rules/GerritCommonTest.java
index 03a82d4..cf7ace2 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/rules/GerritCommonTest.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/rules/GerritCommonTest.java
@@ -15,19 +15,20 @@
package com.google.gerrit.rules;
import static com.google.gerrit.common.data.Permission.LABEL;
-import static com.google.gerrit.server.project.Util.value;
import static com.google.gerrit.server.project.Util.category;
import static com.google.gerrit.server.project.Util.grant;
+import static com.google.gerrit.server.project.Util.value;
-import com.google.gerrit.server.git.ProjectConfig;
-import com.google.gerrit.server.group.SystemGroupBackend;
-import com.google.gerrit.server.project.Util;
-import com.google.gerrit.server.util.TimeUtil;
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Project;
+import com.google.gerrit.server.git.ProjectConfig;
+import com.google.gerrit.server.group.SystemGroupBackend;
+import com.google.gerrit.server.project.Util;
+import com.google.gerrit.server.util.TimeUtil;
+import com.google.gerrit.testutil.InMemoryRepositoryManager;
import com.google.inject.AbstractModule;
import org.junit.Before;
@@ -67,7 +68,7 @@
});
local = new ProjectConfig(localKey);
- local.createInMemory();
+ local.load(InMemoryRepositoryManager.newRepository(localKey));
Q.setRefPatterns(Arrays.asList("refs/heads/develop"));
local.getLabelSections().put(V.getName(), V);
diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/git/SubmoduleOpTest.java b/gerrit-server/src/test/java/com/google/gerrit/server/git/SubmoduleOpTest.java
index b9e9a4c..dea4af8 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/server/git/SubmoduleOpTest.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/server/git/SubmoduleOpTest.java
@@ -828,7 +828,7 @@
* </p>
*
* @param gitModulesFileContent The .gitmodules file content.
- * @param mergedBranch The {@link Branch.NameKey} instance representing the
+ * @param mergedBranch The {@code Branch.NameKey} instance representing the
* project/branch the commit was merged.
* @param extractedSubscriptions The subscription rows extracted from
* gitmodules file.
@@ -854,7 +854,7 @@
* </p>
*
* @param gitModulesFileContent The .gitmodules file content.
- * @param mergedBranch The {@link Branch.NameKey} instance representing the
+ * @param mergedBranch The {@code Branch.NameKey} instance representing the
* project/branch the commit was merged.
* @param extractedSubscriptions The subscription rows extracted from
* gitmodules file.
diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/project/RefControlTest.java b/gerrit-server/src/test/java/com/google/gerrit/server/project/RefControlTest.java
index 94b0632..64ce398 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/server/project/RefControlTest.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/server/project/RefControlTest.java
@@ -27,6 +27,7 @@
import static com.google.gerrit.server.project.Util.DEVS;
import static com.google.gerrit.server.project.Util.doNotInherit;
import static com.google.gerrit.server.project.Util.grant;
+import static com.google.gerrit.testutil.InMemoryRepositoryManager.newRepository;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -61,7 +62,7 @@
@Before
public void setUp() throws Exception {
local = new ProjectConfig(localKey);
- local.createInMemory();
+ local.load(newRepository(localKey));
util.add(local);
}
@@ -157,14 +158,14 @@
}
@Test
- public void testInheritDuplicateSections() {
+ public void testInheritDuplicateSections() throws Exception {
grant(util.getParentConfig(), READ, ADMIN, "refs/*");
grant(local, READ, DEVS, "refs/heads/*");
local.getProject().setParentName(util.getParentConfig().getProject().getName());
assertTrue("a can read", util.user(local, "a", ADMIN).isVisible());
local = new ProjectConfig(new Project.NameKey("local"));
- local.createInMemory();
+ local.load(newRepository(localKey));
grant(local, READ, DEVS, "refs/*");
assertTrue("d can read", util.user(local, "d", DEVS).isVisible());
}
diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/project/Util.java b/gerrit-server/src/test/java/com/google/gerrit/server/project/Util.java
index 3d1df7a..ec83824 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/server/project/Util.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/server/project/Util.java
@@ -41,10 +41,13 @@
import com.google.gerrit.server.config.SitePaths;
import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.git.ProjectConfig;
+import com.google.gerrit.testutil.InMemoryRepositoryManager;
import com.google.inject.Guice;
import com.google.inject.Injector;
+import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.lib.Config;
+import org.eclipse.jgit.lib.Repository;
import java.io.IOException;
import java.util.ArrayList;
@@ -116,16 +119,22 @@
private final ProjectCache projectCache;
private final CapabilityControl.Factory capabilityControlFactory;
private final PermissionCollection.Factory sectionSorter;
+ private final GitRepositoryManager repoManager;
private final AllProjectsName allProjectsName = new AllProjectsName("parent");
private final ProjectConfig parent = new ProjectConfig(allProjectsName);
public Util() {
all = new HashMap<Project.NameKey, ProjectState>();
- parent.createInMemory();
- parent.getLabelSections().put(CR.getName(), CR);
-
- add(parent);
+ repoManager = new InMemoryRepositoryManager();
+ try {
+ Repository repo = repoManager.createRepository(allProjectsName);
+ parent.load(repo);
+ parent.getLabelSections().put(CR.getName(), CR);
+ add(parent);
+ } catch (IOException | ConfigInvalidException e) {
+ throw new RuntimeException(e);
+ }
projectCache = new ProjectCache() {
@Override
@@ -199,15 +208,19 @@
public void add(ProjectConfig pc) {
PrologEnvironment.Factory envFactory = null;
- GitRepositoryManager mgr = null;
ProjectControl.AssistedFactory projectControlFactory = null;
RulesCache rulesCache = null;
SitePaths sitePaths = null;
List<CommentLinkInfo> commentLinks = null;
+ try {
+ repoManager.createRepository(pc.getProject().getNameKey());
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
all.put(pc.getProject().getNameKey(), new ProjectState(sitePaths,
- projectCache, allProjectsName, projectControlFactory, envFactory, mgr,
- rulesCache, commentLinks, pc));
+ projectCache, allProjectsName, projectControlFactory, envFactory,
+ repoManager, rulesCache, commentLinks, pc));
}
public ProjectControl user(ProjectConfig local, AccountGroup.UUID... memberOf) {
diff --git a/gerrit-server/src/test/java/com/google/gerrit/testutil/InMemoryRepositoryManager.java b/gerrit-server/src/test/java/com/google/gerrit/testutil/InMemoryRepositoryManager.java
index c6626f0..328df75 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/testutil/InMemoryRepositoryManager.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/testutil/InMemoryRepositoryManager.java
@@ -31,6 +31,10 @@
/** Repository manager that uses in-memory repositories. */
public class InMemoryRepositoryManager implements GitRepositoryManager {
+ public static InMemoryRepository newRepository(Project.NameKey name) {
+ return new Repo(name);
+ }
+
private static class Description extends DfsRepositoryDescription {
private String desc;