瀏覽代碼

Merge branch 'master' of http://git.bbh.com/chess/elxr

pull/4/head
anish 3 年之前
父節點
當前提交
42097babbd
共有 1 個文件被更改,包括 17 次插入9 次删除
  1. 17
    9
      index.js

+ 17
- 9
index.js 查看文件

@@ -76,12 +76,19 @@ var getTaskCheckExists = (command, options) => {
}
}

var getPullCmd = (repo) => {
var getPullCmd = (repo, branch) => {
// console.log(useGitPull)

var pullCmd = [gitbash
, ['-c', 'branch=`git rev-parse --abbrev-ref HEAD`;for i in `git remote`; do git pull $i $branch; done;']
, { cwd: instanceroot + '/' + repo, title: 'pull all origins for ' + repo }]
if(branch) {
var pullCmd = [ gitInstallDir
, ['-c', 'for i in `git remote`; do git pull $i ' + branch + '; done;']
, { cwd: instanceroot + '/' + repo, title : 'pull all origins for ' + repo }]
}
else {
var pullCmd = [gitbash
, ['-c', 'branch=`git rev-parse --abbrev-ref HEAD`;for i in `git remote`; do git pull $i $branch; done;']
, { cwd: instanceroot + '/' + repo, title: 'pull all origins for ' + repo }]
}
// var pullCmd = ['pullall', [], { cwd : repo }]
if (useGitPull) pullCmd = ['git', ['pull'], {
inherit: true, shell: true,
@@ -93,10 +100,11 @@ var getPullCmd = (repo) => {
return pullCmd
}

var performPull = (repo) => {
var performPull = (repo, branch) => {
if (existsSync(instanceroot + '/' + repo)) {
console.log('pulling ' + instanceroot + '/' + repo)
return nodeShellExec.apply(null, getPullCmd(repo)).then(() => {
var branchprint = branch ? ' branch :' + branch : '';
console.log('pulling ' + instanceroot + '/' + repo + branchprint )
return nodeShellExec.apply(null, getPullCmd(repo, branch)).then(() => {
if (__isElevated) {
fs.writeFileSync('run.log', ', ' + JSON.stringify({ repo, success: true }), { 'flag': 'a+' })
}
@@ -645,9 +653,9 @@ var op = {
// console.dir(env)
console.log('Running exlr pull : ' + path.dirname(__dirname))

if (!processedArgs.runas) gitRepos.forEach(performPull)
if (!processedArgs.runas) gitRepos.map((repo) => performPull(repo, 'master'))
if (__isElevated) {
return any(elevatedRunasRepos.map((repo) => performPull(repo))).then(() => {
return any(elevatedRunasRepos.map((repo) => performPull(repo, 'master'))).then(() => {
fs.writeFileSync('run.done', 'success')
}).catch(() => {
fs.writeFileSync('run.done', 'error')

Loading…
取消
儲存