From cc10bda03258832f634d2f38ec0a804ba4d35cd0 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Fri, 22 Apr 2011 15:47:02 -0700 Subject: [PATCH] openFileMerge on "diff with..." --- PBDiffWindowController.m | 8 +++++++- PBWebDiffController.m | 11 +++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/PBDiffWindowController.m b/PBDiffWindowController.m index 4aacfe2..3d8456f 100644 --- a/PBDiffWindowController.m +++ b/PBDiffWindowController.m @@ -10,6 +10,7 @@ #import "PBGitRepository.h" #import "PBGitCommit.h" #import "PBGitDefaults.h" +#import "GLFileView.h" @implementation PBDiffWindowController @@ -21,6 +22,7 @@ return nil; diff = aDiff; + return self; } @@ -50,8 +52,12 @@ DLog(@"diff failed with retValue: %d for command: '%@' output: '%@'", retValue, [arguments componentsJoinedByString:@" "], diff); return; } + + diff=[GLFileView parseDiff:diff]; + diff=[diff stringByReplacingOccurrencesOfString:@"{SHA_PREV}" withString:[startCommit realSha]]; + diff=[diff stringByReplacingOccurrencesOfString:@"{SHA}" withString:[diffCommit realSha]]; - PBDiffWindowController *diffController = [[PBDiffWindowController alloc] initWithDiff:[diff copy]]; + PBDiffWindowController *diffController = [[PBDiffWindowController alloc] initWithDiff:diff]; [diffController showWindow:nil]; } diff --git a/PBWebDiffController.m b/PBWebDiffController.m index d09d9c7..8901c33 100644 --- a/PBWebDiffController.m +++ b/PBWebDiffController.m @@ -7,7 +7,6 @@ // #import "PBWebDiffController.h" -#import "GLFileView.h" @implementation PBWebDiffController @@ -47,7 +46,15 @@ if ([diff length] == 0) [script callWebScriptMethod:@"setMessage" withArguments:[NSArray arrayWithObject:@"There are no differences"]]; else - [script callWebScriptMethod:@"showFile" withArguments:[NSArray arrayWithObject:[GLFileView parseDiff:diff]]]; + [script callWebScriptMethod:@"showFile" withArguments:[NSArray arrayWithObject:diff]]; } +// 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]; + [repository handleInWorkDirForArguments:args]; +} + + @end