Merge branch 'stable-3.4' into 'stable-3.5'
* origin/stable-3.4:
Update git submodules
GitProtocolV2IT: Match trace output from newer git
Remove unused variable
Disable logging cache stats for new sites
init: Invoke reindex only once.
reindex: Print cache statistics only once at the end of program
Special char warning
Indicate soft hyphen in diff
Update git submodules
Update git submodules
Update git submodules
Update git submodules
Update git submodules
Bazel: Remove deprecated bazel-toolchain dependency
Change-Id: I392d67bff05d3833178a7a59cfd7443e364c4c63
diff --git a/Documentation/pgm-reindex.txt b/Documentation/pgm-reindex.txt
index 5392564..0653d8d 100644
--- a/Documentation/pgm-reindex.txt
+++ b/Documentation/pgm-reindex.txt
@@ -36,6 +36,10 @@
Reindex only index with given name. This option can be supplied
more than once to reindex multiple indices.
+--disable-cache-stats::
+ Disables printing cache statistics at the end of program to reduce
+ noise. Defaulted when reindex is run from init on a new site.
+
== CONTEXT
The secondary index must be enabled. See
link:config-gerrit.html#index.type[index.type].
diff --git a/WORKSPACE b/WORKSPACE
index 1a4d764..37f30b1 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -33,23 +33,13 @@
load("//tools:nongoogle.bzl", "declare_nongoogle_deps")
http_archive(
- name = "bazel_toolchains",
- sha256 = "1adf7a8e9901287c644dcf9ca08dd8d67a69df94bedbd57a841490a84dc1e9ed",
- strip_prefix = "bazel-toolchains-5.0.0",
- urls = [
- "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/v5.0.0.tar.gz",
- "https://github.com/bazelbuild/bazel-toolchains/archive/v5.0.0.tar.gz",
- ],
-)
-
-load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
-
-# Creates a default toolchain config for RBE.
-rbe_autoconfig(
name = "rbe_jdk11",
- bazel_version = "4.0.0",
- java_home = "/usr/lib/jvm/11.29.3-ca-jdk11.0.2/reduced",
- use_checked_in_confs = "Force",
+ sha256 = "766796de71916118e528b9f4334c29c9c9b4e926227bf3264dee555e6a4306c8",
+ strip_prefix = "rbe_autoconfig-2.0.0",
+ urls = [
+ "https://gerrit-bazel.storage.googleapis.com/rbe_autoconfig/v2.0.0.tar.gz",
+ "https://github.com/davido/rbe_autoconfig/archive/v2.0.0.tar.gz",
+ ],
)
http_archive(
diff --git a/java/com/google/gerrit/pgm/Init.java b/java/com/google/gerrit/pgm/Init.java
index 8c862cd..4c7b47b 100644
--- a/java/com/google/gerrit/pgm/Init.java
+++ b/java/com/google/gerrit/pgm/Init.java
@@ -18,6 +18,7 @@
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.gerrit.common.IoUtil;
import com.google.gerrit.common.PageLinks;
@@ -160,11 +161,13 @@
modules.add(new GerritServerConfigModule());
Guice.createInjector(modules).injectMembers(this);
if (!ReplicaUtil.isReplica(run.flags.cfg)) {
+ List<String> indicesToReindex = new ArrayList<>();
for (SchemaDefinitions<?> schemaDef : schemaDefs) {
if (!indexStatus.exists(schemaDef.getName())) {
- reindex(schemaDef);
+ indicesToReindex.add(schemaDef.getName());
}
}
+ reindex(indicesToReindex, run.flags.isNew);
}
start(run);
}
@@ -277,17 +280,23 @@
}
}
- private void reindex(SchemaDefinitions<?> schemaDef) throws Exception {
+ private void reindex(List<String> indices, boolean isNewSite) throws Exception {
+ if (indices.isEmpty()) {
+ return;
+ }
List<String> reindexArgs =
- ImmutableList.of(
- "--site-path",
- getSitePath().toString(),
- "--threads",
- Integer.toString(reindexThreads),
- "--index",
- schemaDef.getName());
+ Lists.newArrayList(
+ "--site-path", getSitePath().toString(), "--threads", Integer.toString(reindexThreads));
+ for (String index : indices) {
+ reindexArgs.add("--index");
+ reindexArgs.add(index);
+ }
+ if (isNewSite) {
+ reindexArgs.add("--disable-cache-stats");
+ }
+
getConsoleUI()
- .message(String.format("Init complete, reindexing %s with:", schemaDef.getName()));
+ .message(String.format("Init complete, reindexing %s with:", String.join(",", indices)));
getConsoleUI().message(" reindex " + reindexArgs.stream().collect(joining(" ")));
Reindex reindexPgm = new Reindex();
reindexPgm.main(reindexArgs.stream().toArray(String[]::new));
diff --git a/java/com/google/gerrit/pgm/Reindex.java b/java/com/google/gerrit/pgm/Reindex.java
index 69c7d6f..c4e185d 100644
--- a/java/com/google/gerrit/pgm/Reindex.java
+++ b/java/com/google/gerrit/pgm/Reindex.java
@@ -86,6 +86,13 @@
@Option(name = "--index", usage = "Only reindex specified indices")
private List<String> indices = new ArrayList<>();
+ @Option(
+ name = "--disable-cache-stats",
+ usage =
+ "Disables printing the cache statistics."
+ + "Defaults to true when reindex is run from init on a new site, false otherwise")
+ private boolean disableCacheStats;
+
private Injector dbInjector;
private Injector sysInjector;
private Injector cfgInjector;
@@ -116,6 +123,9 @@
try {
boolean ok = list ? list() : reindex();
+ if (!disableCacheStats) {
+ printCacheStats();
+ }
return ok ? 0 : 1;
} catch (Exception e) {
throw die(e.getMessage(), e);
@@ -250,8 +260,12 @@
"Index %s in version %d is %sready\n",
def.getName(), index.getSchema().getVersion(), result.success() ? "" : "NOT ");
+ return result.success();
+ }
+
+ private void printCacheStats() {
try (Writer sw = new StringWriter()) {
- sw.write(String.format("Cache Statistics at the end of reindexing %s\n", def.getName()));
+ sw.write("Cache Statistics at the end of reindexing\n");
new CacheDisplay(
sw,
StreamSupport.stream(cacheMap.spliterator(), false)
@@ -262,7 +276,5 @@
} catch (Exception e) {
System.out.format("Error displaying the cache statistics\n" + e.getMessage());
}
-
- return result.success();
}
}
diff --git a/javatests/com/google/gerrit/integration/git/GitProtocolV2IT.java b/javatests/com/google/gerrit/integration/git/GitProtocolV2IT.java
index b114acc..acf9a50 100644
--- a/javatests/com/google/gerrit/integration/git/GitProtocolV2IT.java
+++ b/javatests/com/google/gerrit/integration/git/GitProtocolV2IT.java
@@ -333,7 +333,7 @@
}
private static void assertGitProtocolV2Refs(String commit, String out) {
- assertThat(out).contains("git< version 2");
+ assertThat(out).containsMatch("(git|ls-remote)< version 2");
assertThat(out).contains("refs/changes/01/1/1");
assertThat(out).contains("refs/changes/01/1/meta");
assertThat(out).contains(commit);
diff --git a/plugins/gitiles b/plugins/gitiles
index 8e01636..fa993c0 160000
--- a/plugins/gitiles
+++ b/plugins/gitiles
@@ -1 +1 @@
-Subproject commit 8e016364bfbaa30f957e14250f73d1c25bb006b4
+Subproject commit fa993c05a1861c766c79cc304cc2ce4e9ae2905a
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element.ts b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element.ts
index 67f5a58..720cc27 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element.ts
@@ -68,6 +68,31 @@
return prefs.font_size * 4;
}
+function annotateSymbols(
+ contentEl: HTMLElement,
+ line: GrDiffLine,
+ separator: string | RegExp,
+ className: string
+) {
+ const split = line.text.split(separator);
+ if (!split || split.length < 2) {
+ return;
+ }
+ for (let i = 0, pos = 0; i < split.length - 1; i++) {
+ // Skip forward by the length of the content
+ pos += split[i].length;
+
+ GrAnnotation.annotateElement(
+ contentEl,
+ pos,
+ 1,
+ `style-scope gr-diff ${className}`
+ );
+
+ pos++;
+ }
+}
+
@customElement('gr-diff-builder')
export class GrDiffBuilderElement extends PolymerElement {
static get template() {
@@ -446,24 +471,7 @@
}
// Find and annotate the locations of tabs.
- const split = line.text.split('\t');
- if (!split) {
- return;
- }
- for (let i = 0, pos = 0; i < split.length - 1; i++) {
- // Skip forward by the length of the content
- pos += split[i].length;
-
- GrAnnotation.annotateElement(
- contentEl,
- pos,
- 1,
- 'style-scope gr-diff tab-indicator'
- );
-
- // Skip forward by one tab character.
- pos++;
- }
+ annotateSymbols(contentEl, line, '\t', 'tab-indicator');
},
};
}
@@ -471,24 +479,15 @@
_createSpecialCharacterIndicatorLayer(): DiffLayer {
return {
annotate(contentEl: HTMLElement, _: HTMLElement, line: GrDiffLine) {
- // Find and annotate the locations of soft hyphen.
- const split = line.text.split('\u00AD'); // \u00AD soft hyphen
- if (!split || split.length < 2) {
- return;
- }
- for (let i = 0, pos = 0; i < split.length - 1; i++) {
- // Skip forward by the length of the content
- pos += split[i].length;
-
- GrAnnotation.annotateElement(
- contentEl,
- pos,
- 1,
- 'style-scope gr-diff special-char-indicator'
- );
-
- pos++;
- }
+ // Find and annotate the locations of soft hyphen (\u00AD)
+ annotateSymbols(contentEl, line, '\u00AD', 'special-char-indicator');
+ // Find and annotate Stateful Unicode directional controls
+ annotateSymbols(
+ contentEl,
+ line,
+ /[\u202A-\u202E\u2066-\u2069]/,
+ 'special-char-warning'
+ );
},
};
}
diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_html.ts b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_html.ts
index 83b0aad..67b7a9f 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_html.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_html.ts
@@ -363,6 +363,15 @@
content: '•';
position: absolute;
}
+ .special-char-warning {
+ /* spacing so elements don't collide */
+ padding-right: var(--spacing-m);
+ }
+ .special-char-warning:before {
+ color: var(--warning-foreground);
+ content: '!';
+ position: absolute;
+ }
/* Is defined after other background-colors, such that this
rule wins in case of same specificity. */
.trailing-whitespace,