forked from laullon/gitx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPBGitSVBranchItem.m
48 lines (35 loc) · 929 Bytes
/
PBGitSVBranchItem.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// PBGitSVBranchItem.m
// GitX
//
// Created by Nathan Kinsinger on 3/2/10.
// Copyright 2010 Nathan Kinsinger. All rights reserved.
//
#import "PBGitSVBranchItem.h"
@implementation PBGitSVBranchItem
@synthesize isCheckedOut;
@synthesize behind,ahead;
+ (id)branchItemWithRevSpec:(PBGitRevSpecifier *)revSpecifier
{
PBGitSVBranchItem *item = [self itemWithTitle:[[revSpecifier description] lastPathComponent]];
item.revSpecifier = revSpecifier;
return item;
}
- (NSImage *) icon
{
static NSImage *branchImage = nil;
if (!branchImage)
branchImage = [NSImage imageNamed:@"Branch.png"];
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