Permalink
Browse files

Improved overall performance (in particular when opening repositories…

…), by only reloading the refs when it's really necessary. This also fixes #188 as the branch badges are correctly calculated on startup.
  • Loading branch information...
1 parent b57c1b4 commit 21b8f38b7cdf54489a4514a8001c44bcfcedef6a @jphalip jphalip committed May 30, 2012
Showing with 10 additions and 7 deletions.
  1. +2 −2 PBGitRepository.m
  2. +8 −4 PBGitSidebarController.m
  3. +0 −1 PBGitWindowController.m
View
@@ -186,13 +186,13 @@ - (void) setup
{
config = [[PBGitConfig alloc] initWithRepositoryPath:[[self fileURL] path]];
self.branches = [NSMutableArray array];
- [self reloadRefs];
currentBranchFilter = [PBGitDefaults branchFilter];
revisionList = [[PBGitHistoryList alloc] initWithRepository:self];
-
resetController = [[PBGitResetController alloc] initWithRepository:self];
stashController = [[PBStashController alloc] initWithRepository:self];
submoduleController = [[PBSubmoduleController alloc] initWithRepository:self];
+ [self reloadRefs];
+ [self readCurrentBranch];
}
- (void)close
View
@@ -84,6 +84,7 @@ - (void)awakeFromNib
[sourceView setDoubleAction:@selector(outlineDoubleClicked)];
[sourceView setTarget:self];
+ [self updateMetaDataForBranches];
}
- (void)closeView
@@ -162,15 +163,14 @@ - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(
for(PBGitSVRemoteItem* remote in [remotes children]){
[self performSelectorInBackground:@selector(evaluateRemoteBadge:) withObject:remote];
}
-
- [self updateMetaDataforBranches:branches];
+ [self updateMetaDataForBranches];
}else{
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
--(void)updateMetaDataforBranches:(PBSourceViewItem *)theBranches
+-(void)updateMetaDataForBranches:(PBSourceViewItem *)theBranches
{
for(PBGitSVBranchItem* branch in [theBranches children]){
if([branch isKindOfClass:[PBGitSVBranchItem class]]){
@@ -184,11 +184,15 @@ -(void)updateMetaDataforBranches:(PBSourceViewItem *)theBranches
});
});
}else if ([branch isKindOfClass:[PBGitSVFolderItem class]]) {
- [self updateMetaDataforBranches: branch];
+ [self updateMetaDataForBranches: branch];
}
}
}
+-(void)updateMetaDataForBranches
+{
+ [self updateMetaDataForBranches: branches];
+}
#pragma mark Badges Methods
View
@@ -135,7 +135,6 @@ - (void) changeContentController:(PBViewController *)controller
[self setNextResponder: contentController];
[[self window] makeFirstResponder:[contentController firstResponder]];
- [contentController updateView];
[contentController addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionInitial context:@"statusChange"];
}

0 comments on commit 21b8f38

Please sign in to comment.