summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorPiotr Janik2011-07-28 10:17:03 (EDT)
committer Tomasz Zarna2011-07-28 10:17:03 (EDT)
commite6758541a91261369f6a139fdcbda438d77f3e91 (patch)
tree093158caabe0b2b789e26dd3ebb69e45ddc0dd8f
parent36e35a34b10e3e1b230bc2c40fe1da8cad8fef0c (diff)
downloadorg.eclipse.orion.client-e6758541a91261369f6a139fdcbda438d77f3e91.zip
org.eclipse.orion.client-e6758541a91261369f6a139fdcbda438d77f3e91.tar.gz
org.eclipse.orion.client-e6758541a91261369f6a139fdcbda438d77f3e91.tar.bz2
bug 353088 - Implement APi and UI for Git log --all
https://bugs.eclipse.org/bugs/show_bug.cgi?id=353088
-rw-r--r--bundles/org.eclipse.orion.client.git/web/git/git-clone.js1
-rw-r--r--bundles/org.eclipse.orion.client.git/web/git/git-log.js61
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js15
3 files changed, 64 insertions, 13 deletions
diff --git a/bundles/org.eclipse.orion.client.git/web/git/git-clone.js b/bundles/org.eclipse.orion.client.git/web/git/git-clone.js
index ce64226..c434692 100644
--- a/bundles/org.eclipse.orion.client.git/web/git/git-clone.js
+++ b/bundles/org.eclipse.orion.client.git/web/git/git-clone.js
@@ -46,6 +46,7 @@ dojo.addOnLoad(function() {
commandService.registerCommandContribution("eclipse.initGitRepository", 101, "pageActions", "eclipse.gitGroup");
commandService.addCommandGroup("eclipse.selectionGroup", 500, "More actions", null, "selectionTools");
commandService.registerCommandContribution("eclipse.git.deleteClone", 1);
+ commandService.registerCommandContribution("eclipse.openGitLogAll", 1);
commandService.registerCommandContribution("eclipse.git.deleteClone", 1, "selectionTools", "eclipse.selectionGroup");
commandService.registerCommandContribution("eclipse.checkoutBranch", 2);
commandService.registerCommandContribution("eclipse.addBranch", 2);
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 e644d99..a0b8359 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
@@ -154,7 +154,11 @@ function loadResource(fileServiceReference, navigator){
else
navigator.loadCommitsList(dojo.hash(), resource);
} else {
- navigator.loadCommitsList(dojo.hash(), {});
+ serviceRegistry.getService(fileServiceReference).then(function(fileService) {
+ var fileClient = new mFileClient.FileClient(fileService);
+ initTitleBar(fileClient, navigator, resource);
+ });
+ navigator.loadCommitsList(dojo.hash(), resource);
}
},
error : function(error, ioArgs) {
@@ -167,6 +171,21 @@ function loadResource(fileServiceReference, navigator){
});
}
+function getCloneFileUri(){
+ var path = dojo.hash().split("gitapi/commit/");
+ if(path.length === 2){
+ path = path[1].split("/");
+ if(path.length > 1){
+ fileURI="";
+ for(var i=0; i<path.length-1; i++){
+ fileURI+= "/" + path[i];
+ }
+ fileURI+="/" + path[path.length-1].split("?")[0];
+ }
+ }
+ return fileURI;
+}
+
function getHeadFileUri(){
var path = dojo.hash().split("gitapi/commit/");
if(path.length === 2){
@@ -204,27 +223,37 @@ function getRemoteFileURI(){
function initTitleBar(fileClient, navigator, item){
var isRemote = (item.Type === "RemoteTrackingBranch");
+ var isBranch = (item.toRef && item.toRef.Type === "Branch");
//TODO we are calculating file path from the URL, it should be returned by git API
- var fileURI = isRemote ? getRemoteFileURI() : getHeadFileUri();
-
+ var fileURI;
+ if (isRemote)
+ fileURI = getRemoteFileURI();
+ else if (isBranch)
+ fileURI = getHeadFileUri();
+ else
+ fileURI = getCloneFileUri();
if(fileURI){
fileClient.read(fileURI, true).then(
dojo.hitch(this, function(metadata) {
- var branchName, cloneName;
- if(item && (isRemote ? item.Name : item.toRef)){
- branchName = isRemote ? item.Name : item.toRef.Name;
- }
- if(item && (isRemote ? item.CloneLocation : item.toRef)){
- var cloneURI = isRemote ? item.CloneLocation : item.toRef.CloneLocation;
+ var branchName;
+ if (isRemote)
+ branchName = item.Name;
+ else if (isBranch)
+ branchName = item.toRef.Name;
+ else
+ branchName = null;
+
+ if(item && item.CloneLocation){
+ var cloneURI = item.CloneLocation;
serviceRegistry.getService("orion.git.provider").then(function(gitService){
gitService.getGitClone(cloneURI).then(function(jsonData){
if(jsonData.Children && jsonData.Children.length>0)
- setPageTitle(branchName, jsonData.Children[0].Name, jsonData.Children[0].ContentLocation, isRemote);
+ setPageTitle(branchName, jsonData.Children[0].Name, jsonData.Children[0].ContentLocation, isRemote, isBranch);
else
- setPageTitle(branchName, jsonData.Name, jsonData.ContentLocation, isRemote);
+ setPageTitle(branchName, jsonData.Name, jsonData.ContentLocation, isRemote, isBranch);
});
});
}else{
@@ -317,9 +346,15 @@ function makeHref(fileClient, seg, location, isRemote){
);
};
-function setPageTitle(branchName, cloneName, cloneLocation, isRemote){
+function setPageTitle(branchName, cloneName, cloneLocation, isRemote, isBranch){
var pageTitle = dojo.byId("pageTitle");
- var title = "Git Log for " + (isRemote ? "remote branch <b>" : "local branch <b>") + branchName + "</b>";
+
+ var title = "Git Log ";
+ if (isRemote)
+ title += "for remote branch <b>" + branchName + "</b>";
+ else if (isBranch)
+ title += "for local branch <b>" + branchName + "</b>";
+
if(cloneLocation){
title = title + " on <a href='/git/git-clone.html#" + cloneLocation + "'>" + cloneName + "</a>";
}
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 fc64cad..1aa596a 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
@@ -389,6 +389,21 @@ var exports = {};
commandService.addCommand(openGitLog, "object");
+ var openGitLogAll = new mCommands.Command({
+ name : "Show Git Log",
+ id : "eclipse.openGitLogAll",
+ hrefCallback : function(item) {
+ return "/git/git-log.html#" + item.CommitLocation + "?page=1";
+ },
+ visibleWhen : function(item) {
+ if (!item.CommitLocation)
+ return false;
+ return true;
+ }
+ });
+
+ commandService.addCommand(openGitLogAll, "object");
+
var openGitStatus = new mCommands.Command({
name : "Show Status",
id : "eclipse.openGitStatus",