|
30 | 30 | #define kKSDiffPath @"/usr/local/bin/ksdiff"
|
31 | 31 | #define kBComparePath @"/usr/local/bin/bcompare"
|
32 | 32 | #define kP4MergePath @"/Applications/p4merge.app/Contents/Resources/launchp4merge"
|
| 33 | +#define kDiffMergePath @"/Applications/DiffMerge.app/Contents/Resources/diffmerge.sh" |
33 | 34 |
|
34 | 35 | NSString* const GIViewControllerTool_FileMerge = @"FileMerge";
|
35 | 36 | NSString* const GIViewControllerTool_Kaleidoscope = @"Kaleidoscope";
|
36 | 37 | NSString* const GIViewControllerTool_BeyondCompare = @"Beyond Compare";
|
37 | 38 | NSString* const GIViewControllerTool_P4Merge = @"P4Merge";
|
38 | 39 | NSString* const GIViewControllerTool_GitTool = @"Git Tool";
|
| 40 | +NSString* const GIViewControllerTool_DiffMerge = @"DiffMerge"; |
39 | 41 |
|
40 | 42 | NSString* const GIViewController_DiffTool = @"GIViewController_DiffTool";
|
41 | 43 | NSString* const GIViewController_MergeTool = @"GIViewController_MergeTool";
|
@@ -395,6 +397,14 @@ - (void)_runDiffGitToolForFile:(NSString*)file withOldPath:(NSString*)oldPath ne
|
395 | 397 | }
|
396 | 398 | }
|
397 | 399 |
|
| 400 | +- (void)_runDiffMergeToolWithArguments:(NSArray*)arguments { |
| 401 | + if (([[NSFileManager defaultManager] isExecutableFileAtPath:kDiffMergePath])) { |
| 402 | + [self _runTaskWithPath:kDiffMergePath arguments:arguments variables:nil waitUntilExit:NO reportErrors:NO]; // launch diff merge |
| 403 | + } else { |
| 404 | + [self presentAlertWithType:kGIAlertType_Stop title:NSLocalizedString(@"DiffMerge is not available!", nil) message:NSLocalizedString(@"P4Merge app doesn't appear to be installed.", nil)]; |
| 405 | + } |
| 406 | +} |
| 407 | + |
398 | 408 | // http://git-scm.com/docs/git-mergetool
|
399 | 409 | - (void)_runMergeGitToolForFile:(NSString*)file withOldPath:(NSString*)oldPath newPath:(NSString*)newPath basePath:(NSString*)basePath {
|
400 | 410 | NSString* tool = [[self.repository readConfigOptionForVariable:@"merge.tool" error:NULL] value];
|
@@ -455,6 +465,8 @@ - (void)viewDeltasInDiffTool:(NSArray*)deltas {
|
455 | 465 | [self _runP4MergeWithArguments:@[ @"-nl", oldTitle, @"-nr", newTitle, oldPath, newPath ]];
|
456 | 466 | } else if ([identifier isEqualToString:GIViewControllerTool_GitTool]) {
|
457 | 467 | [self _runDiffGitToolForFile:delta.canonicalPath withOldPath:oldPath newPath:newPath];
|
| 468 | + } else if ([identifier isEqualToString:GIViewControllerTool_DiffMerge]) { |
| 469 | + [self _runDiffMergeToolWithArguments:@[ [NSString stringWithFormat:@"-t1=%@", oldTitle], [NSString stringWithFormat:@"-t2=%@", newTitle], oldPath, newPath ]]; |
458 | 470 | } else {
|
459 | 471 | XLOG_DEBUG_UNREACHABLE();
|
460 | 472 | }
|
@@ -571,6 +583,15 @@ - (void)resolveConflictInMergeTool:(GCIndexConflict*)conflict {
|
571 | 583 | [self _runP4MergeWithArguments:arguments];
|
572 | 584 | } else if ([identifier isEqualToString:GIViewControllerTool_GitTool]) {
|
573 | 585 | [self _runMergeGitToolForFile:mergePath withOldPath:ourPath newPath:theirPath basePath:ancestorPath];
|
| 586 | + } else if ([identifier isEqualToString:GIViewControllerTool_DiffMerge]) { |
| 587 | + [arguments addObject:[NSString stringWithFormat:@"-r=%@", mergePath]]; |
| 588 | + [arguments addObject:[NSString stringWithFormat:@"-t1=%@", ourTitle]]; |
| 589 | + [arguments addObject:[NSString stringWithFormat:@"-t2=%@", ancestorTitle]]; |
| 590 | + [arguments addObject:[NSString stringWithFormat:@"-t3=%@", theirTitle]]; |
| 591 | + [arguments addObject:ourPath]; |
| 592 | + [arguments addObject:ancestorPath]; |
| 593 | + [arguments addObject:theirPath]; |
| 594 | + [self _runDiffMergeToolWithArguments:arguments]; |
574 | 595 | } else {
|
575 | 596 | XLOG_DEBUG_UNREACHABLE();
|
576 | 597 | }
|
@@ -840,6 +861,8 @@ - (void)launchDiffToolWithCommit:(GCCommit*)commit otherCommit:(GCCommit*)otherC
|
840 | 861 | [self _runBeyondCompareWithArguments:@[ [NSString stringWithFormat:@"-title1=%@", oldTitle], [NSString stringWithFormat:@"-title2=%@", newTitle], oldPath, newPath ]];
|
841 | 862 | } else if ([identifier isEqualToString:GIViewControllerTool_P4Merge] || [identifier isEqualToString:GIViewControllerTool_GitTool]) {
|
842 | 863 | ; // Handled above
|
| 864 | + } else if ([identifier isEqualToString:GIViewControllerTool_DiffMerge]) { |
| 865 | + [self _runDiffMergeToolWithArguments:@[ [NSString stringWithFormat:@"-t1=%@", oldTitle], [NSString stringWithFormat:@"-t2=%@", newTitle], oldPath, newPath ]]; |
843 | 866 | } else {
|
844 | 867 | XLOG_DEBUG_UNREACHABLE();
|
845 | 868 | }
|
|
0 commit comments