summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorPiotr Janik2011-07-15 07:44:30 (EDT)
committer Szymon Brandys2011-07-21 06:16:11 (EDT)
commit89852ce9bed47890c2dd6365381d46e3032bcf8d (patch)
treec54f939c318d49df2f2ff3616888deb9ef6b883b
parenteb4ec28b7b92e217d221b82cecc89f4160521ba0 (diff)
downloadorg.eclipse.orion.client-89852ce9bed47890c2dd6365381d46e3032bcf8d.zip
org.eclipse.orion.client-89852ce9bed47890c2dd6365381d46e3032bcf8d.tar.gz
org.eclipse.orion.client-89852ce9bed47890c2dd6365381d46e3032bcf8d.tar.bz2
Bug 351440 - [git] '+' in refspecs seems to not be respected during
push/fetch operations Change-Id: I9029ef5734ad3e4ccc3e22a5f300e4544d2a1edf
-rw-r--r--bundles/org.eclipse.orion.client.git/web/git/git-log.js2
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/gitClient.js6
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js100
3 files changed, 102 insertions, 6 deletions
diff --git a/bundles/org.eclipse.orion.client.git/web/git/git-log.js b/bundles/org.eclipse.orion.client.git/web/git/git-log.js
index 681435d..6752c94 100644
--- a/bundles/org.eclipse.orion.client.git/web/git/git-log.js
+++ b/bundles/org.eclipse.orion.client.git/web/git/git-log.js
@@ -82,9 +82,11 @@ dojo.addOnLoad(function() {
// git contributions
commandService.registerCommandContribution("eclipse.orion.git.fetch", 100, "pageActions", "eclipse.gitGroup.page");
+ commandService.registerCommandContribution("eclipse.orion.git.fetchforce", 100, "pageActions", "eclipse.gitGroup.page");
commandService.registerCommandContribution("eclipse.orion.git.merge", 100, "pageActions", "eclipse.gitGroup.page");
commandService.registerCommandContribution("eclipse.orion.git.switchToCurrentLocal", 100, "pageActions", "eclipse.gitGroup.page");
commandService.registerCommandContribution("eclipse.orion.git.push", 100, "pageActions", "eclipse.gitGroup.page");
+ commandService.registerCommandContribution("eclipse.orion.git.pushforce", 100, "pageActions", "eclipse.gitGroup.page");
commandService.registerCommandContribution("eclipse.orion.git.switchToRemote", 100, "pageActions", "eclipse.gitGroup.page");
commandService.registerCommandContribution("eclipse.orion.git.addTag", 3);
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitClient.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitClient.js
index 00ae8fc..673510c 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitClient.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitClient.js
@@ -587,7 +587,7 @@ eclipse.GitService = (function() {
}
});
},
- doFetch : function(gitRemoteBranchURI, onLoad, gitSshUsername, gitSshPassword, gitSshKnownHost, gitPrivateKey, gitPassphrase) {
+ doFetch : function(gitRemoteBranchURI, force, onLoad, gitSshUsername, gitSshPassword, gitSshKnownHost, gitPrivateKey, gitPassphrase) {
var service = this;
return dojo.xhrPost({
@@ -597,6 +597,7 @@ eclipse.GitService = (function() {
},
postData : dojo.toJson({
"Fetch" : "true",
+ "Force" : force,
"GitSshUsername" : gitSshUsername,
"GitSshPassword" : gitSshPassword,
"GitSshKnownHost" : gitSshKnownHost,
@@ -643,7 +644,7 @@ eclipse.GitService = (function() {
}
});
},
- doPush : function(gitBranchURI, srcRef, onLoad, gitSshUsername, gitSshPassword, gitSshKnownHost, gitPrivateKey, gitPassphrase) {
+ doPush : function(gitBranchURI, srcRef, force, onLoad, gitSshUsername, gitSshPassword, gitSshKnownHost, gitPrivateKey, gitPassphrase) {
var service = this;
return dojo.xhrPost({
@@ -654,6 +655,7 @@ eclipse.GitService = (function() {
postData : dojo.toJson({
"PushSrcRef" : srcRef,
"PushTags" : true,
+ "Force" : force,
"GitSshUsername" : gitSshUsername,
"GitSshPassword" : gitSshPassword,
"GitSshKnownHost" : gitSshKnownHost,
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 89fcf0c..f6f69c9 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
@@ -439,7 +439,7 @@ var exports = {};
var func = arguments.callee;
serviceRegistry.getService("orion.git.provider").then(function(gitService) {
serviceRegistry.getService("orion.page.message").then(function(progressService) {
- var deferred = gitService.doFetch(path, null, options.gitSshUsername, options.gitSshPassword, options.knownHosts, options.gitPrivateKey, options.gitPassphrase);
+ var deferred = gitService.doFetch(path, false, null, options.gitSshUsername, options.gitSshPassword, options.knownHosts, options.gitPrivateKey, options.gitPassphrase);
progressService.showWhile(deferred, "Fetching remote: " + path).then(
function(jsonData, secondArg) {
exports.handleProgressServiceResponse(jsonData, options, serviceRegistry,
@@ -488,6 +488,64 @@ var exports = {};
commandService.addCommand(fetchCommand, "dom");
commandService.addCommand(fetchCommand, "object");
+ var fetchForceCommand = new mCommands.Command({
+ name : "Force Fetch",
+ id : "eclipse.orion.git.fetchforce",
+ callback: function(item) {
+ var path = item.Location;
+ exports.getDefaultSshOptions(serviceRegistry).then(function(options){
+ var func = arguments.callee;
+ serviceRegistry.getService("orion.git.provider").then(function(gitService) {
+ serviceRegistry.getService("orion.page.message").then(function(progressService) {
+ var deferred = gitService.doFetch(path, true, null, options.gitSshUsername, options.gitSshPassword, options.knownHosts, options.gitPrivateKey, options.gitPassphrase);
+ progressService.showWhile(deferred, "Fetching remote: " + path).then(
+ function(jsonData, secondArg) {
+ exports.handleProgressServiceResponse(jsonData, options, serviceRegistry,
+ function(jsonData){
+ dojo.xhrGet({
+ url : path,
+ headers : {
+ "Orion-Version" : "1"
+ },
+ postData : dojo.toJson({
+ "GitSshUsername" : options.gitSshUsername,
+ "GitSshPassword" : options.gitSshPassword,
+ "GitSshPrivateKey": options.gitPrivateKey,
+ "GitSshPassphrase": options.gitPassphrase,
+ "GitSshKnownHost" : options.knownHosts
+ }),
+ handleAs : "json",
+ timeout : 5000,
+ load : function(jsonData, secondArg) {
+ return jsonData;
+ },
+ error : function(error, ioArgs) {
+ //handleGetAuthenticationError(this, ioArgs);
+ console.error("HTTP status code: ", ioArgs.xhr.status);
+ return error;
+ }
+ }).then(function(remoteJsonData){
+ if (explorer.parentId === "explorer-tree")
+ gitService.getLog(remoteJsonData.HeadLocation, remoteJsonData.Id, function(scopedCommitsJsonData, secondArd) {
+ explorer.renderer.setIncomingCommits(scopedCommitsJsonData);
+ explorer.loadCommitsList(remoteJsonData.CommitLocation + "?page=1", remoteJsonData, true);
+ });
+ }, displayErrorOnStatus
+ );
+ }, func, "Fetch Git Repository");
+ });
+ });
+ });
+ });
+ },
+ visibleWhen : function(item) {
+ return item.Type === "RemoteTrackingBranch" || item.Type === "Remote";
+ }
+ });
+
+ commandService.addCommand(fetchForceCommand, "dom");
+ commandService.addCommand(fetchForceCommand, "object");
+
var mergeCommand = new mCommands.Command({
name : "Merge",
image : "/git/images/merge.gif",
@@ -564,7 +622,7 @@ var exports = {};
var func = arguments.callee;
serviceRegistry.getService("orion.git.provider").then(function(gitService) {
serviceRegistry.getService("orion.page.message").then(function(progressService) {
- var deferred = gitService.doPush(item.RemoteLocation, "HEAD", null, options.gitSshUsername, options.gitSshPassword, options.knownHosts, options.gitPrivateKey, options.gitPassphrase);
+ var deferred = gitService.doPush(item.RemoteLocation, "HEAD", false, null, options.gitSshUsername, options.gitSshPassword, options.knownHosts, options.gitPrivateKey, options.gitPassphrase);
progressService.showWhile(deferred, "Pushing remote: " + path).then(function(remoteJsonData){
exports.handleProgressServiceResponse(remoteJsonData, options, serviceRegistry,
function(jsonData){
@@ -591,6 +649,40 @@ var exports = {};
commandService.addCommand(pushCommand, "dom");
commandService.addCommand(pushCommand, "object");
+ var pushForceCommand = new mCommands.Command({
+ name : "Force Push All",
+ image : "/git/images/push.gif",
+ id : "eclipse.orion.git.pushforce",
+ callback: function(item) {
+ var path = dojo.hash();
+ exports.getDefaultSshOptions(serviceRegistry).then(function(options){
+ var func = arguments.callee;
+ serviceRegistry.getService("orion.git.provider").then(function(gitService) {
+ serviceRegistry.getService("orion.page.message").then(function(progressService) {
+ var deferred = gitService.doPush(item.RemoteLocation, "HEAD", true, null, options.gitSshUsername, options.gitSshPassword, options.knownHosts, options.gitPrivateKey, options.gitPassphrase);
+ progressService.showWhile(deferred, "Pushing remote: " + path).then(function(remoteJsonData){
+ exports.handleProgressServiceResponse(remoteJsonData, options, serviceRegistry,
+ function(jsonData){
+ if (jsonData.Result.Severity == "Ok")
+ dojo.query(".treeTableRow").forEach(function(node, i) {
+ dojo.toggleClass(node, "outgoingCommitsdRow", false);
+ });
+ }, func, "Push Git Repository");
+ });
+ });
+ });
+ });
+ },
+ 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;
+ }
+ });
+
+ commandService.addCommand(pushForceCommand, "dom");
+ commandService.addCommand(pushForceCommand, "object");
+
var switchToRemote = new mCommands.Command({
name : "Switch to Remote",
id : "eclipse.orion.git.switchToRemote",
@@ -782,7 +874,7 @@ var exports = {};
var func = arguments.callee;
serviceRegistry.getService("orion.git.provider").then(function(gitService) {
serviceRegistry.getService("orion.page.message").then(function(progressService) {
- var deferred = gitService.doFetch(path, null, options.gitSshUsername, options.gitSshPassword, options.knownHosts, options.gitPrivateKey, options.gitPassphrase);
+ var deferred = gitService.doFetch(path, false, null, options.gitSshUsername, options.gitSshPassword, options.knownHosts, options.gitPrivateKey, options.gitPassphrase);
progressService.showWhile(deferred, "Fetching remote: " + path).then(
function(jsonData, secondArg) {
exports.handleProgressServiceResponse(jsonData, options, serviceRegistry,
@@ -906,7 +998,7 @@ var exports = {};
var func = arguments.callee;
serviceRegistry.getService("orion.git.provider").then(function(gitService) {
serviceRegistry.getService("orion.page.message").then(function(progressService) {
- var deferred = gitService.doPush(item.RemoteLocation, "HEAD", null, options.gitSshUsername, options.gitSshPassword, options.knownHosts, options.gitPrivateKey, options.gitPassphrase);
+ var deferred = gitService.doPush(item.RemoteLocation, "HEAD", false, null, options.gitSshUsername, options.gitSshPassword, options.knownHosts, options.gitPrivateKey, options.gitPassphrase);
progressService.showWhile(deferred, "Pushing remote: " + path).then(function(remoteJsonData){
exports.handleProgressServiceResponse(remoteJsonData, options, serviceRegistry,
function(jsonData){