mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Merge branch 'refs/heads/branch-status'
This commit is contained in:
+1
-1
@@ -287,7 +287,7 @@
|
||||
|
||||
- (BOOL) haveRefsBeenModified
|
||||
{
|
||||
[repository reloadRefs];
|
||||
//[repository reloadRefs];
|
||||
|
||||
NSMutableSet *currentRefSHAs = [NSMutableSet setWithArray:[repository.refs allKeys]];
|
||||
[currentRefSHAs minusSet:lastRefSHAs];
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+15
-8
@@ -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,17 +289,23 @@ 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) {
|
||||
int ret;
|
||||
NSString *o = [self outputForArguments:args retValue:&ret];
|
||||
if ((ret!=0) || ([o length]==0)) {
|
||||
return NULL;
|
||||
}
|
||||
NSArray *commits = [o componentsSeparatedByString:@"\n"];
|
||||
|
||||
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user