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) {
|
||||
return util.run('git', gitArgs, { cwd: repoPath, continueOnFail })
|
||||
.stdout.toString().trim()
|
||||
runGit: function (repoPath, gitArgs, continueOnFail = false) {
|
||||
let prog = util.run('git', gitArgs, { cwd: repoPath, continueOnFail })
|
||||
|
||||
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) {
|
||||
@ -584,20 +591,20 @@ const util = {
|
||||
const braveCoreRef = config.getProjectVersion('brave-core')
|
||||
Log.status(`Cloning brave-core [${braveCoreRef}] into ${config.braveCoreDir}...`)
|
||||
fs.mkdirSync(config.braveCoreDir)
|
||||
util.runGit(config.braveCoreDir, ['clone', config.braveCoreRepo, '.'], false)
|
||||
util.runGit(config.braveCoreDir, ['checkout', braveCoreRef], false)
|
||||
util.runGit(config.braveCoreDir, ['clone', config.braveCoreRepo, '.'])
|
||||
util.runGit(config.braveCoreDir, ['checkout', braveCoreRef])
|
||||
}
|
||||
},
|
||||
|
||||
shouldUpdateChromium: (chromiumRef = config.getProjectRef('chrome')) => {
|
||||
util.runGit(config.srcDir, ['fetch', '--all', '--tags'])
|
||||
const headSHA = util.runGit(config.srcDir, ['rev-parse', 'HEAD'], false)
|
||||
const targetSHA = util.runGit(config.srcDir, ['rev-parse', chromiumRef], false)
|
||||
const needsUpdate = (targetSHA !== headSHA)
|
||||
const headSHA = util.runGit(config.srcDir, ['rev-parse', 'HEAD'], true)
|
||||
const targetSHA = util.runGit(config.srcDir, ['rev-parse', chromiumRef], true)
|
||||
const needsUpdate = ((targetSHA !== headSHA) || (!headSHA && !targetSHA))
|
||||
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 {
|
||||
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
|
||||
},
|
||||
@ -617,10 +624,10 @@ const util = {
|
||||
// Use current branch (sync will then pull latest) or current exact hash
|
||||
// if we're not in a branch.
|
||||
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') {
|
||||
// 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