summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorEdyta Przymus2012-08-28 04:25:06 (EDT)
committer Szymon Brandys2012-08-28 04:25:06 (EDT)
commite9391562431f79491a969851c19c001938773304 (patch)
tree775623f1edeb4fc015897bb0d9b433e37d9e1d81
parent49bcfea6e999d127b2ff4c86864b45b7036c81c6 (diff)
downloadorg.eclipse.orion.client-e9391562431f79491a969851c19c001938773304.zip
org.eclipse.orion.client-e9391562431f79491a969851c19c001938773304.tar.gz
org.eclipse.orion.client-e9391562431f79491a969851c19c001938773304.tar.bz2
Bug 387759 - [Review request] Cannot review when ssh URL is used
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js18
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/gitReviewRequestExplorer.js27
2 files changed, 38 insertions, 7 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 88a03c3..62b6882 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
@@ -1698,6 +1698,18 @@ var exports = {};
id: "eclipse.orion.git.askForReviewCommand", //$NON-NLS-0$
parameters: notificationParameters,
callback: function(data) {
+ var sshCheck = function(gitUrl){
+ var url = gitUrl;
+ var isSsh = gitUrl.split(":")[0];
+ if(isSsh === "ssh"){
+ var indexOfAt = url.indexOf("@");
+ if(indexOfAt !== -1){
+ var urlNoUser = "ssh://" + url.substr(indexOfAt + 1);
+ url = urlNoUser;
+ }
+ }
+ return url;
+ };
var sendNotificationFunction = function(reviewerName){
var item = data.items;
var headLocation = item.Location.replace(item.Name, "HEAD");
@@ -1708,7 +1720,8 @@ var exports = {};
function(clone){
var nonHash = window.location.href.split('#')[0]; //$NON-NLS-0$
var orionHome = nonHash.substring(0, nonHash.length - window.location.pathname.length);
- var reviewRequestUrl = orionHome + "/git/reviewRequest.html#" + clone.Children[0].GitUrl + "_" + item.Name;
+ var url = sshCheck(clone.Children[0].GitUrl);
+ var reviewRequestUrl = orionHome + "/git/reviewRequest.html#" + url + "_" + item.Name;
serviceRegistry.getService("orion.git.provider").sendCommitReviewRequest(commitName, headLocation, reviewerName, reviewRequestUrl, authorName, commitMessage).then(
function(result) {
var display = {};
@@ -1729,7 +1742,8 @@ var exports = {};
function(clone){
var nonHash = window.location.href.split('#')[0]; //$NON-NLS-0$
var orionHome = nonHash.substring(0, nonHash.length - window.location.pathname.length);
- var reviewRequestUrl = orionHome + "/git/reviewRequest.html#" + clone.Children[0].GitUrl + "_" + item.Name;
+ var url = sshCheck(clone.Children[0].GitUrl);
+ var reviewRequestUrl = orionHome + "/git/reviewRequest.html#" + url + "_" + item.Name;
var dialog = new orion.git.widgets.ReviewRequestDialog({
title: messages["Contribution Review Request"],
url: reviewRequestUrl,
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitReviewRequestExplorer.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitReviewRequestExplorer.js
index 9d2a18f..92e9fa1 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitReviewRequestExplorer.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitReviewRequestExplorer.js
@@ -51,8 +51,9 @@ define(['i18n!git/nls/gitmessages', 'require', 'dojo','dijit', 'orion/section',
var that = this;
var params = [];
var n = remote_sha.lastIndexOf("_");
- params[0] = remote_sha.substring(0,n);
+ var url = remote_sha.substring(0,n);
params[1] = remote_sha.substring(n+1);
+ params[0] = this.sshCheck(url);
var redundant = params[0].split(".");
var index = redundant.length - 1;
if(redundant[index] === "git"){
@@ -64,7 +65,7 @@ define(['i18n!git/nls/gitmessages', 'require', 'dojo','dijit', 'orion/section',
}
this.url = params[2];
this.initTitleBar(params[1], params[0]);
-
+
dojo.empty(dojo.byId("welcomeDiv"));
dojo.empty(dojo.byId("cloneDiv"));
dojo.empty(dojo.byId("commitDiv"));
@@ -137,7 +138,7 @@ define(['i18n!git/nls/gitmessages', 'require', 'dojo','dijit', 'orion/section',
var that = this;
that.progressService.setProgressMessage("");
that.commandService.registerCommandContribution("clone", "eclipse.cloneGitRepositoryReviewReq", 200);
- that.commandService.renderCommands("clone", dojo.byId("cloneNode"), "clone", that, "button", params[0]);;
+ that.commandService.renderCommands("clone", dojo.byId("cloneNode"), "clone", that, "button", params[0]);
dojo.create("span", { style: "padding: 0px; text-align: left;", class: "gitMainDescription", innerHTML : " using " + params[0] }, dojo.byId("cloneNode"));
};
@@ -182,8 +183,10 @@ define(['i18n!git/nls/gitmessages', 'require', 'dojo','dijit', 'orion/section',
function(remotes){
var foundRemote = false;
for(var i=0;i<remotes.Children.length;i++){
- if(remotes.Children[i].GitUrl === url1 || remotes.Children[i].GitUrl === url2)
+ var url = that.sshCheck(remotes.Children[i].GitUrl);
+ if(url === url1 || url === url2){
foundRemote = true;
+ }
}
if(foundRemote){
findCommitLocation(repositories, sha, null, that).then(
@@ -238,7 +241,8 @@ define(['i18n!git/nls/gitmessages', 'require', 'dojo','dijit', 'orion/section',
function(){
var index;
for(var i=0;i<remotes.Children.length;i++){
- if(remotes.Children[i].GitUrl === url1 || remotes.Children[i].GitUrl === url2){
+ var url = that.sshCheck(remotes.Children[i].GitUrl);
+ if(url === url1 || url === url2){
index = i;
}
}
@@ -288,6 +292,19 @@ define(['i18n!git/nls/gitmessages', 'require', 'dojo','dijit', 'orion/section',
});
};
+ GitReviewRequestExplorer.prototype.sshCheck = function(remote){
+ var url = remote;
+ var isSsh = remote.split(":")[0];
+ if(isSsh === "ssh"){
+ var indexOfAt = url.indexOf("@");
+ if(indexOfAt !== -1){
+ var urlNoUser = "ssh://" + url.substr(indexOfAt + 1);
+ url = urlNoUser;
+ }
+ }
+ return url;
+ };
+
return GitReviewRequestExplorer;
}());