aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdyta Przymus2012-08-06 07:37:03 (EDT)
committerSzymon Brandys2012-08-06 07:48:41 (EDT)
commitb15abf0b1fe51f6024278e40aa3c3fa141d525fc (patch)
tree2b1c83ba92e8773d1223ca7e7b8c6043b6464cef
parent27f4655916b519659082c39f9d4d5dfe202bceac (diff)
downloadorg.eclipse.orion.client-b15abf0b1fe51f6024278e40aa3c3fa141d525fc.zip
org.eclipse.orion.client-b15abf0b1fe51f6024278e40aa3c3fa141d525fc.tar.gz
org.eclipse.orion.client-b15abf0b1fe51f6024278e40aa3c3fa141d525fc.tar.bz2
Bug 376617 - provide easy way to annotate bugzilla with commit link
-rw-r--r--bundles/org.eclipse.orion.client.git/web/git/nls/root/gitmessages.js13
-rw-r--r--bundles/org.eclipse.orion.client.git/web/git/plugins/gitPlugin.html44
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/gitCommitExplorer.js73
3 files changed, 97 insertions, 33 deletions
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 2970112..4981b72 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
@@ -23,7 +23,7 @@ define({
"Show in eclipse.org": "Show in eclipse.org",
"Show this repository at eclipse.org": "Show this repository at eclipse.org",
"Show in GitHub": "Show in GitHub",
- "Show this repository at GitHub": "Show this repository at GitHub",
+ "Show this repository in GitHub": "Show this repository in GitHub",
"Commit Details": "Commit Details",
"No Commits": "No Commits",
"commit: 0": "commit: ${0}",
@@ -345,8 +345,15 @@ define({
"Change..." : "Change...",
"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:",
+ "Local Branch Name:" : "Local Branch Name:",
"Pull Request url for this commit" : "Pull Request url for this commit",
"Pull Request" : "Pull Request",
- "Pull Request Url" : "Pull Request Url"
+ "Pull Request Url" : "Pull Request Url",
+ "Show Commit in GitHub" : "Show Commit in GitHub",
+ "Show Repository in GitHub" : "Show Repository in GitHub",
+ "Show this commit in GitHub": "Show this commit in GitHub",
+ "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"
});
diff --git a/bundles/org.eclipse.orion.client.git/web/git/plugins/gitPlugin.html b/bundles/org.eclipse.orion.client.git/web/git/plugins/gitPlugin.html
index 705b1d6..8f5508f 100644
--- a/bundles/org.eclipse.orion.client.git/web/git/plugins/gitPlugin.html
+++ b/bundles/org.eclipse.orion.client.git/web/git/plugins/gitPlugin.html
@@ -123,8 +123,8 @@
provider.registerService("orion.page.link.related", null, {
id: "orion.git.gotoEclipseGit",
- nameKey: "Show in eclipse.org",
- tooltipKey: "Show this repository at eclipse.org",
+ nameKey: "Show Repository in eclipse.org",
+ tooltipKey: "Show this repository in eclipse.org",
nls: "git/nls/gitmessages",
validationProperties: [{
source: "GitUrl|Clone:GitUrl",
@@ -137,9 +137,9 @@
provider.registerService("orion.page.link.related", null, {
id: "orion.git.gotoGithub",
- nameKey: "Show in GitHub",
+ nameKey: "Show Repository in GitHub",
nls: "git/nls/gitmessages",
- tooltipKey: "Show this repository at GitHub",
+ tooltipKey: "Show this repository in GitHub",
validationProperties: [{
source: "GitUrl|Clone:GitUrl",
match: "github\.com.*\.git",
@@ -149,6 +149,42 @@
}],
uriTemplate: "https://{GitHubLocation}"
});
+
+ provider.registerServiceProvider("orion.page.link.related", null, {
+ id: "orion.git.gotoGithubCommit",
+ nameKey: "Show Commit in GitHub",
+ nls: "git/nls/gitmessages",
+ tooltipKey: "Show this commit in GitHub",
+ validationProperties: [{
+ source: "GitUrl",
+ match: "github\.com.*\.git",
+ variableName: "GitHubLocation",
+ variableMatchPosition: "only",
+ replacements: [{pattern: ":", replacement: "/"}, {pattern: ".git$", replacement: ""}]
+ },
+ {source: "Type", match: "Commit"},
+ {source: "Name", variableName: "commitName"}
+ ],
+ uriTemplate: "https://{GitHubLocation}/commit/{commitName}"
+ });
+
+ provider.registerServiceProvider("orion.page.link.related", null, {
+ id: "orion.git.gotoEclipseGitCommit",
+ nameKey: "Show Commit in eclipse.org",
+ nls: "git/nls/gitmessages",
+ tooltipKey: "Show this commit in eclipse.org",
+ validationProperties: [{
+ source: "GitUrl",
+ match: "git.eclipse.org/gitroot",
+ variableName: "EclipseGitLocation",
+ variableMatchPosition: "after"
+ },
+ {source: "Type", match: "Commit"},
+ {source: "Name", variableName: "commitName"},
+ {source: "Branch", variableName: "branchName"}
+ ],
+ uriTemplate: "http://git.eclipse.org/c{EclipseGitLocation}/commit/?h={branchName}&id={commitName}"
+ });
temp.href = "../../gitapi/diff/";
var base = temp.href;
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommitExplorer.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommitExplorer.js
index 0f9cecb..73028bf 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommitExplorer.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommitExplorer.js
@@ -81,9 +81,7 @@ define(['i18n!git/nls/gitmessages', 'dojo', 'orion/section', 'orion/explorer', '
function(resp){
loadingDeferred.callback();
var repositories = resp.Children;
-
that.initTitleBar(commits[0], repositories[0]);
-
that.displayCommit(commits[0]);
that.displayTags(commits[0]);
that.displayDiffs(commits[0]);
@@ -106,30 +104,6 @@ define(['i18n!git/nls/gitmessages', 'dojo', 'orion/section', 'orion/explorer', '
);
};
- GitCommitExplorer.prototype.initTitleBar = function(commit, repository){
- var that = this;
- var item;
- var pageTitle;
-
- if (commit){
- item = {};
- item.Name = commit.Name;
- item.Parents = [];
- item.Parents[0] = {};
- item.Parents[0].Name = repository.Name;
- item.Parents[0].Location = repository.Location;
- item.Parents[0].ChildrenLocation = repository.Location;
- item.Parents[1] = {};
- item.Parents[1].Name = messages["Repositories"];
- }
- mGlobalCommands.setPageTarget({task: "Commit", target: repository,
- breadcrumbTarget: item,
- makeBreadcrumbLink: function(seg, location) {
- seg.href = "/git/git-repository.html#" + (location ? location : ""); //$NON-NLS-0$
- },
- serviceRegistry: this.registry, commandService: this.commandService});
- };
-
GitCommitExplorer.prototype.displayCommit = function(commit){
var tableNode = dojo.byId( 'table' ); //$NON-NLS-0$
@@ -222,6 +196,53 @@ define(['i18n!git/nls/gitmessages', 'dojo', 'orion/section', 'orion/explorer', '
return [commitMessage0, commitMessage1];
};
+ // related pages
+
+ GitCommitExplorer.prototype.initTitleBar = function(commit, repository){
+ var that = this;
+ that.registry.getService("orion.git.provider").getGitRemote(repository.RemoteLocation).then(
+ function(remote){
+ commit.GitUrl = remote.Children[0].GitUrl;
+ commit.ContentLocation = repository.ContentLocation;
+ var branches = commit.Branches;
+ if(branches){
+ for(var i=0; i<branches.length; i++){
+ var splitted = branches[i].FullName.split("/");
+ if(splitted[1] === "remotes"){
+ var name = splitted[2];
+ var remoteBranch = splitted[3];
+ for(var j=0;j<remote.Children.length;j++){
+ if(name === remote.Children[j].Name){
+ var gitUrl = remote.Children[j].GitUrl;
+ commit.GitUrl = gitUrl;
+ commit.Branch = remoteBranch;
+ }
+ }
+ }
+ }
+ }
+ var item = {};
+ if (commit){
+ item = {};
+ item.Name = commit.Name;
+ item.Parents = [];
+ item.Parents[0] = {};
+ item.Parents[0].Name = repository.Name;
+ item.Parents[0].Location = repository.Location;
+ item.Parents[0].ChildrenLocation = repository.Location;
+ item.Parents[1] = {};
+ item.Parents[1].Name = messages["Repositories"];
+ }
+ mGlobalCommands.setPageTarget({task: "Commit", target: commit,
+ breadcrumbTarget: item,
+ makeBreadcrumbLink: function(seg, location) {
+ seg.href = "/git/git-repository.html#" + (location ? location : ""); //$NON-NLS-0$
+ },
+ serviceRegistry: that.registry, commandService: that.commandService});
+ });
+ };
+
+
// Git tags
GitCommitExplorer.prototype.displayTags = function(commit){