Procházet zdrojové kódy

Enable pulling other owner repos

pull/9/head
guest před 2 roky
rodič
revize
a128b39f11
1 změnil soubory, kde provedl 14 přidání a 13 odebrání
  1. 14
    13
      index.js

+ 14
- 13
index.js Zobrazit soubor

@@ -778,11 +778,11 @@ var getPullTask = (repodef, branch, repoowner, errHandler, elevatedBatch, regula
// PB : TODO -- add additional remotes after cloning and pull again...

var task = ()=>{
return nodeShellExec('git', ['clone', '-c', 'core.symlinks=true', selectedinstance.reposerver + `/${repoowner || defaultRepoOwner}/` + repo + '.git'],
return nodeShellExec('git', ['clone', '-c', 'core.symlinks=true', selectedinstance.reposerver + `/${repodef.owner || repoowner || defaultRepoOwner}/` + repo + '.git'],
{
inherit: true, shell: true,
env: process.env
, cwd : instanceroot
, cwd : instanceroot
, runas: processedArgs.runas
}).then(() => {

@@ -3091,7 +3091,7 @@ var configs = (function(){
)
}
// PB : TODO -- Use the ORG level instance before falling back to common Instance coz common instance may not exist for certain orgs.
, commonInstance(selected) { return __acquireConfig(selected, { defaultRepoOwner }
, commonInstance(selected) { return __acquireConfig(selected, { repoOwner : defaultRepoOwner }
, undefined
, function(e){
// PB : TODO -- console.info('This is probably an error unless the user is asking to create a new instance with this name.')
@@ -3120,7 +3120,7 @@ var configs = (function(){
throw e
}
) }
// , genericChessInstance(selected) { return __acquireConfig(selected) }
// , genericChessInstance(selected) { return __acquireConfig(selected, { repoOwner : defaultRepoOwner }) }
}
})()

@@ -3155,11 +3155,11 @@ var instanceData = (function(){
)
}
// PB : TODO -- Use the ORG level instance before falling back to common Instance coz common instance may not exist for certain orgs.
, commonInstance(selected) { return __acquireData(selected, { defaultRepoOwner }
, commonInstance(selected) { return __acquireData(selected, { repoOwner : defaultRepoOwner }
// , function(e){ console.info('This is probably an error unless the user is asking to create a new instance with this name.') }
) }
, genericChessInstance(selected) { return __acquireData(selected) }
, genericChessInstance(selected) { return __acquireData(selected, { repoOwner : defaultRepoOwner }) }
}
})()

@@ -3187,7 +3187,6 @@ function resetgitconfig(){
// git config --global credential.helper 'store --file ~/.gitcredentials'
// git credential-store --file ~/.gitcredentials store
// // notepad C:/Program Files/Git/etc/gitconfig
// git config --global --unset credential
// git config --edit --system
// git config --global credential.helper "store --file ~/gitcredentials"
// git credential fill
@@ -3261,9 +3260,10 @@ var execonce = function(taskArgs, task){ return any([task[1].push.apply(task[1],
var __acquireConfig = function (selected, options, configrepo, errHandler) {

configrepo = configrepo || selected.instanceName + '-config-' + selected.node_env;
var repoOwner = options.repoOwner || selected.username || options.defaultRepoOwner

var errorHandler = (e) => {
if(e.messages.join(' ').match(new RegExp (`fatal: unable to access '${selectedinstance.reposerver}/${selected.username || options.defaultRepoOwner}/${configrepo}.git/': Failed to connect to .*? port .*? after .*? ms: Timed out`))){
if(e.messages.join(' ').match(new RegExp (`fatal: unable to access '${selectedinstance.reposerver}/${repoOwner}/${configrepo}.git/': Failed to connect to .*? port .*? after .*? ms: Timed out`))){
// console.error('Could not connect to repo server. Timed Out')
return cli.prompt( ['(y)es', '(n)o', '(r)etry'], 'Could not connect to repo server. Timed Out. Would you like to switch server ? (y/n) ', 'y' ).then(propValue => {
@@ -3278,7 +3278,7 @@ var __acquireConfig = function (selected, options, configrepo, errHandler) {
})
}

if(e.messages.join(' ').match(new RegExp (`fatal: repository '${selectedinstance.reposerver}/${selected.username || options.defaultRepoOwner}/${configrepo}.git/' not found`))){
if(e.messages.join(' ').match(new RegExp (`fatal: repository '${selectedinstance.reposerver}/${repoOwner}/${configrepo}.git/' not found`))){
var choices = {
t : `install a new temporary local instance with this name ( will not persist ).
Use your own username for additional options. You can request for a username at chess@bbh.org.in )`
@@ -3341,7 +3341,7 @@ var __acquireConfig = function (selected, options, configrepo, errHandler) {
}

return performPull( selected.reposindexed[configrepo] || { repo : configrepo }
, null, selected.username || options.defaultRepoOwner, errHandler || errorHandler || ((e)=>{ throw e })).then( successHandler )
, null, repoOwner, errHandler || errorHandler || ((e)=>{ throw e })).then( successHandler )
.catch( (e)=>{
// if(e){
if(Promise.resolve(e) === e) return e;
@@ -3355,9 +3355,10 @@ var __acquireConfig = function (selected, options, configrepo, errHandler) {
var __acquireData = function (selected, options, datarepo, errHandler) {

datarepo = datarepo || selected.instanceName + '-data';
var repoOwner = options.repoOwner || selected.username || options.defaultRepoOwner

var errorHandler = (e) => {
if(e.messages.join(' ').match(new RegExp (`fatal: unable to access '${selectedinstance.reposerver}/${selected.username || options.defaultRepoOwner}/${datarepo}.git/': Failed to connect to .*? port .*? after .*? ms: Timed out`))){
if(e.messages.join(' ').match(new RegExp (`fatal: unable to access '${selectedinstance.reposerver}/${repoOwner}/${datarepo}.git/': Failed to connect to .*? port .*? after .*? ms: Timed out`))){
// console.error('Could not connect to repo server. Timed Out')
return cli.prompt( ['(y)es', '(n)o', '(r)etry'], 'Could not connect to repo server. Timed Out. Would you like to switch server ? (y/n) ', 'y' ).then(propValue => {
@@ -3372,7 +3373,7 @@ var __acquireData = function (selected, options, datarepo, errHandler) {
})
}

if(e.messages.join(' ').match(new RegExp (`fatal: repository '${selectedinstance.reposerver}/${selected.username || options.defaultRepoOwner}/${datarepo}.git/' not found`))){
if(e.messages.join(' ').match(new RegExp (`fatal: repository '${selectedinstance.reposerver}/${repoOwner}/${datarepo}.git/' not found`))){
var choices = {
t : `install a temporary local data folder.
For more options. Request and use a personal username at chess@bbh.org.in )`
@@ -3414,7 +3415,7 @@ var __acquireData = function (selected, options, datarepo, errHandler) {
}

return performPull( selected.reposindexed[datarepo] || { repo : datarepo }
, null, selected.username || options.defaultRepoOwner, errHandler || errorHandler || ((e)=>{ throw e })).then( successHandler )
, null, repoOwner, errHandler || errorHandler || ((e)=>{ throw e })).then( successHandler )
.catch( (e)=>{
// if(e){
if(Promise.resolve(e) === e) return e;

Načítá se…
Zrušit
Uložit