|
|
@@ -1046,8 +1046,8 @@ var op = { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
var enqueueCheckout = function(def){ enqueue(elevatedqueue, performCheckout, def) } |
|
|
|
var enqueueMerge = function(def){ enqueue(elevatedqueue, performMerge, def) } |
|
|
|
// var enqueueCheckout = function(def){ enqueue(elevatedqueue, performCheckout, def) } |
|
|
|
// var enqueueMerge = function(def){ enqueue(elevatedqueue, performMerge, def) } |
|
|
|
|
|
|
|
var elevatedqueue = []; |
|
|
|
var enqueueOnce = (queue, task, def) => { |
|
|
@@ -1095,10 +1095,10 @@ var op = { |
|
|
|
} |
|
|
|
if (runconfig.NODE_ENV === 'development') performMerge = () => { return Promise.resolve(true) } |
|
|
|
|
|
|
|
var performRepoOperation = function(def) { |
|
|
|
elevatedRunasRepos.map((repo) => enqueueCheckout({ repo, branch: def.branch, requiresElevation : true })) |
|
|
|
return any(gitRepos.map((repo) => performCheckout({ repo, branch: def.branch}))) |
|
|
|
} |
|
|
|
// var performRepoOperation = function(def) { |
|
|
|
// elevatedRunasRepos.map((repo) => enqueueCheckout({ repo, branch: def.branch, requiresElevation : true })) |
|
|
|
// return any(gitRepos.map((repo) => performCheckout({ repo, branch: def.branch}))) |
|
|
|
// } |
|
|
|
|
|
|
|
return any(tasks).then(() => { |
|
|
|
var pr = Promise.resolve(true) |
|
|
@@ -1108,28 +1108,28 @@ var op = { |
|
|
|
|
|
|
|
//target is the env is we specify in elxr use command. Default is dev |
|
|
|
//Switch to target branch |
|
|
|
return any(gitRepos.map((repo) => performCheckout({ repo, branch}))) |
|
|
|
return any(gitRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch}))) |
|
|
|
// pull or clone target branch |
|
|
|
.then(() => any(gitRepos.map((repo) => performPullAll({repo}))) ) |
|
|
|
.then(() => any(gitRepos.map((repo) => performPullAll(repo))) ) |
|
|
|
// switch to source branch |
|
|
|
.then( () => { |
|
|
|
if(mergesource) return any(gitRepos.map((repo) => performCheckout({ repo, branch: mergesource}))) |
|
|
|
if(mergesource) return any(gitRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch: mergesource}))) |
|
|
|
else return Promise.resolve(true) // Dont do anything if there is no source to merge from. |
|
|
|
}) |
|
|
|
//Pull on merge source branch |
|
|
|
.then( () => { |
|
|
|
if(!mergesource) return Promise.resolve(true) |
|
|
|
return any(gitRepos.map((repo) => performPullAll({repo}))) |
|
|
|
return any(gitRepos.map((repo) => performPullAll(repo))) |
|
|
|
}) |
|
|
|
//Switch to target branch |
|
|
|
.then( () => { |
|
|
|
if(!mergesource) return Promise.resolve(true) |
|
|
|
return any(elevatedRunasRepos.map((repo) => performCheckout({ repo, branch}))) |
|
|
|
return any(elevatedRunasRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch}))) |
|
|
|
}) |
|
|
|
.then( //Merge source branch to target branch |
|
|
|
() => { |
|
|
|
if(!mergesource) return Promise.resolve(true) |
|
|
|
return any(gitRepos.map((repo) => performMerge({ repo }))).catch(err => { console.error('error in performMerge ' + err) }) |
|
|
|
return any(gitRepos.map((repo) => performMerge( repo ))).catch(err => { console.error('error in performMerge ' + err) }) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
@@ -1161,28 +1161,28 @@ var op = { |
|
|
|
} |
|
|
|
|
|
|
|
return any(tasks).then(()=>{ |
|
|
|
return any(elevatedRunasRepos.map((repo) => performCheckout({ repo, branch, requiresElevation : true}))) |
|
|
|
return any(elevatedRunasRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch, requiresElevation : true}))) |
|
|
|
// pull or clone target branch |
|
|
|
.then( () => any(elevatedRunasRepos.map((repo) => performPullAll({repo}))) ) |
|
|
|
.then( () => any(elevatedRunasRepos.map((repo) => performPullAll(repo))) ) |
|
|
|
// switch to source branch |
|
|
|
.then( () => { |
|
|
|
if(mergesource) return any(elevatedRunasRepos.map((repo) => performCheckout({ repo, branch: mergesource, requiresElevation : true}))) |
|
|
|
if(mergesource) return any(elevatedRunasRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch: mergesource, requiresElevation : true}))) |
|
|
|
else return Promise.resolve(true) // Dont do anything if there is no source to merge from. |
|
|
|
}) |
|
|
|
//Pull on merge source branch |
|
|
|
.then( () => { |
|
|
|
if(!mergesource) return Promise.resolve(true) |
|
|
|
return any(elevatedRunasRepos.map((repo) => performPullAll({repo, requiresElevation : true }))) |
|
|
|
return any(elevatedRunasRepos.map((repodef) => performPullAll({repo : repodef.repo, requiresElevation : true }))) |
|
|
|
}) |
|
|
|
//Switch to target branch |
|
|
|
.then( () => { |
|
|
|
if(!mergesource) return Promise.resolve(true) |
|
|
|
return any(elevatedRunasRepos.map((repo) => performCheckout({ repo, branch, requiresElevation : true}))) |
|
|
|
return any(elevatedRunasRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch, requiresElevation : true}))) |
|
|
|
}) |
|
|
|
.then( //Merge source branch to target branch |
|
|
|
() => { |
|
|
|
if(!mergesource) return Promise.resolve(true) |
|
|
|
return any(elevatedRunasRepos.map((repo) => performMerge({ repo, requiresElevation : true }))).catch(err => { console.error('error in performMerge ' + err) }) |
|
|
|
return any(elevatedRunasRepos.map((repodef) => performMerge({ repo : repodef.repo, requiresElevation : true }))).catch(err => { console.error('error in performMerge ' + err) }) |
|
|
|
}) |
|
|
|
.then(() => { |
|
|
|
fs.writeFileSync('run.done', 'success') |