From ffae6a8564cb58771c41b4500542eea747efc652 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Fri, 3 Oct 2008 19:25:50 +0200 Subject: [PATCH] GitRepository: Add an "all branches" option in branches list This is probably the most common non-branch GitX option, so let's add it by default --- PBGitRepository.m | 3 +++ PBGitRevSpecifier.h | 5 ++++- PBGitRevSpecifier.m | 9 ++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/PBGitRepository.m b/PBGitRepository.m index 5b4e0cc..fcae003 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -231,6 +231,9 @@ static NSString* gitPath; } self.refs = refs; + + // Add an "All branches" option in the branches list + [self addBranch:[PBGitRevSpecifier allBranchesRevSpec]]; return ret; } diff --git a/PBGitRevSpecifier.h b/PBGitRevSpecifier.h index 5477786..9fef784 100644 --- a/PBGitRevSpecifier.h +++ b/PBGitRevSpecifier.h @@ -23,6 +23,9 @@ - (BOOL) hasLeftRight; - (BOOL) isEqualTo: (PBGitRevSpecifier*) other; -@property(readonly) NSString* description; + ++ (PBGitRevSpecifier *)allBranchesRevSpec; + +@property(copy) NSString* description; @property(readonly) NSArray* parameters; @end diff --git a/PBGitRevSpecifier.m b/PBGitRevSpecifier.m index a8d73f7..f18b129 100644 --- a/PBGitRevSpecifier.m +++ b/PBGitRevSpecifier.m @@ -11,7 +11,7 @@ @implementation PBGitRevSpecifier -@synthesize parameters; +@synthesize parameters, description; - (id) initWithParameters:(NSArray*) params { @@ -27,6 +27,13 @@ return self; } ++ (PBGitRevSpecifier *)allBranchesRevSpec +{ + id revspec = [[PBGitRevSpecifier alloc] initWithParameters:[NSArray arrayWithObject:@"--all"]]; + [revspec setDescription:@"All branches"]; + return revspec; +} + - (BOOL) isSimpleRef { return ([parameters count] == 1 && ![[parameters objectAtIndex:0] hasPrefix:@"-"]);