mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
6e978dcea4
This makes the PBGitRevisionCell a bit nicer by retrieving all values from the PBGitCommit object itself, and using another NSTextFieldCell to draw the text. This mean that PBGitGrapher now stores its information in the PBGitCommit's, rather than in a custom grapher array. Also, because we don't need the grapher to display refs anymore, the ref labels are also displayed when using path limiting (for example, 'gitx -- Makefile').
61 lines
1.2 KiB
Objective-C
61 lines
1.2 KiB
Objective-C
//
|
|
// PBGitCommit.m
|
|
// GitTest
|
|
//
|
|
// Created by Pieter de Bie on 13-06-08.
|
|
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
|
//
|
|
|
|
#import "PBGitCommit.h"
|
|
|
|
|
|
@implementation PBGitCommit
|
|
|
|
@synthesize sha, repository, subject, author, date, parents, sign, lineInfo, refs;
|
|
|
|
|
|
- (NSString *) dateString
|
|
{
|
|
NSDateFormatter* formatter = [[NSDateFormatter alloc] initWithDateFormat:@"%Y-%m-%d %H:%M:%S" allowNaturalLanguage:NO];
|
|
return [formatter stringFromDate: self.date];
|
|
}
|
|
|
|
- (NSArray*) treeContents
|
|
{
|
|
return self.tree.children;
|
|
}
|
|
|
|
- initWithRepository:(PBGitRepository*) repo andSha:(NSString*) newSha
|
|
{
|
|
details = nil;
|
|
self.repository = repo;
|
|
self.sha = newSha;
|
|
return self;
|
|
}
|
|
|
|
- (NSString*) details
|
|
{
|
|
if (details != nil)
|
|
return details;
|
|
|
|
NSFileHandle* handle = [self.repository handleForCommand:[@"show --pretty=raw " stringByAppendingString:self.sha]];
|
|
details = [[NSString alloc] initWithData:[handle readDataToEndOfFile] encoding: NSUTF8StringEncoding];
|
|
|
|
return details;
|
|
}
|
|
|
|
- (PBGitTree*) tree
|
|
{
|
|
return [PBGitTree rootForCommit: self];
|
|
}
|
|
|
|
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
|
|
{
|
|
return NO;
|
|
}
|
|
|
|
+ (BOOL)isKeyExcludedFromWebScript:(const char *)name {
|
|
return NO;
|
|
}
|
|
@end
|