| author | Edyta Przymus | 2012-08-07 11:11:53 (EDT) |
|---|---|---|
| committer | Szymon Brandys | 2012-08-07 11:11:53 (EDT) |
| commit | 160f4eefa006f6b74514a8f8a24a458a0b569e53 (patch) (side-by-side diff) | |
| tree | 0f5057a00ea8fa4a3ffd079da15c52f03ed08d0c | |
| parent | 6be51b552e722d275b597446f932cce5143a6985 (diff) | |
| download | org.eclipse.orion.client-160f4eefa006f6b74514a8f8a24a458a0b569e53.zip org.eclipse.orion.client-160f4eefa006f6b74514a8f8a24a458a0b569e53.tar.gz org.eclipse.orion.client-160f4eefa006f6b74514a8f8a24a458a0b569e53.tar.bz2 | |
Bug 369591 - improve workflow for accepting contributions from githubv20120807-1511
4 files changed, 70 insertions, 2 deletions
diff --git a/bundles/org.eclipse.orion.client.git/web/git/git-commit.js b/bundles/org.eclipse.orion.client.git/web/git/git-commit.js index f5e63a3..1253302 100644 --- a/bundles/org.eclipse.orion.client.git/web/git/git-commit.js +++ b/bundles/org.eclipse.orion.client.git/web/git/git-commit.js @@ -51,6 +51,7 @@ define(['i18n!git/nls/gitmessages', 'require', 'dojo', 'orion/bootstrap', 'orion commandService.addCommandGroup("pageActions", "eclipse.gitGroup", 100); //$NON-NLS-1$ //$NON-NLS-0$ commandService.registerCommandContribution("pageActions", "eclipse.orion.git.cherryPick", 100, "eclipse.gitGroup"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ commandService.registerCommandContribution("pageActions", "eclipse.orion.git.getPullRequestUrl", 101, "eclipse.gitGroup"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ + commandService.registerCommandContribution("pageActions", "eclipse.orion.git.askForReviewCommand", 101, "eclipse.gitGroup"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ commandService.registerCommandContribution("pageActions", "eclipse.orion.git.openCommitCommand", 102, "eclipse.gitGroup", true, new mCommands.CommandKeyBinding('h', true, true)); //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ // object contributions diff --git a/bundles/org.eclipse.orion.client.git/web/git/nls/root/gitmessages.js b/bundles/org.eclipse.orion.client.git/web/git/nls/root/gitmessages.js index 4981b72..43748b3 100644 --- a/bundles/org.eclipse.orion.client.git/web/git/nls/root/gitmessages.js +++ b/bundles/org.eclipse.orion.client.git/web/git/nls/root/gitmessages.js @@ -343,7 +343,7 @@ define({ "Choose target location" : "Choose target location",
"Default target location" : "Default target location",
"Change..." : "Change...", - "Merge Squash": "Merge Squash",
+ "Merge Squash": "Merge Squash", "Squash the content of the branch to the index" : "Squash the content of the branch to the index",
"Local Branch Name:" : "Local Branch Name:", "Pull Request url for this commit" : "Pull Request url for this commit",
@@ -355,5 +355,8 @@ define({ "Show Commit in eclipse.org": "Show Commit in eclipse.org",
"Show this commit in eclipse.org" : "Show this commit in eclipse.org",
"Show Repository in eclipse.org":"Show Repository in eclipse.org",
- "Show this repository in eclipse.org":"Show this repository in eclipse.org" + "Show this repository in eclipse.org":"Show this repository in eclipse.org", + "Ask for review" : "Ask for review",
+ "Ask for review tooltip" : "Send email with request for commit review",
+ "Reviewer name" : "Reviewer name" }); 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 66b2b79..01d552b 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 @@ -890,6 +890,29 @@ eclipse.GitService = (function() { }); return clientDeferred; }, + sendCommitReviewRequest: function(commit, location, login, url, authorName, message){ + var service = this; + var clientDeferred = new dojo.Deferred(); + dojo.xhrPost({ + url: location , + handleAs: "json", //$NON-NLS-0$ + timeout: 15000, + postData : dojo.toJson({ + "PullReqCommit": commit, + "PullReqUrl" : url, //$NON-NLS-0$ + "PullReqNotifyLogin" : login, //$NON-NLS-0$ + "PullReqAuthorName" : authorName, + "PullReqMessage" : message + }), + load: function(jsonData, xhrArgs) { + dojo.hitch(service, service._getGitServiceResponse)(clientDeferred, jsonData, xhrArgs); + }, + error: function(error, ioArgs) { + dojo.hitch(service, service._handleGitServiceResponseError)(clientDeferred, this, error, ioArgs); + } + }); + return clientDeferred; + }, _getGitServiceResponse: function(clientDeferred, jsonData, xhrArgs){ if(xhrArgs && xhrArgs.xhr.status === 202){ var deferred = new dojo.Deferred(); 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 b0f966a..260fa42 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 @@ -1654,6 +1654,47 @@ var exports = {}; } }); commandService.addCommand(removeTagCommand); + + var notificationParameters = new mCommands.ParametersDescription([new mCommands.CommandParameter('reviewer', 'text', messages["Reviewer name"])]); //$NON-NLS-1$ //$NON-NLS-0$ + + var askForReviewCommand = new mCommands.Command({ + name: messages["Ask for review"], + tooltip: messages["Ask for review tooltip"], + imageClass: "core-sprite-tag", //$NON-NLS-0$ + id: "eclipse.orion.git.askForReviewCommand", //$NON-NLS-0$ + parameters: notificationParameters, + callback: function(data) { + var item = data.items; + + var headLocation = item.Location.replace(item.Name, "HEAD"); + var authorName = item.AuthorName; + var commitName = item.Name; + var commitMessage = item.Message; + var reviewerName = data.parameters.valueFor("reviewer"); + + serviceRegistry.getService("orion.git.provider").getGitClone(item.CloneLocation).then( + function(clone){ + var nonHash = window.location.href.split('#')[0]; //$NON-NLS-0$ + var orionHome = nonHash.substring(0, nonHash.length - window.location.pathname.length); + var pullRequestUrl = orionHome + "/git/pullRequest.html#" + clone.Children[0].GitUrl + "_" + item.Name; + + serviceRegistry.getService("orion.git.provider").sendCommitReviewRequest(commitName, headLocation, reviewerName, pullRequestUrl, authorName, commitMessage).then( + function(result) { + var display = {}; + display.Severity = "Ok"; //$NON-NLS-0$ + display.HTML = false; + display.Message = result.Result; + serviceRegistry.getService("orion.page.message").setProgressResult(display); + }, displayErrorOnStatus + ); + } + ); + }, + visibleWhen: function(item) { + return item.Type === "Commit"; //$NON-NLS-0$ + } + }); + commandService.addCommand(askForReviewCommand); var cherryPickCommand = new mCommands.Command({ name : messages["Cherry-Pick"], |

