Skip to content

Commit e54bc7b

Browse files
committed
attempt-backport: use options.logger
Refs: nodejs#77 PR-URL: nodejs#90
1 parent eaa098c commit e54bc7b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

scripts/attempt-backport.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function processNextBackport() {
6767

6868
function queueAttemptBackport(options, version, isLTS) {
6969
queue.push(function() {
70-
debug(`processing a new backport to v${version}`)
70+
options.logger.debug(`processing a new backport to v${version}`)
7171
attemptBackport(options, version, isLTS, processNextBackport)
7272
})
7373
}
@@ -121,7 +121,7 @@ function attemptBackport(options, version, isLTS, cb) {
121121
if (!cb) return
122122
const _cb = cb
123123
setImmediate(() => {
124-
debug(`backport to ${version} failed`)
124+
options.logger.debug(`backport to ${version} failed`)
125125
if (!isLTS) updatePrWithLabels(options, [`dont-land-on-v${version}.x`])
126126
setImmediate(() => {
127127
inProgress = false
@@ -134,7 +134,7 @@ function attemptBackport(options, version, isLTS, cb) {
134134
function gitAmAbort() {
135135
// TODO(Fishrock123): this should probably just merge into wrapCP
136136
let exited = false
137-
debug(`aborting any previous backport attempt...`)
137+
options.logger.debug(`aborting any previous backport attempt...`)
138138

139139
const cp = child_process.spawn('git', ['am', '--abort'], { cwd: global._node_repo_dir })
140140
const argsString = 'git am --abort'
@@ -154,22 +154,22 @@ function attemptBackport(options, version, isLTS, cb) {
154154
}
155155

156156
function gitRemoteUpdate() {
157-
debug(`updating git remotes...`)
157+
options.logger.debug(`updating git remotes...`)
158158
wrapCP('git', ['remote', 'update', '-p'], gitCheckout)
159159
}
160160

161161
function gitCheckout() {
162-
debug(`checking out upstream/v${version}.x-staging...`)
162+
options.logger.debug(`checking out upstream/v${version}.x-staging...`)
163163
wrapCP('git', ['checkout', `upstream/v${version}.x-staging`], gitReset)
164164
}
165165

166166
function gitReset() {
167-
debug(`resetting upstream/v${version}.x-staging...`)
167+
options.logger.debug(`resetting upstream/v${version}.x-staging...`)
168168
wrapCP('git', ['reset', `upstream/v${version}.x-staging`, '--hard'], fetchDiff)
169169
}
170170

171171
function fetchDiff() {
172-
debug(`fetching diff from pr ${options.prId}...`)
172+
options.logger.debug(`fetching diff from pr ${options.prId}...`)
173173

174174
const url = `https://patch-diff.githubusercontent.com/raw/${options.owner}/${options.repo}/pull/${options.prId}.patch`
175175

@@ -190,13 +190,13 @@ function attemptBackport(options, version, isLTS, cb) {
190190
}
191191

192192
function gitAttemptBackport(req) {
193-
debug(`attempting a backport to v${version}...`)
193+
options.logger.debug(`attempting a backport to v${version}...`)
194194
const cp = wrapCP('git', ['am'], { stdio: 'pipe' }, function done() {
195195
// Success!
196196
if (isLTS) updatePrWithLabels(options, [`lts-watch-v${version}.x`])
197197

198198
setImmediate(() => {
199-
debug(`backport to v${version} successful`)
199+
options.logger.debug(`backport to v${version} successful`)
200200
inProgress = false
201201
cb()
202202
})

0 commit comments

Comments
 (0)