diff --git a/PBCLIProxy.mm b/PBCLIProxy.mm index a4a613d..4a9737c 100644 --- a/PBCLIProxy.mm +++ b/PBCLIProxy.mm @@ -56,7 +56,7 @@ ((PBGitWindowController *)document.windowController).selectedViewIndex = 1; else { PBGitRevSpecifier* rev = [[PBGitRevSpecifier alloc] initWithParameters:arguments]; - [document selectBranch: [document addBranch: rev]]; + document.currentBranch = [document addBranch: rev]; } [NSApp activateIgnoringOtherApps:YES]; diff --git a/PBGitHistoryController.h b/PBGitHistoryController.h index a6788d7..4b171eb 100644 --- a/PBGitHistoryController.h +++ b/PBGitHistoryController.h @@ -14,7 +14,6 @@ @interface PBGitHistoryController : PBViewController { IBOutlet NSSearchField *searchField; IBOutlet NSArrayController* commitController; - IBOutlet NSArrayController *branchesController; IBOutlet NSTreeController* treeController; IBOutlet NSOutlineView* fileBrowser; IBOutlet NSTableView* commitList; diff --git a/PBGitHistoryController.m b/PBGitHistoryController.m index bd26d76..64758bb 100644 --- a/PBGitHistoryController.m +++ b/PBGitHistoryController.m @@ -29,7 +29,7 @@ [fileBrowser setTarget:self]; [fileBrowser setDoubleAction:@selector(openSelectedFile:)]; - if ([repository.currentBranch count] == 0) { + if (!repository.currentBranch) { [repository reloadRefs]; [repository readCurrentBranch]; } @@ -41,8 +41,6 @@ [[commitList tableColumnWithIdentifier:@"subject"] setSortDescriptorPrototype:[[NSSortDescriptor alloc] initWithKey:@"subject" ascending:YES]]; [super awakeFromNib]; - // We bind this ourselves because otherwise we would lose our selection - [branchesController bind:@"selectionIndexes" toObject:repository withKeyPath:@"currentBranch" options:nil]; } - (void) updateKeys diff --git a/PBGitHistoryView.xib b/PBGitHistoryView.xib index 4ba3274..fcb4f3a 100644 --- a/PBGitHistoryView.xib +++ b/PBGitHistoryView.xib @@ -43,21 +43,6 @@ children leaf - - - YES - a - shortName - description - - YES - - YES - YES - YES - YES - YES - YES @@ -1823,30 +1808,6 @@ 185 - - - contentArray: repository.branches - - - - - - contentArray: repository.branches - contentArray - repository.branches - 2 - - - 193 - - - - branchesController - - - - 198 - predicate: filterPredicate @@ -2464,12 +2425,6 @@ - - 190 - - - Branches Controller - 231 @@ -2748,7 +2703,6 @@ 17.IBPluginDependency 18.IBPluginDependency 19.IBPluginDependency - 190.IBPluginDependency 2.CustomClassName 2.IBEditorWindowLastContentRect 2.IBPluginDependency @@ -2847,7 +2801,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin PBNiceSplitView {{312, 577}, {852, 384}} com.apple.InterfaceBuilder.CocoaPlugin diff --git a/PBGitRepository.h b/PBGitRepository.h index 8623b6a..04aa5b0 100644 --- a/PBGitRepository.h +++ b/PBGitRepository.h @@ -18,9 +18,9 @@ extern NSString* PBGitRepositoryErrorDomain; PBGitConfig *config; BOOL hasChanged; - NSMutableArray* branches; - NSIndexSet* currentBranch; - NSMutableDictionary* refs; + NSMutableArray *branches; + PBGitRevSpecifier *currentBranch; + NSMutableDictionary *refs; PBGitRevSpecifier *_headRef; // Caching } @@ -45,7 +45,6 @@ extern NSString* PBGitRepositoryErrorDomain; - (void) readCurrentBranch; - (PBGitRevSpecifier*) addBranch: (PBGitRevSpecifier*) rev; -- (void) selectBranch: (PBGitRevSpecifier*) rev; - (NSString*) parseSymbolicReference:(NSString*) ref; - (NSString*) parseReference:(NSString*) ref; @@ -61,6 +60,6 @@ extern NSString* PBGitRepositoryErrorDomain; @property (readonly) PBGitConfig *config; @property (retain) PBGitRevList* revisionList; @property (assign) NSMutableArray* branches; -@property (assign) NSIndexSet* currentBranch; +@property (assign) PBGitRevSpecifier *currentBranch; @property (assign) NSMutableDictionary* refs; @end diff --git a/PBGitRepository.m b/PBGitRepository.m index 1a12135..4bbc8c3 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -264,31 +264,10 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; [self didChangeValueForKey:@"branches"]; return rev; } - -- (void) showHistoryView -{ - if (!self.windowController) - return; - - [((PBGitWindowController *)self.windowController) showHistoryView:self]; -} - -- (void) selectBranch: (PBGitRevSpecifier*) rev -{ - int i; - for (i = 0; i < [branches count]; i++) { - PBGitRevSpecifier* aRev = [branches objectAtIndex:i]; - if (rev == aRev) { - self.currentBranch = [NSIndexSet indexSetWithIndex:i]; - [self showHistoryView]; - return; - } - } -} - (void) readCurrentBranch { - [self selectBranch: [self addBranch: [self headRef]]]; + self.currentBranch = [self addBranch: [self headRef]]; } - (NSString *) workingDirectory diff --git a/PBGitRevList.m b/PBGitRevList.m index 8bd1fcf..0b74ad3 100644 --- a/PBGitRevList.m +++ b/PBGitRevList.m @@ -35,16 +35,10 @@ // and in that case we don't have to reload the revision list. // If no branch is selected, don't do anything - if (![repository currentBranch] || [[repository currentBranch] count] == 0) + if (![repository currentBranch]) return; - NSArray* selectedBranches = [[repository branches] objectsAtIndexes: [repository currentBranch]]; - - // Apparently, The selected index does not exist.. don't do anything - if ([selectedBranches count] == 0) - return; - - PBGitRevSpecifier* newRev = [selectedBranches objectAtIndex:0]; + PBGitRevSpecifier* newRev = [repository currentBranch]; NSString* newSha = nil; if (!force && newRev && [newRev isSimpleRef]) { diff --git a/PBRefController.m b/PBRefController.m index 14930d3..d2b7c2d 100644 --- a/PBRefController.m +++ b/PBRefController.m @@ -285,7 +285,7 @@ - (void) changeBranch:(NSMenuItem *)sender { PBGitRevSpecifier *rev = [sender representedObject]; - [historyController.repository selectBranch:rev]; - [branchPopUp selectItem:nil]; + historyController.repository.currentBranch = rev; + [branchPopUp setTitle:[sender title]]; } @end