| author | Maciej Bendkowski | 2012-09-21 07:22:13 (EDT) |
|---|---|---|
| committer | Malgorzata Janczarska | 2012-09-26 10:37:08 (EDT) |
| commit | 10b30aa81a740ad3d4eee4f45a0b4df92546faa4 (patch) (side-by-side diff) | |
| tree | f17b71d1c958ecda10392cbb4d03ed1e97f7317e | |
| parent | 2ead6fd4d247439c9c77563f6e382d8c04c8ba38 (diff) | |
| download | org.eclipse.orion.client-10b30aa81a740ad3d4eee4f45a0b4df92546faa4.zip org.eclipse.orion.client-10b30aa81a740ad3d4eee4f45a0b4df92546faa4.tar.gz org.eclipse.orion.client-10b30aa81a740ad3d4eee4f45a0b4df92546faa4.tar.bz2 | |
Bug 390085 - Force Fetch command does not use saved private keyv20120926-1437
| -rw-r--r-- | bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js | 118 |
1 files changed, 68 insertions, 50 deletions
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js index 057e94e..c5b868d 100644 --- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js +++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js @@ -992,57 +992,75 @@ var exports = {}; commandService.collectParameters(commandInvocation); }; - if (commandInvocation.parameters && commandInvocation.parameters.optionsRequested){ - commandInvocation.parameters = null; - commandInvocation.optionsRequested = true; - commandService.collectParameters(commandInvocation); - return; - } - - exports.gatherSshCredentials(serviceRegistry, commandInvocation).then( - function(options) { - var gitService = serviceRegistry.getService("orion.git.provider"); //$NON-NLS-0$ - var statusService = serviceRegistry.getService("orion.page.message"); //$NON-NLS-0$ - var deferred = gitService.doFetch(path, true, - options.gitSshUsername, - options.gitSshPassword, - options.knownHosts, - options.gitPrivateKey, - options.gitPassphrase); - statusService.createProgressMonitor(deferred, messages['Fetching remote: '] + path); - deferred.then( - function(jsonData, secondArg) { - exports.handleProgressServiceResponse2(jsonData, serviceRegistry, - function() { - gitService.getGitRemote(path).then( - function(jsonData){ - var remoteJsonData = jsonData; - if (explorer.parentId === "explorer-tree") { //$NON-NLS-0$ - dojo.place(document.createTextNode(messages['Getting git incoming changes...']), "explorer-tree", "only"); //$NON-NLS-2$ //$NON-NLS-1$ - gitService.getLog(remoteJsonData.HeadLocation, remoteJsonData.Id).then(function(loadScopedCommitsList) { - explorer.renderer.setIncomingCommits(loadScopedCommitsList.Children); - explorer.loadCommitsList(remoteJsonData.CommitLocation + "?page=1", remoteJsonData, true); //$NON-NLS-0$ - }); - } - dojo.hitch(explorer, explorer.changedItem)(item); - }, displayErrorOnStatus - ); - }, function (jsonData) { - handleResponse(jsonData, commandInvocation); - } - ); - }, function(jsonData, secondArg) { - exports.handleProgressServiceResponse2(jsonData, serviceRegistry, - function() { - - }, function (jsonData) { - handleResponse(jsonData, commandInvocation); - } - ); - } - ); + var fetchForceLogic = function(){ + if (commandInvocation.parameters && commandInvocation.parameters.optionsRequested){ + commandInvocation.parameters = null; + commandInvocation.optionsRequested = true; + commandService.collectParameters(commandInvocation); + return; } - ); + + exports.gatherSshCredentials(serviceRegistry, commandInvocation).then( + function(options) { + var gitService = serviceRegistry.getService("orion.git.provider"); //$NON-NLS-0$ + var statusService = serviceRegistry.getService("orion.page.message"); //$NON-NLS-0$ + var deferred = gitService.doFetch(path, true, + options.gitSshUsername, + options.gitSshPassword, + options.knownHosts, + options.gitPrivateKey, + options.gitPassphrase); + statusService.createProgressMonitor(deferred, messages['Fetching remote: '] + path); + deferred.then( + function(jsonData, secondArg) { + exports.handleProgressServiceResponse2(jsonData, serviceRegistry, + function() { + gitService.getGitRemote(path).then( + function(jsonData){ + var remoteJsonData = jsonData; + if (explorer.parentId === "explorer-tree") { //$NON-NLS-0$ + dojo.place(document.createTextNode(messages['Getting git incoming changes...']), "explorer-tree", "only"); //$NON-NLS-2$ //$NON-NLS-1$ + gitService.getLog(remoteJsonData.HeadLocation, remoteJsonData.Id).then(function(loadScopedCommitsList) { + explorer.renderer.setIncomingCommits(loadScopedCommitsList.Children); + explorer.loadCommitsList(remoteJsonData.CommitLocation + "?page=1", remoteJsonData, true); //$NON-NLS-0$ + }); + } + dojo.hitch(explorer, explorer.changedItem)(item); + }, displayErrorOnStatus + ); + }, function (jsonData) { + handleResponse(jsonData, commandInvocation); + } + ); + }, function(jsonData, secondArg) { + exports.handleProgressServiceResponse2(jsonData, serviceRegistry, + function() { + + }, function (jsonData) { + handleResponse(jsonData, commandInvocation); + } + ); + } + ); + } + ); + }; + + //TODO HACK remoteTrackingBranch does not provide git url - we have to collect manually + if(!commandInvocation.items.GitUrl){ + // have to determine manually + var gitService = serviceRegistry.getService("orion.git.provider"); + gitService.getGitRemote(path).then( + function(resp){ + gitService.getGitClone(resp.CloneLocation).then( + function(resp){ + commandInvocation.items.GitUrl = resp.Children[0].GitUrl; + fetchForceLogic(); + } + ); + } + ); + } else { fetchForceLogic(); } }, visibleWhen : function(item) { if (item.Type === "RemoteTrackingBranch") //$NON-NLS-0$ |

