@@ -8,7 +8,6 @@ const path = require('path');
8
8
const os = require ( 'os' ) ;
9
9
const { Octokit } = require ( '@octokit/rest' ) ;
10
10
11
- const { getCveForBugNr } = require ( './utils/crbug' ) ;
12
11
const { getGitHubAuthToken } = require ( './utils/github-auth' ) ;
13
12
const { fatal, color } = require ( './utils/logging' ) ;
14
13
@@ -17,14 +16,6 @@ const ELECTRON_REPO_DATA = {
17
16
repo : 'electron' ,
18
17
} ;
19
18
20
- const gerritSources = [
21
- 'chromium-review.googlesource.com' ,
22
- 'skia-review.googlesource.com' ,
23
- 'webrtc-review.googlesource.com' ,
24
- 'pdfium-review.googlesource.com' ,
25
- 'dawn-review.googlesource.com' ,
26
- ] ;
27
-
28
19
async function getPatchDetailsFromURL ( urlStr , security ) {
29
20
const parsedUrl = new URL ( urlStr ) ;
30
21
if ( parsedUrl . host . endsWith ( '.googlesource.com' ) ) {
@@ -38,54 +29,6 @@ async function getPatchDetailsFromURL(urlStr, security) {
38
29
) ;
39
30
}
40
31
41
- async function getGerritPatchDetailsFromURL ( gerritUrl , security ) {
42
- const { host, pathname } = gerritUrl ;
43
-
44
- if ( ! gerritSources . includes ( host ) ) {
45
- fatal ( 'Unsupported gerrit host' ) ;
46
- }
47
- const [ , repo , number ] = / ^ \/ c \/ ( .+ ?) \/ \+ \/ ( \d + ) / . exec ( pathname ) ;
48
-
49
- d ( `fetching patch from gerrit` ) ;
50
- const changeId = `${ repo } ~${ number } ` ;
51
- const patchUrl = new URL (
52
- `/changes/${ encodeURIComponent ( changeId ) } /revisions/current/patch` ,
53
- gerritUrl ,
54
- ) ;
55
-
56
- const patch = await fetch ( patchUrl )
57
- . then ( ( resp ) => resp . text ( ) )
58
- . then ( ( text ) => Buffer . from ( text , 'base64' ) . toString ( 'utf8' ) ) ;
59
-
60
- const [ , commitId ] = / ^ F r o m ( [ 0 - 9 a - f ] + ) / . exec ( patch ) ;
61
-
62
- const bugNumber =
63
- / ^ (?: B u g | F i x e d ) [: = ] ? ( .+ ) $ / im. exec ( patch ) ?. [ 1 ] || / ^ B u g = ? c h r o m i u m : ( .+ ) $ / m. exec ( patch ) ?. [ 1 ] ;
64
-
65
- let cve = '' ;
66
- if ( security ) {
67
- try {
68
- cve = await getCveForBugNr ( bugNumber . replace ( 'chromium:' , '' ) ) ;
69
- } catch ( err ) {
70
- d ( err ) ;
71
- console . error (
72
- `${ color . warn } Failed to fetch CVE for ${ bugNumber } - you'll need to find it manually` ,
73
- ) ;
74
- }
75
- }
76
-
77
- const patchDirName =
78
- {
79
- 'chromium-review.googlesource.com:chromium/src' : 'chromium' ,
80
- 'skia-review.googlesource.com:skia' : 'skia' ,
81
- 'webrtc-review.googlesource.com:src' : 'webrtc' ,
82
- } [ `${ host } :${ repo } ` ] || repo . split ( '/' ) . reverse ( ) [ 0 ] ;
83
-
84
- const shortCommit = commitId . substr ( 0 , 12 ) ;
85
-
86
- return { patchDirName, shortCommit, patch, bugNumber, cve } ;
87
- }
88
-
89
32
async function getGitHubPatchDetailsFromURL ( gitHubUrl , security ) {
90
33
if ( security ) {
91
34
fatal ( 'GitHub cherry-picks can not be security backports currently' ) ;
0 commit comments