Ver código fonte

merge issue fixes

pull/1/head
samuel 4 anos atrás
pai
commit
83e6dfdf04
1 arquivos alterados com 18 adições e 7 exclusões
  1. 18
    7
      index.js

+ 18
- 7
index.js Ver arquivo

@@ -612,15 +612,16 @@ var __runcmd = function(label){
}

// cant use git checkout -b it fails with branch already exists.
var performCheckout = (repo)=>{
var performCheckout = (repo, branch)=>{
if(!branch) return Promise.resolve({ 'skipped' : true })
if(excludeCheckouts[repo]) return Promise.resolve({ 'skipped' : true })
return nodeShellExec('git', ['checkout', checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV], {
return nodeShellExec('git', ['checkout', branch || checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV], {
// return nodeShellExec('git', ['switch', '-m', '-C', checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV], {
// inherit : true, shell: true,
cwd : repo
// , stdio : ignore // Use when we want to silcence output completely.
, runas : processedArgs.runas
, title : `git checkout ${checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV} for ${repo}`
, title : `git checkout ${branch ||checkoutMap[runconfig.NODE_ENV] || runconfig.NODE_ENV} for ${repo}`
}).catch((e)=>{ console.error(e); return { error : true, message : repo} })
}
if(runconfig.NODE_ENV === 'development') performCheckout = ()=>{ return Promise.resolve(true) }
@@ -689,11 +690,21 @@ var __runcmd = function(label){
}

return any(tasks)
.then(
//target is the env is we specify in elxr use command. Default is dev
.then( //Switch to target branch
() => any([ any(gitRepos.map((repo)=>performCheckout(repo, process.env.NODE_ENV || 'development')))
, any(elevatedRunasRepos.map((repo)=>performCheckout(repo, process.env.NODE_ENV || 'development')))]) )
.then( //PULL from target branch
() => any([ any(gitRepos.map((repo)=>performPullAll(repo))), any(elevatedRunasRepos.map((repo)=>performPullAll(repo)))]) )
.then(
() => any([ any(gitRepos.map((repo)=>performCheckout(repo))), any(elevatedRunasRepos.map((repo)=>performCheckout(repo)))]) )
.then(
.then( //Switch to merge source branch
() => any([ any(gitRepos.map((repo)=>performCheckout(repo, mergeSources[process.env.NODE_ENV || 'development'] )))
, any(elevatedRunasRepos.map((repo)=>performCheckout(repo, mergeSources[process.env.NODE_ENV || 'development'])))]) )
.then( //Pull on merge source branch
() => any([ any(gitRepos.map((repo)=>performPullAll(repo))), any(elevatedRunasRepos.map((repo)=>performPullAll(repo)))]) )
.then( //Switch to target branch
() => any([ any(gitRepos.map((repo)=>performCheckout(repo, process.env.NODE_ENV || 'development')))
, any(elevatedRunasRepos.map((repo)=>performCheckout(repo, process.env.NODE_ENV || 'development')))]) )
.then( //Merge source branch to target branch
() => any([ any(gitRepos.map((repo)=>performMerge(repo))).catch(err=>{ console.error('error in performMerge ' + err)}) ,
any(elevatedRunasRepos.map((repo)=>performMerge(repo))).catch(err=>{ console.error('error in performMerge ' + err)})]) )
.then( () => {

Carregando…
Cancelar
Salvar