|
|
@@ -424,15 +424,16 @@ var __runcmd = function(label){ |
|
|
|
, 'is-git-repo' : (dir)=>{ |
|
|
|
return nodeShellExec('git', ['-C', dir.name, 'rev-parse'], { stdio : 'ignore'}) |
|
|
|
} |
|
|
|
, 'add' : (remotename, url) => { |
|
|
|
, 'add' : (remotename, url, branch) => { |
|
|
|
remotename = remotename || processedArgs._[1] |
|
|
|
url = url || processedArgs._[2] |
|
|
|
var branch = 'master'; |
|
|
|
branch = branch || processedArgs._[3] |
|
|
|
var serial_perform_git_add = (repo)=>{ |
|
|
|
var options = { cwd : repo } |
|
|
|
// console.log(repo) |
|
|
|
return [ |
|
|
|
['git', ['remote', 'add', remotename, url + '/' + repo], { cwd : repo }] |
|
|
|
, ['git', ['remote', `set-url`, '--push', remotename, 'no-pushing'], { cwd : repo }] |
|
|
|
, ['git', ['pull', remotename, branch], { cwd : repo }] |
|
|
|
, ['git', ['branch', `--set-upstream-to=${remotename}/${branch}`, branch], { cwd : repo }] |
|
|
|
] |
|
|
@@ -449,7 +450,7 @@ var __runcmd = function(label){ |
|
|
|
// console.log(code) |
|
|
|
if(code) { |
|
|
|
nodeShellExec('git',['remote', 'get-url', remotename], { cwd : dir.name, stdio : 'ignore' }).then(()=>{ |
|
|
|
console.log('skipped : ' + dir.name + ', reason : No remote named origin') |
|
|
|
console.log('skipped : ' + dir.name + ', reason : A remote with same name already exists.') |
|
|
|
}) |
|
|
|
.catch((e)=>{ |
|
|
|
any( serial_perform_git_add(dir.name).map(x) ) |
|
|
@@ -577,8 +578,11 @@ var __runcmd = function(label){ |
|
|
|
|
|
|
|
var useGitPull = processedArgs.useGitPull || false; |
|
|
|
var getPullCmd = (repo)=>{ |
|
|
|
// console.log(useGitPull) |
|
|
|
|
|
|
|
var pullCmd = ["C:\\Program Files\\Git\\bin\\sh.exe", ['-c', 'branch=`git rev-parse --abbrev-ref HEAD`;for i in `git remote`; do git pull $i $branch; done;'], { cwd : repo }] |
|
|
|
var pullCmd = ["C:\\Program Files\\Git\\bin\\sh.exe" |
|
|
|
, ['-c', 'branch=`git rev-parse --abbrev-ref HEAD`;for i in `git remote`; do git pull $i $branch; done;'] |
|
|
|
, { cwd : repo, title : 'pull all origins for ' + repo }] |
|
|
|
// var pullCmd = ['pullall', [], { cwd : repo }] |
|
|
|
if(useGitPull) pullCmd = ['git', ['pull'], { |
|
|
|
inherit : true, shell: true, |