浏览代码

Merge branch 'master' of JArun2018/elxr into master

master
pb 4 年前
父节点
当前提交
1fe48e926a
共有 1 个文件被更改,包括 8 次插入4 次删除
  1. 8
    4
      index.js

+ 8
- 4
index.js 查看文件

@@ -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,

正在加载...
取消
保存