From 7007996c08ce2bf46649ef3c01c4d2c2b6b4ae49 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Wed, 5 Jan 2011 21:06:51 -0800 Subject: [PATCH 1/8] File names with whites spaces on history view --- GLFileView.m | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/GLFileView.m b/GLFileView.m index 3c114f2..3fa1ee8 100644 --- a/GLFileView.m +++ b/GLFileView.m @@ -238,11 +238,10 @@ NSArray *lines = [txt componentsSeparatedByString:@"\n"]; NSMutableString *res=[NSMutableString string]; [res appendString:@""]; - int i; - for (i=1; i<[lines count]; i++) { - NSString *line=[lines objectAtIndex:i]; - NSArray *fields=[line componentsSeparatedByString:@" "]; - NSArray *fileStatus=[[fields objectAtIndex:4] componentsSeparatedByString:@"\t"]; + for (NSString *line in lines) { + if([line length]<98) continue; + line=[line substringFromIndex:97]; + NSArray *fileStatus=[line componentsSeparatedByString:@"\t"]; NSString *status=[[fileStatus objectAtIndex:0] substringToIndex:1]; // ignore the score NSString *file=[fileStatus objectAtIndex:1]; NSString *txt=file; From bee812f85ac0aeae0b9109b521a3622bbbe0e8e1 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Wed, 5 Jan 2011 21:46:12 -0800 Subject: [PATCH 2/8] only show images as images ;) --- GLFileView.h | 5 +++++ GLFileView.m | 38 +++++++++++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/GLFileView.h b/GLFileView.h index dfeb15e..7dd9125 100644 --- a/GLFileView.h +++ b/GLFileView.h @@ -36,6 +36,11 @@ +(BOOL)isStartDiff:(NSString *)line; +(BOOL)isStartBlock:(NSString *)line; ++(NSArray *)getFilesNames:(NSString *)line; ++(BOOL)isBinaryFile:(NSString *)line; ++(NSString*)mimeTypeForFileName:(NSString*)file; ++(BOOL)isImage:(NSString*)file; + @property(retain) NSMutableArray *groups; @property(retain) NSString *logFormat; diff --git a/GLFileView.m b/GLFileView.m index 3fa1ee8..a4b6ba0 100644 --- a/GLFileView.m +++ b/GLFileView.m @@ -181,7 +181,6 @@ - (void)scopeBar:(MGScopeBar *)theScopeBar selectedStateChanged:(BOOL)selected forItem:(NSString *)identifier inGroup:(int)groupNumber { - NSLog(@"startFile=%@ identifier=%@ groupNumber=%d",startFile,identifier,groupNumber); if((groupNumber==0) && (startFile!=identifier)){ NSString *path = [NSString stringWithFormat:@"html/views/%@", identifier]; NSString *html = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:path]; @@ -330,17 +329,19 @@ }else if(inDiff){ [res appendString:[NSString stringWithFormat:@"

%@

",line]]; if([self isBinaryFile:line]){ - NSLog(@"line='%@'",line); [res appendString:@"
"]; NSArray *files=[self getFilesNames:line]; - NSLog(@"files='%@'",files); if(![[files objectAtIndex:0] isAbsolutePath]){ [res appendString:[NSString stringWithFormat:@"",[files objectAtIndex:0]]]; - [res appendString:[NSString stringWithFormat:@"",[files objectAtIndex:0]]]; + if([GLFileView isImage:[files objectAtIndex:0]]){ + [res appendString:[NSString stringWithFormat:@"",[files objectAtIndex:0]]]; + } } if(![[files objectAtIndex:1] isAbsolutePath]){ [res appendString:[NSString stringWithFormat:@"",[files objectAtIndex:1]]]; - [res appendString:[NSString stringWithFormat:@"",[files objectAtIndex:1]]]; + if([GLFileView isImage:[files objectAtIndex:1]]){ + [res appendString:[NSString stringWithFormat:@"",[files objectAtIndex:1]]]; + } } } } @@ -361,7 +362,6 @@ { NSString *a; NSString *b; - NSLog(@"line='%@'",line); NSScanner *scanner=[NSScanner scannerWithString:line]; if([scanner scanString:@"Binary files " intoString:NULL]){ [scanner scanUpToString:@" and" intoString:&a]; @@ -374,10 +374,34 @@ if (![b isAbsolutePath]) { b=[b substringFromIndex:2]; } - + return [NSArray arrayWithObjects:a,b,nil]; } ++(NSString*)mimeTypeForFileName:(NSString*)name +{ + NSString *mimeType = nil; + NSInteger i=[name rangeOfString:@"." options:NSBackwardsSearch].location; + if(i!=NSNotFound){ + NSString *ext=[name substringFromIndex:i+1]; + CFStringRef UTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (CFStringRef)ext, NULL); + if(UTI){ + CFStringRef registeredType = UTTypeCopyPreferredTagWithClass(UTI, kUTTagClassMIMEType); + if(registeredType){ + mimeType = NSMakeCollectable(registeredType); + } + CFRelease(UTI); + } + } + return mimeType; +} + ++(BOOL)isImage:(NSString*)file +{ + NSString *mimeType=[GLFileView mimeTypeForFileName:file]; + return (mimeType!=nil) && ([mimeType rangeOfString:@"image/" options:NSCaseInsensitiveSearch].location!=NSNotFound); +} + +(BOOL)isBinaryFile:(NSString *)line { return (([line length]>12) && [[line substringToIndex:12] isEqualToString:@"Binary files"]); From b4d2b0d9bd06ca0d224d2075a57426f90b7b2b62 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Wed, 5 Jan 2011 23:08:52 -0800 Subject: [PATCH 3/8] check bug --- PBGitSidebarController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PBGitSidebarController.m b/PBGitSidebarController.m index 301bf16..9f33709 100644 --- a/PBGitSidebarController.m +++ b/PBGitSidebarController.m @@ -223,8 +223,8 @@ - (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(PBSourceViewCell *)cell forTableColumn:(NSTableColumn *)tableColumn item:(PBSourceViewItem *)item { + cell.isCheckedOut = [item.revSpecifier isEqual:[repository headRef]]; if(item.revSpecifier!=NULL){ - cell.isCheckedOut = [item.revSpecifier isEqual:[repository headRef]]; cell.behind=[item.revSpecifier behind]; cell.ahead=[item.revSpecifier ahead]; }else{ From 526f246896e3d50fbc733b3a402fc39b6e2176dc Mon Sep 17 00:00:00 2001 From: German Laullon Date: Wed, 5 Jan 2011 23:37:16 -0800 Subject: [PATCH 4/8] correct branch ahead/behind counters --- PBGitRepository.h | 2 +- PBGitRepository.m | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/PBGitRepository.h b/PBGitRepository.h index a16acc0..9c61a60 100644 --- a/PBGitRepository.h +++ b/PBGitRepository.h @@ -129,7 +129,7 @@ static NSString * PBStringFromBranchFilterType(PBGitXBranchFilterType type) { - (void)findInModeScriptCommand:(NSScriptCommand *)command; -(NSNumber *)countCommintsOf:(NSString *)branchs; -+(bool)isLocalBranch:(NSString *)name; ++(bool)isLocalBranch:(NSString *)branch branchNameInto:(NSString **)name; @property (assign) BOOL hasChanged; diff --git a/PBGitRepository.m b/PBGitRepository.m index edec8ec..db5e650 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -269,9 +269,10 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; PBGitRef *newRef = [PBGitRef refFromString:[components objectAtIndex:0]]; PBGitRevSpecifier *revSpec = [[PBGitRevSpecifier alloc] initWithRef:newRef]; - if([PBGitRepository isLocalBranch:[components objectAtIndex:0]]){ - [revSpec setAhead:[self countCommintsOf:[NSString stringWithFormat:@"origin..%@",[components objectAtIndex:0]]]]; - [revSpec setBehind:[self countCommintsOf:[NSString stringWithFormat:@"%@..origin",[components objectAtIndex:0]]]]; + NSString *bName; + if([PBGitRepository isLocalBranch:[components objectAtIndex:0] branchNameInto:&bName]){ + [revSpec setAhead:[self countCommintsOf:[NSString stringWithFormat:@"origin/%@..%@",bName,bName]]]; + [revSpec setBehind:[self countCommintsOf:[NSString stringWithFormat:@"%@..origin/%@",bName,bName]]]; } [self addBranch:revSpec]; [self addRef:newRef fromParameters:components]; @@ -288,14 +289,19 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; [[[self windowController] window] setTitle:[self displayName]]; } -+(bool)isLocalBranch:(NSString *)name ++(bool)isLocalBranch:(NSString *)branch branchNameInto:(NSString **)name { - NSScanner *scanner=[NSScanner scannerWithString:name]; - return [scanner scanString:@"refs/heads/" intoString:NULL]; + NSScanner *scanner=[NSScanner scannerWithString:branch]; + bool is=[scanner scanString:@"refs/heads/" intoString:NULL]; + if(is && (name)){ + *name=[branch substringFromIndex:[scanner scanLocation]]; + } + return is; } -(NSNumber *)countCommintsOf:(NSString *)branchs { + NSLog(@"branchs:'%@'",branchs); NSArray *args = [NSArray arrayWithObjects:@"rev-list", branchs, nil]; NSString *o = [self outputForArguments:args]; if ([o length]==0) { From 8249c9605d99509debf0f40013bccf7750373dad Mon Sep 17 00:00:00 2001 From: German Laullon Date: Thu, 6 Jan 2011 00:03:21 -0800 Subject: [PATCH 5/8] error control on branch counters --- PBGitRepository.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PBGitRepository.m b/PBGitRepository.m index db5e650..01992c8 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -303,8 +303,9 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; { NSLog(@"branchs:'%@'",branchs); NSArray *args = [NSArray arrayWithObjects:@"rev-list", branchs, nil]; - NSString *o = [self outputForArguments:args]; - if ([o length]==0) { + int ret; + NSString *o = [self outputForArguments:args retValue:&ret]; + if ((ret!=0) || ([o length]==0)) { return NULL; } NSArray *commits = [o componentsSeparatedByString:@"\n"]; From 0253054fe5f6f13f940bf01951c6a77d02862414 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Thu, 6 Jan 2011 00:03:44 -0800 Subject: [PATCH 6/8] avoid unnecessary reloads --- PBGitHistoryList.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PBGitHistoryList.m b/PBGitHistoryList.m index 0a4433f..0ab1324 100644 --- a/PBGitHistoryList.m +++ b/PBGitHistoryList.m @@ -287,7 +287,7 @@ - (BOOL) haveRefsBeenModified { - [repository reloadRefs]; + //[repository reloadRefs]; NSMutableSet *currentRefSHAs = [NSMutableSet setWithArray:[repository.refs allKeys]]; [currentRefSHAs minusSet:lastRefSHAs]; From 0151598af03e1abc744e1ff1b64925bfd0a03b82 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Fri, 7 Jan 2011 00:37:29 -0800 Subject: [PATCH 7/8] (inital) display if remotes need a fetch --- PBGitSVRemoteItem.h | 4 +++- PBGitSVRemoteItem.m | 1 + PBGitSidebarController.h | 2 ++ PBGitSidebarController.m | 26 +++++++++++++++++++++----- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/PBGitSVRemoteItem.h b/PBGitSVRemoteItem.h index a64084c..8f27532 100644 --- a/PBGitSVRemoteItem.h +++ b/PBGitSVRemoteItem.h @@ -11,9 +11,11 @@ @interface PBGitSVRemoteItem : PBSourceViewItem { - + BOOL alert; } +@property (assign) BOOL alert; + + (id)remoteItemWithTitle:(NSString *)title; @end diff --git a/PBGitSVRemoteItem.m b/PBGitSVRemoteItem.m index 4ce251d..cbc4c32 100644 --- a/PBGitSVRemoteItem.m +++ b/PBGitSVRemoteItem.m @@ -12,6 +12,7 @@ @implementation PBGitSVRemoteItem +@synthesize alert; + (id)remoteItemWithTitle:(NSString *)title { diff --git a/PBGitSidebarController.h b/PBGitSidebarController.h index 268ba5c..134c251 100644 --- a/PBGitSidebarController.h +++ b/PBGitSidebarController.h @@ -40,6 +40,8 @@ - (void)setHistorySearch:(NSString *)searchString mode:(NSInteger)mode; +-(bool)remoteNeedFetch:(NSString *)remote; + @property(readonly) NSMutableArray *items; @property(readonly) NSView *sourceListControlsView; @property(readonly) PBGitHistoryController *historyViewController; diff --git a/PBGitSidebarController.m b/PBGitSidebarController.m index 9f33709..528bafd 100644 --- a/PBGitSidebarController.m +++ b/PBGitSidebarController.m @@ -51,6 +51,7 @@ historyViewController = [[PBGitHistoryController alloc] initWithRepository:repository superController:superController]; commitViewController = [[PBGitCommitController alloc] initWithRepository:repository superController:superController]; + [repository addObserver:self forKeyPath:@"refs" options:0 context:@"updateRefs"]; [repository addObserver:self forKeyPath:@"currentBranch" options:0 context:@"currentBranchChange"]; [repository addObserver:self forKeyPath:@"branches" options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:@"branchesModified"]; @@ -79,9 +80,7 @@ [sourceView reloadData]; [self selectCurrentBranch]; return; - } - - if ([@"branchesModified" isEqualToString:context]) { + }else if ([@"branchesModified" isEqualToString:context]) { NSInteger changeKind = [(NSNumber *)[change objectForKey:NSKeyValueChangeKindKey] intValue]; if (changeKind == NSKeyValueChangeInsertion) { @@ -97,10 +96,22 @@ for (PBGitRevSpecifier *rev in removedRevSpecs) [self removeRevSpec:rev]; } - return; + }else if ([@"updateRefs" isEqualToString:context]) { + for(PBGitSVRemoteItem* remote in [remotes children]){ + NSLog(@"remote.title=%@",[remote title]); + [remote setAlert:[self remoteNeedFetch:[remote title]]]; + } + }else{ + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } +} - [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; +-(bool)remoteNeedFetch:(NSString *)remote +{ + int ret; + NSArray *args = [NSArray arrayWithObjects:@"fetch", @"--dry-run", remote, nil]; + NSString *o = [repository outputForArguments:args retValue:&ret]; + return ((ret==0) && ([o length]!=0)); } - (PBSourceViewItem *) selectedItem @@ -231,6 +242,11 @@ cell.behind=nil; cell.ahead=nil; } + + if([item isKindOfClass:[PBGitSVRemoteItem class]]){ + NSLog(@"title: %@",[item title]); + cell.isCheckedOut=[item alert]; + } [cell setImage:[item icon]]; } From 5c9d7163e1a9926fe36c00c03716caa81d2cbc72 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Fri, 7 Jan 2011 12:10:44 -0800 Subject: [PATCH 8/8] badge system recoded --- PBGitRepository.m | 18 ------------------ PBGitSVBranchItem.h | 8 +++++++- PBGitSVBranchItem.m | 15 +++++++++++++++ PBGitSVRemoteItem.m | 4 ++++ PBGitSidebarController.h | 1 + PBGitSidebarController.m | 39 ++++++++++++++++++++++++++------------- PBSourceViewCell.h | 10 ++-------- PBSourceViewCell.m | 9 ++------- PBSourceViewItem.h | 2 ++ PBSourceViewItem.m | 5 +++++ 10 files changed, 64 insertions(+), 47 deletions(-) diff --git a/PBGitRepository.m b/PBGitRepository.m index 01992c8..34f10f3 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -269,11 +269,6 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; PBGitRef *newRef = [PBGitRef refFromString:[components objectAtIndex:0]]; PBGitRevSpecifier *revSpec = [[PBGitRevSpecifier alloc] initWithRef:newRef]; - NSString *bName; - if([PBGitRepository isLocalBranch:[components objectAtIndex:0] branchNameInto:&bName]){ - [revSpec setAhead:[self countCommintsOf:[NSString stringWithFormat:@"origin/%@..%@",bName,bName]]]; - [revSpec setBehind:[self countCommintsOf:[NSString stringWithFormat:@"%@..origin/%@",bName,bName]]]; - } [self addBranch:revSpec]; [self addRef:newRef fromParameters:components]; [oldBranches removeObject:revSpec]; @@ -299,19 +294,6 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; return is; } --(NSNumber *)countCommintsOf:(NSString *)branchs -{ - NSLog(@"branchs:'%@'",branchs); - NSArray *args = [NSArray arrayWithObjects:@"rev-list", branchs, nil]; - int ret; - NSString *o = [self outputForArguments:args retValue:&ret]; - if ((ret!=0) || ([o length]==0)) { - return NULL; - } - NSArray *commits = [o componentsSeparatedByString:@"\n"]; - return [NSNumber numberWithInt:[commits count]]; -} - - (void) lazyReload { if (!hasChanged) diff --git a/PBGitSVBranchItem.h b/PBGitSVBranchItem.h index c5e4538..cf1d56f 100644 --- a/PBGitSVBranchItem.h +++ b/PBGitSVBranchItem.h @@ -11,9 +11,15 @@ @interface PBGitSVBranchItem : PBSourceViewItem { - + BOOL isCheckedOut; + NSNumber *behind; + NSNumber *ahead; } + (id)branchItemWithRevSpec:(PBGitRevSpecifier *)revSpecifier; +@property (assign) BOOL isCheckedOut; +@property (assign) NSNumber *behind; +@property (assign) NSNumber *ahead; + @end diff --git a/PBGitSVBranchItem.m b/PBGitSVBranchItem.m index 6723096..3cf0389 100644 --- a/PBGitSVBranchItem.m +++ b/PBGitSVBranchItem.m @@ -11,6 +11,8 @@ @implementation PBGitSVBranchItem +@synthesize isCheckedOut; +@synthesize behind,ahead; + (id)branchItemWithRevSpec:(PBGitRevSpecifier *)revSpecifier { @@ -30,4 +32,17 @@ return branchImage; } + +- (NSString *) badge{ + NSMutableString *badge=nil; + if(isCheckedOut || ahead || behind){ + badge=[NSMutableString string]; + if(isCheckedOut) [badge appendString:@"✔ "]; + if(ahead) [badge appendFormat:@"+%@",ahead]; + if(behind) [badge appendFormat:@"-%@",behind]; + } + return badge; +} + + @end diff --git a/PBGitSVRemoteItem.m b/PBGitSVRemoteItem.m index cbc4c32..0947cfd 100644 --- a/PBGitSVRemoteItem.m +++ b/PBGitSVRemoteItem.m @@ -39,4 +39,8 @@ return [PBGitRef refFromString:[kGitXRemoteRefPrefix stringByAppendingString:self.title]]; } +- (NSString *)badge +{ + return (alert ? @"!" : nil); +} @end diff --git a/PBGitSidebarController.h b/PBGitSidebarController.h index 134c251..78d05ec 100644 --- a/PBGitSidebarController.h +++ b/PBGitSidebarController.h @@ -40,6 +40,7 @@ - (void)setHistorySearch:(NSString *)searchString mode:(NSInteger)mode; +-(NSNumber *)countCommintsOf:(NSString *)range; -(bool)remoteNeedFetch:(NSString *)remote; @property(readonly) NSMutableArray *items; diff --git a/PBGitSidebarController.m b/PBGitSidebarController.m index 528bafd..48901ae 100644 --- a/PBGitSidebarController.m +++ b/PBGitSidebarController.m @@ -101,11 +101,34 @@ NSLog(@"remote.title=%@",[remote title]); [remote setAlert:[self remoteNeedFetch:[remote title]]]; } + + for(PBGitSVBranchItem* branch in [branches children]){ + NSString *bName=[branch title]; + [branch setAhead:[self countCommintsOf:[NSString stringWithFormat:@"origin/%@..%@",bName,bName]]]; + [branch setBehind:[self countCommintsOf:[NSString stringWithFormat:@"%@..origin/%@",bName,bName]]]; + [branch setIsCheckedOut:[branch.revSpecifier isEqual:[repository headRef]]]; + } + }else{ [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } } +#pragma mark Badges Methods + +-(NSNumber *)countCommintsOf:(NSString *)range +{ + NSArray *args = [NSArray arrayWithObjects:@"rev-list", range, nil]; + int ret; + NSString *o = [repository outputForArguments:args retValue:&ret]; + if ((ret!=0) || ([o length]==0)) { + return NULL; + } + NSArray *commits = [o componentsSeparatedByString:@"\n"]; + return [NSNumber numberWithInt:[commits count]]; +} + + -(bool)remoteNeedFetch:(NSString *)remote { int ret; @@ -114,6 +137,8 @@ return ((ret==0) && ([o length]!=0)); } +#pragma mark ----- + - (PBSourceViewItem *) selectedItem { NSInteger index = [sourceView selectedRow]; @@ -234,19 +259,7 @@ - (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(PBSourceViewCell *)cell forTableColumn:(NSTableColumn *)tableColumn item:(PBSourceViewItem *)item { - cell.isCheckedOut = [item.revSpecifier isEqual:[repository headRef]]; - if(item.revSpecifier!=NULL){ - cell.behind=[item.revSpecifier behind]; - cell.ahead=[item.revSpecifier ahead]; - }else{ - cell.behind=nil; - cell.ahead=nil; - } - - if([item isKindOfClass:[PBGitSVRemoteItem class]]){ - NSLog(@"title: %@",[item title]); - cell.isCheckedOut=[item alert]; - } + [cell setBadge:[item badge]]; [cell setImage:[item icon]]; } diff --git a/PBSourceViewCell.h b/PBSourceViewCell.h index fb80ece..fc04a3e 100644 --- a/PBSourceViewCell.h +++ b/PBSourceViewCell.h @@ -9,16 +9,10 @@ #import #import "PBIconAndTextCell.h" - @interface PBSourceViewCell : PBIconAndTextCell { - BOOL isCheckedOut; - NSNumber *behind; - NSNumber *ahead; + NSString *badge; } -@property (assign) BOOL isCheckedOut; -@property (assign) NSNumber *behind; -@property (assign) NSNumber *ahead; - +@property (assign) NSString *badge; @end diff --git a/PBSourceViewCell.m b/PBSourceViewCell.m index f207e04..ed89668 100644 --- a/PBSourceViewCell.m +++ b/PBSourceViewCell.m @@ -15,8 +15,7 @@ @implementation PBSourceViewCell -@synthesize isCheckedOut; -@synthesize behind,ahead; +@synthesize badge; # pragma mark context menu delegate methods @@ -35,11 +34,7 @@ - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)outlineView { - if(behind || ahead || isCheckedOut){ - NSMutableString *badge=[NSMutableString string]; - if(isCheckedOut) [badge appendString:@"✔ "]; - if(ahead) [badge appendFormat:@"+%@",ahead]; - if(behind) [badge appendFormat:@"-%@",behind]; + if(badge){ NSImage *checkedOutImage = [PBSourceViewBadge badge:badge forCell:self]; NSSize imageSize = [checkedOutImage size]; NSRect imageFrame; diff --git a/PBSourceViewItem.h b/PBSourceViewItem.h index 399f8e7..012eef9 100644 --- a/PBSourceViewItem.h +++ b/PBSourceViewItem.h @@ -26,6 +26,8 @@ + (id)itemWithRevSpec:(PBGitRevSpecifier *)revSpecifier; + (id)itemWithTitle:(NSString *)title; +- (NSString *)badge; + - (void)addChild:(PBSourceViewItem *)child; - (void)removeChild:(PBSourceViewItem *)child; diff --git a/PBSourceViewItem.m b/PBSourceViewItem.m index 5d450fb..5e4f881 100644 --- a/PBSourceViewItem.m +++ b/PBSourceViewItem.m @@ -109,6 +109,11 @@ return nil; } +- (NSString *)badge +{ + return nil; +} + - (NSImage *) icon { return nil;
%@
%@