default to continueOnFail === false and handle failures for continueOnFail === true
This commit is contained in:
parent
9daafba7e9
commit
2bc1a89e14
31
lib/util.js
31
lib/util.js
@ -121,9 +121,16 @@ const util = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
runGit: function (repoPath, gitArgs, continueOnFail = true) {
|
runGit: function (repoPath, gitArgs, continueOnFail = false) {
|
||||||
return util.run('git', gitArgs, { cwd: repoPath, continueOnFail })
|
let prog = util.run('git', gitArgs, { cwd: repoPath, continueOnFail })
|
||||||
.stdout.toString().trim()
|
|
||||||
|
if (prog.status !== 0) {
|
||||||
|
console.error(prog.stdout)
|
||||||
|
console.error(prog.stderr)
|
||||||
|
return null
|
||||||
|
} else {
|
||||||
|
return prog.stdout.toString().trim()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
runGitAsync: function (repoPath, gitArgs, verbose = false, logError = false) {
|
runGitAsync: function (repoPath, gitArgs, verbose = false, logError = false) {
|
||||||
@ -584,20 +591,20 @@ const util = {
|
|||||||
const braveCoreRef = config.getProjectVersion('brave-core')
|
const braveCoreRef = config.getProjectVersion('brave-core')
|
||||||
Log.status(`Cloning brave-core [${braveCoreRef}] into ${config.braveCoreDir}...`)
|
Log.status(`Cloning brave-core [${braveCoreRef}] into ${config.braveCoreDir}...`)
|
||||||
fs.mkdirSync(config.braveCoreDir)
|
fs.mkdirSync(config.braveCoreDir)
|
||||||
util.runGit(config.braveCoreDir, ['clone', config.braveCoreRepo, '.'], false)
|
util.runGit(config.braveCoreDir, ['clone', config.braveCoreRepo, '.'])
|
||||||
util.runGit(config.braveCoreDir, ['checkout', braveCoreRef], false)
|
util.runGit(config.braveCoreDir, ['checkout', braveCoreRef])
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
shouldUpdateChromium: (chromiumRef = config.getProjectRef('chrome')) => {
|
shouldUpdateChromium: (chromiumRef = config.getProjectRef('chrome')) => {
|
||||||
util.runGit(config.srcDir, ['fetch', '--all', '--tags'])
|
util.runGit(config.srcDir, ['fetch', '--all', '--tags'])
|
||||||
const headSHA = util.runGit(config.srcDir, ['rev-parse', 'HEAD'], false)
|
const headSHA = util.runGit(config.srcDir, ['rev-parse', 'HEAD'], true)
|
||||||
const targetSHA = util.runGit(config.srcDir, ['rev-parse', chromiumRef], false)
|
const targetSHA = util.runGit(config.srcDir, ['rev-parse', chromiumRef], true)
|
||||||
const needsUpdate = (targetSHA !== headSHA)
|
const needsUpdate = ((targetSHA !== headSHA) || (!headSHA && !targetSHA))
|
||||||
if (needsUpdate) {
|
if (needsUpdate) {
|
||||||
console.log(`Chromium repo ${chalk.blue.bold('needs update')}. Target is ${chalk.italic(chromiumRef)} at commit ${targetSHA} but current commit is ${chalk.inverse(headSHA)}.`)
|
console.log(`Chromium repo ${chalk.blue.bold('needs update')}. Target is ${chalk.italic(chromiumRef)} at commit ${targetSHA || '[missing]'} but current commit is ${chalk.inverse(headSHA || '[missing]')}.`)
|
||||||
} else {
|
} else {
|
||||||
console.log(chalk.green.bold(`Chromium repo does not need update as it is already ${chalk.italic(chromiumRef)} at commit ${targetSHA}.`))
|
console.log(chalk.green.bold(`Chromium repo does not need update as it is already ${chalk.italic(chromiumRef)} at commit ${targetSHA || '[missing]'}.`))
|
||||||
}
|
}
|
||||||
return needsUpdate
|
return needsUpdate
|
||||||
},
|
},
|
||||||
@ -617,10 +624,10 @@ const util = {
|
|||||||
// Use current branch (sync will then pull latest) or current exact hash
|
// Use current branch (sync will then pull latest) or current exact hash
|
||||||
// if we're not in a branch.
|
// if we're not in a branch.
|
||||||
util.runGit(config.braveCoreDir, ['fetch', '--all', '--tags'])
|
util.runGit(config.braveCoreDir, ['fetch', '--all', '--tags'])
|
||||||
braveCoreRef = util.runGit(config.braveCoreDir, ['rev-parse', '--abbrev-ref', 'HEAD'], false)
|
braveCoreRef = util.runGit(config.braveCoreDir, ['rev-parse', '--abbrev-ref', 'HEAD'])
|
||||||
if (braveCoreRef === 'HEAD') {
|
if (braveCoreRef === 'HEAD') {
|
||||||
// get the rev hash if we're not in a branch
|
// get the rev hash if we're not in a branch
|
||||||
braveCoreRef = util.runGit(config.braveCoreDir, ['rev-parse', 'HEAD'], false)
|
braveCoreRef = util.runGit(config.braveCoreDir, ['rev-parse', 'HEAD'])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user