chore(3p/gerrit): update to latest upstream HEAD

Change-Id: Ia7b17ca83ace164881a4dd8b0288741489bc467c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2164
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
Luke Granger-Brown 2020-11-27 17:39:35 +00:00 committed by lukegb
parent 36cf7bef24
commit 77be22549a
10 changed files with 91 additions and 140 deletions

View file

@ -94,6 +94,7 @@ let
installShellFiles
jdk
jdk11
jdk11_headless
jetbrains-mono
jq
kontemplate

View file

@ -1,7 +1,7 @@
From c88d8c133d2f50451c7fb73592db4a000b87f15f Mon Sep 17 00:00:00 2001
From b8e1242655d308377f28c9bfcca2fe578e7093bb Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <git@lukegb.com>
Date: Thu, 2 Jul 2020 23:02:09 +0100
Subject: [PATCH 1/7] Use detzip in download_bower.py
Subject: [PATCH 1/6] Use detzip in download_bower.py
---
tools/js/download_bower.py | 2 +-
@ -21,5 +21,5 @@ index 1df4b826bc..65bda74082 100755
if args.s:
--
2.27.0
2.29.2

View file

@ -1,24 +1,24 @@
From 1310ad5e56248bf216774cd13e828ba76e0c6f65 Mon Sep 17 00:00:00 2001
From 18a008f8bddfa529296357620bbd9a97de6b2879 Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <git@lukegb.com>
Date: Thu, 2 Jul 2020 23:02:32 +0100
Subject: [PATCH 2/7] Syntax highlight nix
Subject: [PATCH 2/6] Syntax highlight nix
---
.../app/elements/diff/gr-syntax-layer/gr-syntax-layer.js | 1 +
.../app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts | 1 +
1 file changed, 1 insertion(+)
diff --git a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js
index 6399c4a469..480d2946c3 100644
--- a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js
+++ b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js
@@ -99,6 +99,7 @@ const LANGUAGE_MAP = {
'text/x-vhdl': 'vhdl',
'text/x-yaml': 'yaml',
'text/vbscript': 'vbscript',
+ 'application/x-mix-transfer': 'nix',
};
diff --git a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts
index f5e5e047bc..0c3bb40ce4 100644
--- a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts
+++ b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts
@@ -105,6 +105,7 @@ const LANGUAGE_MAP = new Map<string, string>([
['text/x-vhdl', 'vhdl'],
['text/x-yaml', 'yaml'],
['text/vbscript', 'vbscript'],
+ ['application/x-mix-transfer', 'nix'],
]);
const ASYNC_DELAY = 10;
--
2.27.0
2.29.2

View file

@ -1,44 +1,46 @@
From a8dad8e63a1be32f473e96c6c7530a70d368369f Mon Sep 17 00:00:00 2001
From 9358b1cdd5f13e6638030446880f731785ca38f1 Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <git@lukegb.com>
Date: Thu, 2 Jul 2020 23:02:43 +0100
Subject: [PATCH 3/7] Syntax highlight rules.pl
Subject: [PATCH 3/6] Syntax highlight rules.pl
---
.../elements/diff/gr-syntax-layer/gr-syntax-layer.js | 10 ++++++++++
1 file changed, 10 insertions(+)
.../diff/gr-syntax-layer/gr-syntax-layer.ts | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js
index 480d2946c3..b2020c24bd 100644
--- a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js
+++ b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js
@@ -103,6 +103,10 @@ const LANGUAGE_MAP = {
};
diff --git a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts
index 0c3bb40ce4..ace253da30 100644
--- a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts
+++ b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts
@@ -109,6 +109,10 @@ const LANGUAGE_MAP = new Map<string, string>([
]);
const ASYNC_DELAY = 10;
+const FILENAME_OVERRIDES = {
+ 'rules.pl': 'prolog',
+};
+const FILENAME_OVERRIDES = new Map<string, string>([
+ ['rules.pl', 'prolog'],
+]);
+
const CLASS_SAFELIST = {
'gr-diff gr-syntax gr-syntax-attr': true,
'gr-diff gr-syntax gr-syntax-attribute': true,
@@ -234,10 +238,16 @@ class GrSyntaxLayer extends GestureEventListeners(
const CLASS_SAFELIST = new Set<string>([
'gr-diff gr-syntax gr-syntax-attr',
'gr-diff gr-syntax gr-syntax-attribute',
@@ -258,10 +262,17 @@ export class GrSyntaxLayer
}
}
+ _basename(filename) {
+ _basename(filename: string): string {
+ const pieces = filename.split(/\//);
+ return pieces[pieces.length-1];
+ }
+
_getLanguage(diffFileMetaInfo) {
_getLanguage(metaInfo: DiffFileMetaInfo) {
// The Gerrit API provides only content-type, but for other users of
// gr-diff it may be more convenient to specify the language directly.
return diffFileMetaInfo.language ||
+ FILENAME_OVERRIDES[this._basename(diffFileMetaInfo.name)] ||
LANGUAGE_MAP[diffFileMetaInfo.content_type];
- return metaInfo.language ?? LANGUAGE_MAP.get(metaInfo.content_type);
+ return metaInfo.language ??
+ FILENAME_OVERRIDES.get(this._basename(metaInfo.name)) ??
+ LANGUAGE_MAP.get(metaInfo.content_type);
}
/**
--
2.27.0
2.29.2

View file

@ -1,30 +1,30 @@
From 61035d1e81884390708675ab994e0e7210659883 Mon Sep 17 00:00:00 2001
From ad4564c31401a900702fca6e3f673badbfbdf9d9 Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <git@lukegb.com>
Date: Thu, 2 Jul 2020 23:03:02 +0100
Subject: [PATCH 4/7] Add titles to CLs over HTTP
Subject: [PATCH 4/6] Add titles to CLs over HTTP
---
.../gerrit/httpd/raw/IndexHtmlUtil.java | 14 +++-
.../gerrit/httpd/raw/IndexHtmlUtil.java | 13 +++-
.../google/gerrit/httpd/raw/IndexServlet.java | 7 +-
.../google/gerrit/httpd/raw/StaticModule.java | 5 +-
.../gerrit/httpd/raw/TitleComputer.java | 67 +++++++++++++++++++
.../gerrit/httpd/raw/PolyGerritIndexHtml.soy | 4 +-
5 files changed, 89 insertions(+), 8 deletions(-)
5 files changed, 88 insertions(+), 8 deletions(-)
create mode 100644 java/com/google/gerrit/httpd/raw/TitleComputer.java
diff --git a/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java b/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java
index cddaea4aaf..d5f43de025 100644
index 77d02c16d0..3b2cae702a 100644
--- a/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java
+++ b/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java
@@ -42,6 +42,7 @@ import java.util.Arrays;
@@ -38,6 +38,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import java.util.regex.Matcher;
@@ -110,7 +111,8 @@ public class IndexHtmlUtil {
@@ -58,13 +59,14 @@ public class IndexHtmlUtil {
String faviconPath,
Map<String, String[]> urlParameterMap,
Function<String, SanitizedContent> urlInScriptTagOrdainer,
@ -34,37 +34,34 @@ index cddaea4aaf..d5f43de025 100644
throws URISyntaxException, RestApiException {
ImmutableMap.Builder<String, Object> data = ImmutableMap.builder();
data.putAll(
@@ -121,7 +123,7 @@ public class IndexHtmlUtil {
urlParameterMap,
urlInScriptTagOrdainer,
requestedURL))
- .putAll(dynamicTemplateData(gerritApi));
staticTemplateData(
canonicalURL, cdnPath, faviconPath, urlParameterMap, urlInScriptTagOrdainer))
- .putAll(dynamicTemplateData(gerritApi, requestedURL));
+ .putAll(dynamicTemplateData(gerritApi, requestedURL, titleComputer));
Set<String> enabledExperiments = experimentData(urlParameterMap);
if (!enabledExperiments.isEmpty()) {
@@ -131,7 +133,9 @@ public class IndexHtmlUtil {
}
@@ -75,7 +77,9 @@ public class IndexHtmlUtil {
/** Returns dynamic parameters of {@code index.html}. */
- public static ImmutableMap<String, Object> dynamicTemplateData(GerritApi gerritApi)
+ public static ImmutableMap<String, Object> dynamicTemplateData(GerritApi gerritApi,
+ String requestedURL,
+ TitleComputer titleComputer)
throws RestApiException {
public static ImmutableMap<String, Object> dynamicTemplateData(
- GerritApi gerritApi, String requestedURL) throws RestApiException, URISyntaxException {
+ GerritApi gerritApi,
+ String requestedURL,
+ TitleComputer titleComputer) throws RestApiException, URISyntaxException {
ImmutableMap.Builder<String, Object> data = ImmutableMap.builder();
Map<String, SanitizedContent> initialData = new HashMap<>();
@@ -158,6 +162,10 @@ public class IndexHtmlUtil {
Server serverApi = gerritApi.config().server();
@@ -126,6 +130,9 @@ public class IndexHtmlUtil {
// Don't render data
}
data.put("gerritInitialData", initialData);
+
+ Optional<String> title = titleComputer.computeTitle(requestedURL);
+ title.ifPresent(s -> data.put("title", s));
+
data.put("gerritInitialData", initialData);
return data.build();
}
diff --git a/java/com/google/gerrit/httpd/raw/IndexServlet.java b/java/com/google/gerrit/httpd/raw/IndexServlet.java
index 97d22701de..089ef4725f 100644
--- a/java/com/google/gerrit/httpd/raw/IndexServlet.java
@ -103,10 +100,10 @@ index 97d22701de..089ef4725f 100644
} catch (URISyntaxException | RestApiException e) {
throw new IOException(e);
diff --git a/java/com/google/gerrit/httpd/raw/StaticModule.java b/java/com/google/gerrit/httpd/raw/StaticModule.java
index 414a120194..e1b6fb082d 100644
index 4b2c8a9733..466fbaa27c 100644
--- a/java/com/google/gerrit/httpd/raw/StaticModule.java
+++ b/java/com/google/gerrit/httpd/raw/StaticModule.java
@@ -220,11 +220,12 @@ public class StaticModule extends ServletModule {
@@ -221,11 +221,12 @@ public class StaticModule extends ServletModule {
HttpServlet getPolyGerritUiIndexServlet(
@CanonicalWebUrl @Nullable String canonicalUrl,
@GerritServerConfig Config cfg,
@ -195,12 +192,12 @@ index 0000000000..8fd2053ad0
+ }
+}
diff --git a/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy b/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy
index 32ba0bc790..2515c71d6a 100644
index 000f4e2b5f..fcc26f7f54 100644
--- a/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy
+++ b/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy
@@ -33,10 +33,12 @@
{@param? preloadChangePage: ?}
{@param? preloadDiffPage: ?}
{@param? defaultDashboardHex: ?}
{@param? dashboardQuery: ?}
{@param? userIsAuthenticated: ?}
+ {@param? title: ?}
<!DOCTYPE html>{\n}
@ -213,5 +210,5 @@ index 32ba0bc790..2515c71d6a 100644
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">{\n}
--
2.27.0
2.29.2

View file

@ -1,7 +1,7 @@
From 73edc92dfa584117f6a4373388c9bc47e50a5713 Mon Sep 17 00:00:00 2001
From dfa0d782edb6b2d789f71a2462ba93e6101b5e4e Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <git@lukegb.com>
Date: Sat, 11 Jul 2020 00:45:57 +0000
Subject: [PATCH 5/7] When using local fonts, always assume Gerrit is mounted
Subject: [PATCH 5/6] When using local fonts, always assume Gerrit is mounted
at the root.
---
@ -9,7 +9,7 @@ Subject: [PATCH 5/7] When using local fonts, always assume Gerrit is mounted
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/polygerrit-ui/app/rollup.config.js b/polygerrit-ui/app/rollup.config.js
index db0e2f7159..7bde541405 100644
index c8e9baa98c..9438504bd8 100644
--- a/polygerrit-ui/app/rollup.config.js
+++ b/polygerrit-ui/app/rollup.config.js
@@ -50,7 +50,7 @@ const importLocalFontMetaUrlResolver = function() {
@ -22,5 +22,5 @@ index db0e2f7159..7bde541405 100644
return null;
}
--
2.27.0
2.29.2

View file

@ -1,7 +1,7 @@
From f3b85ab3ac139d8ec51c09aa5e0d430d65e35a96 Mon Sep 17 00:00:00 2001
From def99cd67963afad42bd70f21fd2f626603481e4 Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <git@lukegb.com>
Date: Sat, 11 Jul 2020 00:46:13 +0000
Subject: [PATCH 6/7] Always use Google Fonts.
Subject: [PATCH 6/6] Always use Google Fonts.
We're not a corporate, and we're not behind the GFW. Always use Google Fonts,
because even though we no longer get the caching benefits (boo, browsers),
@ -11,10 +11,10 @@ it is still a better geographically-distributed CDN.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java b/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java
index d5f43de025..9c68a1d327 100644
index 3b2cae702a..84ce678b6d 100644
--- a/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java
+++ b/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java
@@ -231,7 +231,7 @@ public class IndexHtmlUtil {
@@ -182,7 +182,7 @@ public class IndexHtmlUtil {
if (urlParameterMap.containsKey("ce")) {
data.put("polyfillCE", "true");
}
@ -24,5 +24,5 @@ index d5f43de025..9c68a1d327 100644
}
--
2.27.0
2.29.2

View file

@ -1,35 +0,0 @@
From 460d4806feef7fdddc8e3b63dec4fa1854fd2561 Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <lukegb@google.com>
Date: Sat, 25 Jul 2020 23:54:18 +0000
Subject: [PATCH 7/7] Fix gr-hovercard-behavior under Firefox
Firefox doesn't implement toElement/fromElement (they're not in the
spec, and were implemented by Chrome apparently for compatibility with
IE), but does implement target and relatedTarget, which are part of
the UI Events spec
(https://w3c.github.io/uievents/#interface-mouseevent).
Bug: Issue 13175
Change-Id: I9eeb26c032a38de9d7185749373c7982c796acb2
---
.../app/elements/shared/gr-hovercard/gr-hovercard-behavior.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard-behavior.js b/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard-behavior.js
index 04c3166dd5..3d5937b1fa 100644
--- a/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard-behavior.js
+++ b/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard-behavior.js
@@ -209,8 +209,8 @@ export const hovercardBehaviorMixin = superClass => class extends superClass {
// from the hovercard but now hovering over the target (to stop an annoying
// flicker effect), just return.
if (opt_e) {
- if (opt_e.toElement === this ||
- (opt_e.fromElement === this && opt_e.toElement === this._target)) {
+ if (opt_e.relatedTarget === this ||
+ (opt_e.target === this && opt_e.relatedTarget === this._target)) {
return;
}
}
--
2.27.0

View file

@ -16,7 +16,7 @@ let
targetPkgs = pkgs: [
(pkgs.bazel.override { enableNixHacks = true; })
detzip
pkgs.jdk
pkgs.jdk11_headless
pkgs.zlib
pkgs.python
pkgs.curl
@ -28,15 +28,16 @@ let
runScript = "/bin/bazel-run";
};
bazel = bazelTop // { override = x: bazelTop; };
version = "3.2.3-951-gd888625eb5";
version = "3.3.0-rc7-520-gdef99cd679";
in
pkgs.lib.makeOverridable pkgs.buildBazelPackage {
name = "gerrit-${version}";
pname = "gerrit";
inherit version;
src = pkgs.fetchgit {
url = "https://gerrit.googlesource.com/gerrit";
rev = "d888625eb5e1c91b257c9501924efdd9ae498422";
sha256 = "15dgjn5xqhvgwnc4klmh2m8f205x1fhchbs8x312lm2g2apdhdcc";
rev = "d36cf01b0f03eb6a555c915cc9d570e4b07d485b";
sha256 = "sha256:0a8qnwyhkl8amp34qlnym50787iaxg34k0f44dsyj6qlkj6aqx57";
fetchSubmodules = true;
};
patches = [
@ -56,28 +57,13 @@ pkgs.lib.makeOverridable pkgs.buildBazelPackage {
"--disk_cache="
];
removeRulesCC = false;
fetchConfigured = true;
fetchAttrs = {
sha256 = "1f624gb1whmadf7qyv5l2yqw7pgbjlbfyk1gzkrcykhlwsxz9z0f";
sha256 = "sha256:042m2fzp6hhc76hiyvjakx2bcpbwsbf8gv20d6zifi237dgw6pj3";
preBuild = ''
rm .bazelversion
'';
buildPhase = ''
runHook preBuild
BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 \
USER=homeless-shelter \
bazel \
--output_base="$bazelOut" \
--output_user_root="$bazelUserRoot" \
build --nobuild \
--loading_phase_threads=1 \
$bazelFlags \
$bazelFetchFlags \
$bazelTarget
runHook postBuild
'';
installPhase = ''
runHook preInstall

View file

@ -7,7 +7,7 @@ in
# https://gerrit.googlesource.com/plugins/owners
owners = buildGerritBazelPlugin rec {
name = "owners";
depsOutputHash = "1l99a1qa3bndk1cx4fsrq18z3p7rg6yp9r83snldp97kg25873cs";
depsOutputHash = "sha256:1liya9ayk6wv7yc0fpv0vyx7pnvnxirxnsxybs4akgbmrss5ahs2";
src = pkgs.fetchgit {
url = "https://gerrit.googlesource.com/plugins/owners";
rev = "17817c9e319073c03513f9d5177b6142b8fd567b";
@ -26,11 +26,11 @@ in
# https://gerrit.googlesource.com/plugins/checks
checks = buildGerritBazelPlugin {
name = "checks";
depsOutputHash = "0igixhkgvd8d51swbypsby553sdzghlj4b9wy9cnf2d8d0aqs2ky";
depsOutputHash = "sha256:12yg72w7kndz5ag7cgdzhxdpv8hy3qln71n93226iswwkn22c2sw";
src = pkgs.fetchgit {
url = "https://gerrit.googlesource.com/plugins/checks";
rev = "f508353fc5f93d35d07279857aba5d9cf38de658";
sha256 = "094j225cpgckxvnqzk3rif34iylgr0r7v4n6r1m1qymavbk9wg9j";
rev = "ab49a63f5c159bda42d9ad1bdb9286bede6c5de4";
sha256 = "sha256:0v16hrpfppi4hi2l2133m56fknbvc3nas1h1a1x48gdgm8d4g27f";
deepClone = true;
leaveDotGit = true;
};