Add a diff window

This allows you to do something like

	gitx --diff

to display a diff similar to 'git diff', but with GitX prettification.

It accepts all git diff parameters, so you can do something like

	gitx --diff HEAD~10

to show the diff compared to the last 10 commits. Or, you can something like

	git diff | gitx

to pipe anything that produces a diff to GitX
This commit is contained in:
Pieter de Bie
2008-10-13 23:43:28 +02:00
parent e054a17a0c
commit e8131c3898
10 changed files with 546 additions and 38 deletions
+41
View File
@@ -0,0 +1,41 @@
//
// PBWebDiffController.m
// GitX
//
// Created by Pieter de Bie on 13-10-08.
// Copyright 2008 Pieter de Bie. All rights reserved.
//
#import "PBWebDiffController.h"
@implementation PBWebDiffController
- (void) awakeFromNib
{
startFile = @"simpleDiff";
[super awakeFromNib];
[diffController addObserver:self forKeyPath:@"diff" options:0 context:@"ChangedDiff"];
}
- (void) didLoad
{
[self showDiff:diffController.diff];
}
- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(NSString *)context
{
if ([context isEqualToString: @"ChangedDiff"])
[self showDiff:diffController.diff];
}
- (void) showDiff: (NSString *) diff
{
if (diff == nil || !finishedLoading)
return;
id script = [view windowScriptObject];
[script callWebScriptMethod:@"showDiff" withArguments: [NSArray arrayWithObject:diff]];
}
@end