Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 70 lines (53 sloc) 1.406 kb
b752f5b @pieter Add a search field and subject
pieter authored
1 //
2 // PBGitCommit.m
3 // GitTest
4 //
5 // Created by Pieter de Bie on 13-06-08.
6 // Copyright 2008 __MyCompanyName__. All rights reserved.
7 //
8
9 #import "PBGitCommit.h"
10
11
12 @implementation PBGitCommit
13
6e978dc @pieter Refactor cellInfo structure
pieter authored
14 @synthesize sha, repository, subject, author, date, parents, sign, lineInfo, refs;
3979787 @pieter Optimize rev-list parsing
pieter authored
15
16
17 - (NSString *) dateString
18 {
19 NSDateFormatter* formatter = [[NSDateFormatter alloc] initWithDateFormat:@"%Y-%m-%d %H:%M:%S" allowNaturalLanguage:NO];
20 return [formatter stringFromDate: self.date];
21 }
b752f5b @pieter Add a search field and subject
pieter authored
22
3106379 @pieter Use unified interface and display tree contents
pieter authored
23 - (NSArray*) treeContents
24 {
25 return self.tree.children;
26 }
27
b752f5b @pieter Add a search field and subject
pieter authored
28 - initWithRepository:(PBGitRepository*) repo andSha:(NSString*) newSha
29 {
3a672ae @pieter Cache commit details so we have to fork less
pieter authored
30 details = nil;
b752f5b @pieter Add a search field and subject
pieter authored
31 self.repository = repo;
32 self.sha = newSha;
33 return self;
34 }
35
36 - (NSString*) details
37 {
3a672ae @pieter Cache commit details so we have to fork less
pieter authored
38 if (details != nil)
39 return details;
40
a3d0d66 @pieter Use a stylesheet for detailed view
pieter authored
41 NSFileHandle* handle = [self.repository handleForCommand:[@"show --pretty=raw " stringByAppendingString:self.sha]];
7cdfdf0 @pieter Use UTF-8 for data decoding
pieter authored
42 details = [[NSString alloc] initWithData:[handle readDataToEndOfFile] encoding: NSUTF8StringEncoding];
e6da252 @pieter Add shortcuts and menu items for different views
pieter authored
43
44 return details;
b752f5b @pieter Add a search field and subject
pieter authored
45 }
79e9ba9 @pieter Add a detailed HTML view
pieter authored
46
c6966ad @pieter HistoryView: Add a method to put a commit online
pieter authored
47 - (NSString *) patch
48 {
49 if (_patch != nil)
50 return _patch;
51
52 _patch = [repository outputForArguments:[NSArray arrayWithObjects:@"format-patch", @"-1", @"--stdout", sha, nil]];
53 return _patch;
54 }
55
9be3c50 @pieter Add a Tree displayer
pieter authored
56 - (PBGitTree*) tree
57 {
58 return [PBGitTree rootForCommit: self];
59 }
60
79e9ba9 @pieter Add a detailed HTML view
pieter authored
61 + (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
62 {
63 return NO;
64 }
65
66 + (BOOL)isKeyExcludedFromWebScript:(const char *)name {
67 return NO;
68 }
b752f5b @pieter Add a search field and subject
pieter authored
69 @end
Something went wrong with that request. Please try again.