diff --git a/GLFileView.h b/GLFileView.h
index a734dd0..ea43ccf 100644
--- a/GLFileView.h
+++ b/GLFileView.h
@@ -42,6 +42,8 @@
+(BOOL)isImage:(NSString*)file;
+(BOOL)isDiffHeader:(NSString*)line;
+- (void) openFileMerge:(NSString*)file sha:(NSString *)sha sha2:(NSString *)sha2;
+
@property(retain) NSMutableArray *groups;
@property(retain) NSString *logFormat;
diff --git a/GLFileView.m b/GLFileView.m
index 1c3bc06..7ead74b 100644
--- a/GLFileView.m
+++ b/GLFileView.m
@@ -120,6 +120,12 @@
if(!theError){
NSString *filePath = [file fullPath];
fileTxt=[fileTxt stringByReplacingOccurrencesOfString:@"\t" withString:@" "];
+ fileTxt=[fileTxt stringByReplacingOccurrencesOfString:@"{SHA}" withString:file.sha];
+ if(diffType==@"h") {
+ fileTxt=[fileTxt stringByReplacingOccurrencesOfString:@"{SHA2}" withString:@"HEAD"];
+ }else {
+ fileTxt=[fileTxt stringByReplacingOccurrencesOfString:@"{SHA2}" withString:@"--"];
+ }
[script callWebScriptMethod:@"showFile" withArguments:[NSArray arrayWithObjects:fileTxt, filePath, nil]];
}else{
[script callWebScriptMethod:@"setMessage" withArguments:[NSArray arrayWithObjects:[theError localizedDescription], nil]];
@@ -140,6 +146,13 @@
[historyController selectCommit:[PBGitSHA shaWithString:c]];
}
+// TODO: need to be refactoring
+- (void) openFileMerge:(NSString*)file sha:(NSString *)sha sha2:(NSString *)sha2;
+{
+ NSArray *args=[NSArray arrayWithObjects:@"difftool",@"--no-prompt",@"--tool=opendiff",sha,sha2,file,nil];
+ [historyController.repository handleInWorkDirForArguments:args];
+}
+
#pragma mark MGScopeBarDelegate methods
- (int)numberOfGroupsInScopeBar:(MGScopeBar *)theScopeBar
@@ -275,10 +288,10 @@
NSArray *lines = [txt componentsSeparatedByString:@"\n"];
NSString *line;
NSMutableString *res=[NSMutableString string];
-
+
int l_line,l_end;
int r_line,r_end;
-
+
int i=0;
do {
line=[lines objectAtIndex:i];
@@ -291,10 +304,10 @@
}while([GLFileView isDiffHeader:line]);
[res appendString:@""];
if(![self isBinaryFile:line]){
- [res appendString:[NSString stringWithFormat:@"
",fileName]];
+ [res appendString:[NSString stringWithFormat:@"",fileName]];
}
[res appendString:@""];
-
+
if([self isBinaryFile:line]){
NSArray *files=[self getFilesNames:line];
if(![[files objectAtIndex:0] isAbsolutePath]){
@@ -340,7 +353,9 @@
}else if([s isEqualToString:@"+"]){
[res appendString:[NSString stringWithFormat:@" | %d | ",r_line++]];
}
- [res appendString:[NSString stringWithFormat:@"%@ |
",[line substringFromIndex:1]]];
+ if(![s isEqualToString:@"\\"]){
+ [res appendString:[NSString stringWithFormat:@"%@ | ",[line substringFromIndex:1]]];
+ }
}while((l_line%@",header,fileList,diffs];
- html=[html stringByReplacingOccurrencesOfString:@"{SHA}" withString:[currentSha string]];
+ html=[html stringByReplacingOccurrencesOfString:@"{SHA}" withString:[NSString stringWithFormat:@"%@^",[currentSha string]]];
+ html=[html stringByReplacingOccurrencesOfString:@"{SHA2}" withString:[currentSha string]];
[[view windowScriptObject] callWebScriptMethod:@"showCommit" withArguments:[NSArray arrayWithObject:html]];
@@ -224,10 +225,11 @@
[historyController selectCommit:[PBGitSHA shaWithString:sha]];
}
-- (void) openFileMerge:(NSString*)file sha:(NSString *)sha
+// TODO: need to be refactoring
+- (void) openFileMerge:(NSString*)file sha:(NSString *)sha sha2:(NSString *)sha2
{
- NSArray *args=[NSArray arrayWithObjects:@"difftool",@"--no-prompt",@"--tool=opendiff",[NSString stringWithFormat:@"%@^",sha],sha,@"--",file,nil];
- [historyController.repository handleForArguments:args];
+ NSArray *args=[NSArray arrayWithObjects:@"difftool",@"--no-prompt",@"--tool=opendiff",sha,sha2,@"--",file,nil];
+ [historyController.repository handleInWorkDirForArguments:args];
}
diff --git a/html/views/diff/diffWindow.js b/html/views/diff/diffWindow.js
index 61eeb7c..cb33f92 100644
--- a/html/views/diff/diffWindow.js
+++ b/html/views/diff/diffWindow.js
@@ -9,3 +9,11 @@ var showFile = function(txt) {
$("diff").innerHTML = txt;
$("message").style.display = "none";
}
+
+// TODO: need to be refactoring
+var openFileMerge = function(file,sha,sha2) {
+ alert(file);
+ alert(sha);
+ alert(sha2);
+ Controller.openFileMerge_sha_sha2_(file,sha,sha2);
+}
diff --git a/html/views/history/history.js b/html/views/history/history.js
index 6a3b3e1..9a4057a 100644
--- a/html/views/history/history.js
+++ b/html/views/history/history.js
@@ -1,11 +1,14 @@
+// TODO: need to be refactoring
var selectCommit = function(a) {
Controller.selectCommit_(a);
}
-var openFileMerge = function(file,sha) {
+// TODO: need to be refactoring
+var openFileMerge = function(file,sha,sha2) {
alert(file);
alert(sha);
- Controller.openFileMerge_sha_(file,sha);
+ alert(sha2);
+ Controller.openFileMerge_sha_sha2_(file,sha,sha2);
}
var showImage = function(element, filename)