5 // Created by Pieter de Bie on 22-09-08.
6 // Copyright 2008 __MyCompanyName__. All rights reserved.
9 #import "PBChangedFile.h"
10 #import "PBEasyPipe.h"
12 @implementation PBChangedFile
14 @synthesize path, status, cached;
16 - (id) initWithPath:(NSString *)p andRepository:(PBGitRepository *)r
23 - (NSString *) changes
26 return [PBEasyPipe outputForCommand:@"/bin/cat" withArgs:[NSArray arrayWithObject:path] inDir:[repository workingDirectory]];
29 return [repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"diff", @"--cached", @"--", path, nil]];
31 return [repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"diff", @"--", path, nil]];
40 filename = @"new_file";
43 filename = @"deleted_file";
46 filename = @"empty_file";
49 NSString *p = [[NSBundle mainBundle] pathForResource:filename ofType:@"png"];
50 return [[NSImage alloc] initByReferencingFile: p];
55 if (status == DELETED)
56 [repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"rm", path, nil]];
58 [repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"add", path, nil]];
62 - (void) unstageChanges
64 [repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"reset", @"--", path, nil]];
68 + (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
73 + (BOOL)isKeyExcludedFromWebScript:(const char *)name {