Bladeren bron

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

production
aaron 3 jaren geleden
bovenliggende
commit
2061213df0
2 gewijzigde bestanden met toevoegingen van 97 en 13 verwijderingen
  1. 49
    13
      index.js
  2. 48
    0
      repo-manifest.js

+ 49
- 13
index.js Bestand weergeven

@@ -629,11 +629,37 @@ var op = {

dirs(perform_git_seturl)
}
, 'add': (remotename, url, branch) => {
, 'reset' : ()=>{
// Reset the whole installation pertaining to this elxr folder.
}
, 'remote add': (args) => {
// PB : TODO -- set-upstream-to should be chosen and intentionally switched. Coz we can have multiple upstream remotes.
// Also each upstream remote may need to have is own branch to switch to. We therefore need a branch nomenclature
// That explicitly has a remote name prefix.
// git branch branch_name --set-upstream-to your_new_remote/branch_name
// git branch branch_name -u your_new_remote/branch_name -- older versions
// git branch -vv -- Detect which branch are we tracking.
// default upstream should be users own fork.
// Also need alias branches to
// define a git alias which would git pull master from one repo, and then git pull master from other remotes.
// probably git merge from all remotes... and relevant branches...
// alias pushall='for i in `git remote`; do git push $i; done;'
// alias pullall='for i in `git remote`; do git pull $i; done;'
// args === processedArgs ? args = {} : null;
var __args = {
remotename : args.remotename|| processedArgs._[2]
, url : args.url || processedArgs._[3]
, branch : args.branch || processedArgs._[4]
}
var remotename = __args.remotename
var url = __args.url
var branch = __args.branch

var pushable = processedArgs.pushable || false;
remotename = remotename || processedArgs._[1]
url = url || processedArgs._[2]
branch = branch || processedArgs._[3]


var serial_perform_git_add = (repo) => {
var options = { cwd: instanceroot + '/' + repo }
// console.log(repo)
@@ -669,18 +695,18 @@ var op = {
nodeShellExec('git', ['remote', 'get-url', remotename], { cwd: dir.name, stdio: 'ignore' }).then(() => {
console.log('skipped : ' + dir.name + ', reason : A remote with same name already exists.')
})
.catch((e) => {
any(serial_perform_git_add(dir.name).map(x))
})
.catch((e) => {
any(serial_perform_git_add(dir.name).map(x))
})
}
// else console.log('Skipped : Not a Git Repo : ' + dir.name)
}).catch((e) => {
// console.log('Failed : ' + dir.name)
console.log('Failed : ' + dir.name)
})
}

const { readdir } = require("fs").promises
dirs(perform_git_add)
}
, 'remote remove': (args) => {
@@ -2310,9 +2336,12 @@ acquireElevationState().then(() => {
// PB : TODO -- processedArgs should already be part of selected.
var instanceName = processedArgs._[1] = processedArgs._[1] || chessinstances.current_run.instanceName || selected.instanceName;
var node_env = processedArgs.node_env = processedArgs.node_env || chessinstances.current_run.node_env || selected.node_env;
chessinstances[instanceName] = chessinstances[instanceName] || {}
chessinstances[instanceName][node_env] = chessinstances[instanceName][node_env] || selected;
chessinstances['current_run'] = chessinstances[instanceName][selected.node_env] ?
{ instanceName: instanceName, node_env: node_env } : chessinstances['current_run']
// chessinstances[chessinstances.current_run.instanceName] = chessinstances[chessinstances.current_run.instanceName] || {}
{ instanceName: instanceName, node_env: node_env } : (chessinstances['current_run'] || { instanceName: instanceName, node_env: node_env })

// chessinstances[chessinstances.current_run.instanceName] = chessinstances[chessinstances.current_run.instanceName] || {}

if(path.normalize(selected.root) !== path.normalize(chessinstances[instanceName][node_env].root)) {
throw "Mismatched chessinstances config found " + chessinstances[instanceName][node_env].root + ' does not match ' + selected.root
@@ -2405,12 +2434,19 @@ acquireElevationState().then(() => {
processedArgs.node_env ? clioverrides.node_env = (process.env.NODE_ENV && process.env.NODE_ENV.trim()) || processedArgs.node_env
: (process.env.NODE_ENV && process.env.NODE_ENV.trim()) ? clioverrides.node_env = (process.env.NODE_ENV && process.env.NODE_ENV.trim()): null;
clioverrides.reconfirm = processedArgs.reconfirm
selectedinstance = Object.assign(detectedInstance, clioverrides);
var todo = Promise.resolve(true);
var promptkeys = { 'instanceName' : processedArgs._[1] }

var reconfirm = {
'instanceName' : selectedinstance['instanceName'] === 'chess'
if(clioverrides.reconfirm) {
var reconfirm = {
'instanceName' : selectedinstance['instanceName'] === 'chess'
}
}
else {
var reconfirm = {};
}
var prompts = [];
var eachPrompt = function(k, i, a){

+ 48
- 0
repo-manifest.js Bestand weergeven

@@ -0,0 +1,48 @@
module.exports = ((name, options)=>{

return {
reposervers : [
'http://git.bbh'
, 'https://git.bbh.org.in'
, '//172.16.0.27/repos'
, 'https://github.com'
]

// User can always add more branches and remotes as needed. Mainifest only occupies
// well defined namespaces
, remotes : [
// these are both fetch and push remotes. Use push - remotes to overrid.
{ 'chess' : 'http://git.bbh/chess/elxr.git' }
, { 'public-baptistdev' : 'https://github.com/baptistdev/elxr.git' }
// Multiple urls as an array doesn't tell us the current origin which may be different in
// different based on currently available/accessible to client.
// This is just a list of possible equivalent options.
, { 'origin' : [
`http://git.bbh/${options.gituser}/elxr.git`
, 'https://git.bbh.org.in/${options.gituser}/elxr.git'
, `//172.16.0.27/repos/${options.gituser}/elxr.git`
]
}
]

, 'push-remotes' : [
{ 'chess' : 'no-pushing' }
, { 'public-baptistdev' : 'no-pushing' }
, { 'public-origin' : 'no-pushing' }
]
// , 'fetch-remotes' : [] // Multiple fetch remotes are not supported by git.
// We therefore need to use
// - a pullall
// - or branch alias for multiple remote branch tracking branch strategy.
// -- This is however limited to corresponding branch names

// tracking branches.
// We at least need one branch for each remote that we wish to track.
, 'tracking-branches' : [
{ master : ['origin/master', 'chess/master'] }
]
}
})

Laden…
Annuleren
Opslaan