summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorEdyta Przymus2012-07-16 07:11:32 (EDT)
committer Szymon Brandys2012-07-17 04:22:24 (EDT)
commit3d5fed6d09464d520a97e4f2fe3f680a7a11670a (patch)
treeba4a4cd3cd7f02fe204d8a4985cf9d2f5f16cfc8
parentb590129434c31d60a459281d8014e9eb0f726126 (diff)
downloadorg.eclipse.orion.client-3d5fed6d09464d520a97e4f2fe3f680a7a11670a.zip
org.eclipse.orion.client-3d5fed6d09464d520a97e4f2fe3f680a7a11670a.tar.gz
org.eclipse.orion.client-3d5fed6d09464d520a97e4f2fe3f680a7a11670a.tar.bz2
Bug 361025 - Simplify switching remotes
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js401
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/widgets/ConfirmPushDialog.js51
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/widgets/RemotePrompterDialog.js13
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/widgets/templates/ConfirmPushDialog.html22
4 files changed, 340 insertions, 147 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 9729c6e..ea72e9a 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
@@ -13,7 +13,7 @@
/*jslint browser:true eqeqeq:false laxbreak:true */
define(['i18n!git/nls/gitmessages', 'require', 'dojo', 'orion/commands', 'orion/util', 'orion/git/util', 'orion/compare/compareUtils', 'orion/git/widgets/CloneGitRepositoryDialog',
'orion/git/widgets/AddRemoteDialog', 'orion/git/widgets/GitCredentialsDialog', 'orion/widgets/NewItemDialog',
- 'orion/git/widgets/RemotePrompterDialog', 'orion/git/widgets/ApplyPatchDialog', 'orion/git/widgets/OpenCommitDialog',
+ 'orion/git/widgets/RemotePrompterDialog', 'orion/git/widgets/ApplyPatchDialog', 'orion/git/widgets/OpenCommitDialog', 'orion/git/widgets/ConfirmPushDialog',
'orion/git/widgets/ContentDialog', 'orion/git/widgets/CommitDialog'],
function(messages, require, dojo, mCommands, mUtil, mGitUtil, mCompareUtils) {
@@ -1183,7 +1183,7 @@ var exports = {};
}
});
commandService.addCommand(rebaseCommand);
-
+
var pushCommand = new mCommands.Command({
name : messages["Push All"],
tooltip: messages["Push commits and tags from your local branch into the remote branch"],
@@ -1191,15 +1191,16 @@ var exports = {};
spriteClass: "gitCommandSprite", //$NON-NLS-0$
id : "eclipse.orion.git.push", //$NON-NLS-0$
callback: function(data) {
-
+ var target;
var item = data.items;
var path = dojo.hash();
if (item.toRef) {
item = item.toRef;
}
-
var commandInvocation = data;
+ var parts = item.CloneLocation.split("/");
+
var handleResponse = function(jsonData, commandInvocation){
if (jsonData.JsonData.HostKey){
commandInvocation.parameters = null;
@@ -1220,44 +1221,103 @@ var exports = {};
commandService.collectParameters(commandInvocation);
return;
}
-
- exports.gatherSshCredentials(serviceRegistry, commandInvocation).then(
- function(options) {
-
- var gitService = serviceRegistry.getService("orion.git.provider"); //$NON-NLS-0$
- if (item.RemoteLocation.length == 1 && item.RemoteLocation[0].Children.length == 1) {
- var progressService = serviceRegistry.getService("orion.page.message"); //$NON-NLS-0$
- progressService.createProgressMonitor(gitService.doPush(item.RemoteLocation[0].Children[0].Location, "HEAD", true, false, //$NON-NLS-0$
- options.gitSshUsername, options.gitSshPassword,
- options.knownHosts, options.gitPrivateKey, options.gitPassphrase), messages["Pushing remote: "] + path).deferred.then(
- function(jsonData){
- exports.handleProgressServiceResponse2(jsonData, serviceRegistry,
- function() {
- if (explorer.parentId === "explorer-tree") { //$NON-NLS-0$
- if (!jsonData || !jsonData.HttpCode)
- dojo.query(".treeTableRow").forEach(function(node, i) { //$NON-NLS-0$
- dojo.toggleClass(node, "outgoingCommitsdRow", false); //$NON-NLS-0$
- });
- } else {
- dojo.hitch(explorer, explorer.changedItem)();
- }
- }, function (jsonData) {
- handleResponse(jsonData, commandInvocation);
- }
- );
- }, function(jsonData, secondArg) {
- exports.handleProgressServiceResponse2(jsonData, serviceRegistry,
- function() {
-
- }, function (jsonData) {
- handleResponse(jsonData, commandInvocation);
+ var gitService = serviceRegistry.getService("orion.git.provider");
+
+ var handlePush = function(options, location, ref, name, force){
+ var progressService = serviceRegistry.getService("orion.page.message"); //$NON-NLS-0$
+ progressService.createProgressMonitor(gitService.doPush(location, ref, true, force, //$NON-NLS-0$
+ options.gitSshUsername, options.gitSshPassword, options.knownHosts,
+ options.gitPrivateKey, options.gitPassphrase), messages['Pushing remote: '] + name).deferred.then(
+ function(jsonData){
+ exports.handleProgressServiceResponse2(jsonData, serviceRegistry,
+ function() {
+ if (explorer.parentId === "explorer-tree") { //$NON-NLS-0$
+ if (!jsonData || !jsonData.HttpCode)
+ dojo.query(".treeTableRow").forEach(function(node, i) { //$NON-NLS-0$
+ dojo.toggleClass(node, "outgoingCommitsdRow", false); //$NON-NLS-0$
+ });
+ } else {
+ dojo.hitch(explorer, explorer.changedItem)();
}
- );
- }
- );
- } else {
+ }, function (jsonData) {
+ handleResponse(jsonData, commandInvocation);
+ }
+ );
+ }, function(jsonData, secondArg) {
+ exports.handleProgressServiceResponse2(jsonData, serviceRegistry,
+ function() {
+
+ }, function (jsonData) {
+ handleResponse(jsonData, commandInvocation);
+ }
+ );
+ }
+ );
+ };
+
+ gitService.getGitClone(item.CloneLocation).then(
+ function(clone){
+ var remoteLocation = clone.Children[0].RemoteLocation;
+ var locationToChange = clone.Children[0].ConfigLocation;
+ exports.gatherSshCredentials(serviceRegistry, commandInvocation).then(
+ function(options) {
+ if (item.RemoteLocation.length == 1 && item.RemoteLocation[0].Children.length == 1) { //when we push next time - chance to switch saved remote
+ gitService.getGitRemote(remoteLocation).then(
+ function(resp){
+ var remotes = resp.Children;
+ var dialog = new orion.git.widgets.RemotePrompterDialog({
+ title: messages["Choose Branch"],
+ serviceRegistry: serviceRegistry,
+ gitClient: gitService,
+ treeRoot: {
+ Children: remotes
+ },
+ hideNewBranch: false,
+ func: dojo.hitch(this,
+ function(targetBranch, remote, optional) {//third argument occurs when remote name is typed, not selected from the list
+ if(targetBranch === null){
+ target = optional;
+ }
+ else{
+ target = targetBranch;
+ }
+ var locationToUpdate = "/gitapi/config/" + "branch." + item.Name + ".remote" + "/clone/file/" + parts[4];
+ gitService.addCloneConfigurationProperty(locationToChange,"branch." + item.Name + ".remote" ,target.parent.Name).then(
+ function(){
+ handlePush(options, target.Location, "HEAD",target.Name, false);
+ },
+ function(err){
+ if(err.status == 409){ //when confing entry is already defined we have to edit it
+ gitService.editCloneConfigurationProperty(locationToUpdate,target.parent.Name).then(
+ function(){
+ handlePush(options, target.Location, "HEAD",target.Name, false);
+ },
+ function(error){
+ }
+ );
+ }
+ }
+ );
+ }
+ )
+ });
+ var dialog2 = new orion.git.widgets.ConfirmPushDialog({
+ title: messages["Choose Branch"],
+ serviceRegistry: serviceRegistry,
+ gitClient: gitService,
+ dialog: dialog,
+ location: item.RemoteLocation[0].Children[0].Name,
+ func: dojo.hitch(this, function(){handlePush(options,item.RemoteLocation[0].Children[0].Location, "HEAD", path, true);})
+ });
+ dialog2.startup();
+ dialog2.show();
+ },
+ function(err){
+ }
+ );
+ }
+ else { //pushing first time - branch tracs no remote yet
var remotes = item.RemoteLocation;
-
var dialog = new orion.git.widgets.RemotePrompterDialog({
title: messages["Choose Branch"],
serviceRegistry: serviceRegistry,
@@ -1265,54 +1325,51 @@ var exports = {};
treeRoot: {
Children: remotes
},
- hideNewBranch: true,
+ hideNewBranch: false,
func: dojo.hitch(this,
- function(targetBranch, remote) {
- var progressService = serviceRegistry.getService("orion.page.message"); //$NON-NLS-0$
- progressService.createProgressMonitor(gitService.doPush(targetBranch.Location, "HEAD", true, true, //$NON-NLS-0$
- options.gitSshUsername, options.gitSshPassword, options.knownHosts,
- options.gitPrivateKey, options.gitPassphrase), messages['Pushing remote: '] + remote.Name).deferred.then(
- function(jsonData){
- exports.handleProgressServiceResponse2(jsonData, serviceRegistry,
- function() {
- if (explorer.parentId === "explorer-tree") { //$NON-NLS-0$
- if (!jsonData || !jsonData.HttpCode)
- dojo.query(".treeTableRow").forEach(function(node, i) { //$NON-NLS-0$
- dojo.toggleClass(node, "outgoingCommitsdRow", false); //$NON-NLS-0$
- });
- } else {
- dojo.hitch(explorer, explorer.changedItem)();
+ function(targetBranch, remote, optional) {
+ if(targetBranch === null){
+ target = optional;
+ }
+ else{
+ target = targetBranch;
+ }
+ var locationToUpdate = "/gitapi/config/" + "branch." + item.Name + ".remote" + "/clone/file/" + parts[4];
+ gitService.addCloneConfigurationProperty(locationToChange,"branch." + item.Name + ".remote" ,target.parent.Name).then(
+ function(){
+ handlePush(options, target.Location, "HEAD",target.Name, false);
+ },
+ function(err){
+ if(err.status == 409){ //when confing entry is already defined we have to edit it
+ gitService.editCloneConfigurationProperty(locationToUpdate,target.parent.Name).then(
+ function(){
+ handlePush(options, target.Location, "HEAD",target.Name, false);
}
- }, function (jsonData) {
- handleResponse(jsonData, commandInvocation);
- }
- );
- }, function(jsonData, secondArg) {
- exports.handleProgressServiceResponse2(jsonData, serviceRegistry,
- function() {
-
- }, function (jsonData) {
- handleResponse(jsonData, commandInvocation);
- }
- );
+ );
+ }
}
);
}
)
});
- dialog.startup();
- dialog.show();
- }
+ dialog.startup();
+ dialog.show();
+ }
+ }
+ );
}
- );
+ );
},
visibleWhen : function(item) {
if (item.toRef)
// for action in the git log
return item.RepositoryPath === "" && item.toRef.Type === "Branch" && item.toRef.Current && item.toRef.RemoteLocation; //$NON-NLS-0$
else
+ if(item.Type === "LocalBranch")
+ return true;
// for action in the repo view
return item.Type === "Branch" && item.Current && item.RemoteLocation; //$NON-NLS-0$
+
}
});
commandService.addCommand(pushCommand);
@@ -1326,15 +1383,16 @@ var exports = {};
callback: function(data) {
if(!confirm(messages["You're going to override content of the remote branch. This can cause the remote repository to lose commits."]+"\n\n"+messages['Are you sure?'])) //$NON-NLS-1$
return;
-
+ var target;
var item = data.items;
var path = dojo.hash();
if (item.toRef) {
item = item.toRef;
}
-
var commandInvocation = data;
+ var parts = item.CloneLocation.split("/");
+
var handleResponse = function(jsonData, commandInvocation){
if (jsonData.JsonData.HostKey){
commandInvocation.parameters = null;
@@ -1355,97 +1413,152 @@ var exports = {};
commandService.collectParameters(commandInvocation);
return;
}
-
- exports.gatherSshCredentials(serviceRegistry, commandInvocation).then(
- function(options) {
-
- var gitService = serviceRegistry.getService("orion.git.provider"); //$NON-NLS-0$
- if (item.RemoteLocation.length == 1 && item.RemoteLocation[0].Children.length == 1) {
- var progressService = serviceRegistry.getService("orion.page.message"); //$NON-NLS-0$
- progressService.createProgressMonitor(gitService.doPush(item.RemoteLocation[0].Children[0].Location, "HEAD", true, true, //$NON-NLS-0$
- options.gitSshUsername, options.gitSshPassword,
- options.knownHosts, options.gitPrivateKey, options.gitPassphrase), messages['Pushing remote: '] + path).deferred.then(
- function(jsonData){
- exports.handleProgressServiceResponse2(jsonData, serviceRegistry,
- function() {
- if (explorer.parentId === "explorer-tree") { //$NON-NLS-0$
- if (!jsonData || !jsonData.HttpCode)
- dojo.query(".treeTableRow").forEach(function(node, i) { //$NON-NLS-0$
- dojo.toggleClass(node, "outgoingCommitsdRow", false); //$NON-NLS-0$
- });
- } else {
- dojo.hitch(explorer, explorer.changedItem)();
- }
- }, function (jsonData) {
- handleResponse(jsonData, commandInvocation);
- }
- );
- }, function(jsonData, secondArg) {
- exports.handleProgressServiceResponse2(jsonData, serviceRegistry,
- function() {
-
- }, function (jsonData) {
- handleResponse(jsonData, commandInvocation);
+ var gitService = serviceRegistry.getService("orion.git.provider");
+
+ var handlePush = function(options, location, ref, name, force){
+ var progressService = serviceRegistry.getService("orion.page.message"); //$NON-NLS-0$
+ progressService.createProgressMonitor(gitService.doPush(location, ref, true, force, //$NON-NLS-0$
+ options.gitSshUsername, options.gitSshPassword, options.knownHosts,
+ options.gitPrivateKey, options.gitPassphrase), messages['Pushing remote: '] + name).deferred.then(
+ function(jsonData){
+ exports.handleProgressServiceResponse2(jsonData, serviceRegistry,
+ function() {
+ if (explorer.parentId === "explorer-tree") { //$NON-NLS-0$
+ if (!jsonData || !jsonData.HttpCode)
+ dojo.query(".treeTableRow").forEach(function(node, i) { //$NON-NLS-0$
+ dojo.toggleClass(node, "outgoingCommitsdRow", false); //$NON-NLS-0$
+ });
+ } else {
+ dojo.hitch(explorer, explorer.changedItem)();
}
- );
- }
- );
- } else {
+ }, function (jsonData) {
+ handleResponse(jsonData, commandInvocation);
+ }
+ );
+ }, function(jsonData, secondArg) {
+ exports.handleProgressServiceResponse2(jsonData, serviceRegistry,
+ function() {
+
+ }, function (jsonData) {
+ handleResponse(jsonData, commandInvocation);
+ }
+ );
+ }
+ );
+ };
+
+ gitService.getGitClone(item.CloneLocation).then(
+ function(clone){
+ var remoteLocation = clone.Children[0].RemoteLocation;
+ var locationToChange = clone.Children[0].ConfigLocation;
+ exports.gatherSshCredentials(serviceRegistry, commandInvocation).then(
+ function(options) {
+ if (item.RemoteLocation.length == 1 && item.RemoteLocation[0].Children.length == 1) { //when we push next time - chance to switch saved remote
+ gitService.getGitRemote(remoteLocation).then(
+ function(resp){
+ var remotes = resp.Children;
+ var dialog = new orion.git.widgets.RemotePrompterDialog({
+ title: messages["Choose Branch"],
+ serviceRegistry: serviceRegistry,
+ gitClient: gitService,
+ treeRoot: {
+ Children: remotes
+ },
+ hideNewBranch: false,
+ func: dojo.hitch(this,
+ function(targetBranch, remote, optional) {//third argument occurs when remote name is typed, not selected from the list
+ if(targetBranch === null){
+ target = optional;
+ }
+ else{
+ target = targetBranch;
+ }
+ var locationToUpdate = "/gitapi/config/" + "branch." + item.Name + ".remote" + "/clone/file/" + parts[4];
+ gitService.addCloneConfigurationProperty(locationToChange,"branch." + item.Name + ".remote" ,target.parent.Name).then(
+ function(){
+ handlePush(options, target.Location, "HEAD",target.Name, true);
+ },
+ function(err){
+ if(err.status == 409){ //when confing entry is already defined we have to edit it
+ gitService.editCloneConfigurationProperty(locationToUpdate,target.parent.Name).then(
+ function(){
+ handlePush(options, target.Location, "HEAD",target.Name, true);
+ },
+ function(error){
+ }
+ );
+ }
+ }
+ );
+ }
+ )
+ });
+ var dialog2 = new orion.git.widgets.ConfirmPushDialog({
+ title: messages["Choose Branch"],
+ serviceRegistry: serviceRegistry,
+ gitClient: gitService,
+ dialog: dialog,
+ location: item.RemoteLocation[0].Children[0].Name,
+ func: dojo.hitch(this, function(){handlePush(options,item.RemoteLocation[0].Children[0].Location, "HEAD", path, true);})
+ });
+ dialog2.startup();
+ dialog2.show();
+ },
+ function(err){
+ }
+ );
+ }
+ else { //pushing first time - branch tracs no remote yet
var remotes = item.RemoteLocation;
-
var dialog = new orion.git.widgets.RemotePrompterDialog({
- title: messages['Choose Branch'],
+ title: messages["Choose Branch"],
serviceRegistry: serviceRegistry,
gitClient: gitService,
treeRoot: {
Children: remotes
},
- hideNewBranch: true,
+ hideNewBranch: false,
func: dojo.hitch(this,
- function(targetBranch, remote) {
- var progressService = serviceRegistry.getService("orion.page.message"); //$NON-NLS-0$
- progressService.createProgressMonitor(gitService.doPush(targetBranch.Location, "HEAD", true, true, //$NON-NLS-0$
- options.gitSshUsername, options.gitSshPassword, options.knownHosts,
- options.gitPrivateKey, options.gitPassphrase), messages['Pushing remote: '] + remote.Name).deferred.then(
- function(jsonData){
- exports.handleProgressServiceResponse2(jsonData, serviceRegistry,
- function() {
- if (explorer.parentId === "explorer-tree") { //$NON-NLS-0$
- if (!jsonData || !jsonData.HttpCode)
- dojo.query(".treeTableRow").forEach(function(node, i) { //$NON-NLS-0$
- dojo.toggleClass(node, "outgoingCommitsdRow", false); //$NON-NLS-0$
- });
- } else {
- dojo.hitch(explorer, explorer.changedItem)();
+ function(targetBranch, remote, optional) {
+ if(targetBranch === null){
+ target = optional;
+ }
+ else{
+ target = targetBranch;
+ }
+ var locationToUpdate = "/gitapi/config/" + "branch." + item.Name + ".remote" + "/clone/file/" + parts[4];
+ gitService.addCloneConfigurationProperty(locationToChange,"branch." + item.Name + ".remote" ,target.parent.Name).then(
+ function(){
+ handlePush(options, target.Location, "HEAD",target.Name, true);
+ },
+ function(err){
+ if(err.status == 409){ //when confing entry is already defined we have to edit it
+ gitService.editCloneConfigurationProperty(locationToUpdate,target.parent.Name).then(
+ function(){
+ handlePush(options, target.Location, "HEAD",target.Name, true);
}
- }, function (jsonData) {
- handleResponse(jsonData, commandInvocation);
- }
- );
- }, function(jsonData, secondArg) {
- exports.handleProgressServiceResponse2(jsonData, serviceRegistry,
- function() {
-
- }, function (jsonData) {
- handleResponse(jsonData, commandInvocation);
- }
- );
+ );
+ }
}
);
}
)
});
- dialog.startup();
- dialog.show();
- }
+ dialog.startup();
+ dialog.show();
+ }
+ }
+ );
}
- );
-
+ );
},
visibleWhen : function(item) {
if (item.toRef)
// for action in the git log
+ if(item.Type === "LocalBranch")
+ return true;
return item.RepositoryPath === "" && item.toRef.Type === "Branch" && item.toRef.Current && item.toRef.RemoteLocation; //$NON-NLS-0$
+
}
});
commandService.addCommand(pushForceCommand);
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/ConfirmPushDialog.js b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/ConfirmPushDialog.js
new file mode 100644
index 0000000..ac55004
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/ConfirmPushDialog.js
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * @license
+ * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0
+ * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+/*jslint browser:true*/
+/*global alert confirm orion window widgets eclipse:true serviceRegistry define */
+define(['i18n!git/nls/gitmessages', 'dojo', 'dijit', 'dojox', 'dijit/Dialog', "orion/util", 'dojo/data/ItemFileReadStore', 'dojox/form/Uploader', 'dojox/form/uploader/FileList',
+ 'dojox/form/uploader/plugins/IFrame', 'dijit/form/Button','dijit/ProgressBar', 'orion/widgets/_OrionDialogMixin',
+ 'text!orion/git/widgets/templates/ConfirmPushDialog.html'], function(messages, dojo, dijit,dojox) {
+
+
+ dojo.declare("orion.git.widgets.ConfirmPushDialog", [dijit.Dialog, orion.widgets._OrionDialogMixin], { //$NON-NLS-0$
+ widgetsInTemplate: true,
+ templateString: dojo.cache('orion', 'git/widgets/templates/ConfirmPushDialog.html'), //$NON-NLS-1$ //$NON-NLS-0$
+
+ constructor : function() {
+ this.inherited(arguments);
+ this.options = arguments[0] || {};
+ },
+ postMixInProperties : function() {
+ this.inherited(arguments);
+ this.title = "Git Push";
+
+ },
+ postCreate: function() {
+ var that = this;
+ this.inherited(arguments);
+ this.dialog = this.options.dialog;
+ var header = dojo.byId("div1");
+ var button = dojo.byId("moreButton");
+ var dialog2 = this.options.dialog;
+ header.innerHTML = "You are going to push to the following remote: " + this.options.location + "<br><br> Click More to push to another remote or OK to push to default" ;
+ dojo.connect(button,"onclick",function(){
+ dialog2.startup();
+ dialog2.show();
+ that.destroy();
+ });
+
+ },
+ execute: function() {
+ this.options.func();
+ }
+
+});
+}); \ No newline at end of file
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/RemotePrompterDialog.js b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/RemotePrompterDialog.js
index af24363..272e02d 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/RemotePrompterDialog.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/RemotePrompterDialog.js
@@ -107,12 +107,12 @@ dojo.declare("orion.git.widgets.RemotePrompterDialog", [ dijit.Dialog, orion.wid
validate : function(){
var selectedItems = this.treeWidget.getSelectedItems();
- if(selectedItems.length==1){
+ if(selectedItems.length===1){
if(selectedItems[0].Type==="RemoteTrackingBranch"){ //$NON-NLS-0$
this.RemoteBrowserButton.disabled = false;
return;
}else if(selectedItems[0].Type==="Remote"){ //$NON-NLS-0$
- if(this.newBranch.value!=""){
+ if(this.newBranch.value!==""){
this.RemoteBrowserButton.disabled = false;
return;
}
@@ -128,7 +128,14 @@ dojo.declare("orion.git.widgets.RemotePrompterDialog", [ dijit.Dialog, orion.wid
if(selectedItems[0].Type==="RemoteTrackingBranch"){ //$NON-NLS-0$
this.options.func(selectedItems[0], selectedItems[0].parent);
}else{
- this.options.func(null, selectedItems[0], this.newBranch.value);
+ var id = selectedItems[0].CloneLocation.split("/")[4];
+ var newBranchObject = new Object();
+ newBranchObject.parent = selectedItems[0];
+ newBranchObject.FullName = "refs/remotes/" + selectedItems[0].Name + "/" + this.newBranch.value;
+ newBranchObject.Name = selectedItems[0].Name + "/" + this.newBranch.value;
+ newBranchObject.Type = "RemoteTrackingBranch";
+ newBranchObject.Location= "/gitapi/remote/" + selectedItems[0].Name + "/" + this.newBranch.value + "/file/" + id;
+ this.options.func(null, selectedItems[0], newBranchObject);
}
}
delete this.options.func; //prevent performing this action twice (IE)
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/templates/ConfirmPushDialog.html b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/templates/ConfirmPushDialog.html
new file mode 100644
index 0000000..8d0a33c
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/templates/ConfirmPushDialog.html
@@ -0,0 +1,22 @@
+<div class="dijitDialog" tabindex="-1" waiRole="dialog" waiState="labelledby-${id}_title">
+ <div dojoAttachPoint="titleBar" class="dijitDialogTitleBar">
+ <span dojoAttachPoint="titleNode" class="dijitDialogTitle" id="${id}_title"></span>
+ <span dojoAttachPoint="closeButtonNode" class="dijitDialogCloseIcon" dojoAttachEvent="onclick: onCancel" title="${buttonCancel}">
+ <span dojoAttachPoint="closeText" class="closeText" title="${buttonCancel}">x</span>
+ </span>
+ </div>
+ <div dojoAttachPoint="containerNode" class="dijitDialogPaneContent">
+ <!-- Actual content here -->
+ <!--div style="text-align: left"-->
+ <div style="padding: 0px; text-align: left;" , id = "div1">
+ </div>
+ <div style="padding-top:10px; text-align: right;">
+ <input type="button" id = "moreButton" label="More" value="OK" dojoType="dijit.form.Button"
+ style="text-align:right; display:inline-block; clear: both"/>
+ <input type="submit" label="OK" value="OK" dojoType="dijit.form.Button"
+ style="text-align:right; display:inline-block; clear: both"/>
+
+ </div>
+ <!--/div-->
+ </div>
+</div> \ No newline at end of file