Skip to content

Commit cc10bda

Browse files
committed
openFileMerge on "diff with..."
1 parent 09011b8 commit cc10bda

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

PBDiffWindowController.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#import "PBGitRepository.h"
1111
#import "PBGitCommit.h"
1212
#import "PBGitDefaults.h"
13+
#import "GLFileView.h"
1314

1415

1516
@implementation PBDiffWindowController
@@ -21,6 +22,7 @@ - (id) initWithDiff:(NSString *)aDiff
2122
return nil;
2223

2324
diff = aDiff;
25+
2426
return self;
2527
}
2628

@@ -50,8 +52,12 @@ + (void) showDiffWindowWithFiles:(NSArray *)filePaths fromCommit:(PBGitCommit *)
5052
DLog(@"diff failed with retValue: %d for command: '%@' output: '%@'", retValue, [arguments componentsJoinedByString:@" "], diff);
5153
return;
5254
}
55+
56+
diff=[GLFileView parseDiff:diff];
57+
diff=[diff stringByReplacingOccurrencesOfString:@"{SHA_PREV}" withString:[startCommit realSha]];
58+
diff=[diff stringByReplacingOccurrencesOfString:@"{SHA}" withString:[diffCommit realSha]];
5359

54-
PBDiffWindowController *diffController = [[PBDiffWindowController alloc] initWithDiff:[diff copy]];
60+
PBDiffWindowController *diffController = [[PBDiffWindowController alloc] initWithDiff:diff];
5561
[diffController showWindow:nil];
5662
}
5763

PBWebDiffController.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//
88

99
#import "PBWebDiffController.h"
10-
#import "GLFileView.h"
1110

1211

1312
@implementation PBWebDiffController
@@ -47,7 +46,15 @@ - (void) showDiff: (NSString *) diff
4746
if ([diff length] == 0)
4847
[script callWebScriptMethod:@"setMessage" withArguments:[NSArray arrayWithObject:@"There are no differences"]];
4948
else
50-
[script callWebScriptMethod:@"showFile" withArguments:[NSArray arrayWithObject:[GLFileView parseDiff:diff]]];
49+
[script callWebScriptMethod:@"showFile" withArguments:[NSArray arrayWithObject:diff]];
5150
}
5251

52+
// TODO: need to be refactoring
53+
- (void) openFileMerge:(NSString*)file sha:(NSString *)sha sha2:(NSString *)sha2;
54+
{
55+
NSArray *args=[NSArray arrayWithObjects:@"difftool",@"--no-prompt",@"--tool=opendiff",sha,sha2,file,nil];
56+
[repository handleInWorkDirForArguments:args];
57+
}
58+
59+
5360
@end

0 commit comments

Comments
 (0)