HistoryView: Remove the BranchController

This wasn't used anyway. A good idea would be to create a new
branchcontroller that takes care of all these revs, rather than
letting PBGitRepository take care of that
This commit is contained in:
Pieter de Bie
2008-11-19 01:54:14 +01:00
parent 92437c6663
commit a62e14ffe7
8 changed files with 11 additions and 89 deletions
+1 -1
View File
@@ -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];
-1
View File
@@ -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;
+1 -3
View File
@@ -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
-47
View File
@@ -43,21 +43,6 @@
<string key="NSTreeContentChildrenKey">children</string>
<string key="NSTreeContentLeafKey">leaf</string>
</object>
<object class="NSArrayController" id="886549521">
<object class="NSMutableArray" key="NSDeclaredKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>a</string>
<string>shortName</string>
<string>description</string>
</object>
<bool key="NSEditable">YES</bool>
<object class="_NSManagedProxy" key="_NSManagedProxy"/>
<bool key="NSAvoidsEmptySelection">YES</bool>
<bool key="NSPreservesSelection">YES</bool>
<bool key="NSSelectsInsertedObjects">YES</bool>
<bool key="NSFilterRestrictsInsertion">YES</bool>
<bool key="NSClearsFilterPredicateOnInsertion">YES</bool>
</object>
<object class="NSArrayController" id="391209158">
<object class="NSMutableArray" key="NSDeclaredKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1823,30 +1808,6 @@
</object>
<int key="connectionID">185</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">contentArray: repository.branches</string>
<reference key="source" ref="886549521"/>
<reference key="destination" ref="1001"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="886549521"/>
<reference key="NSDestination" ref="1001"/>
<string key="NSLabel">contentArray: repository.branches</string>
<string key="NSBinding">contentArray</string>
<string key="NSKeyPath">repository.branches</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">193</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">branchesController</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="886549521"/>
</object>
<int key="connectionID">198</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">predicate: filterPredicate</string>
@@ -2464,12 +2425,6 @@
<reference key="object" ref="853819733"/>
<reference key="parent" ref="976830280"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">190</int>
<reference key="object" ref="886549521"/>
<reference key="parent" ref="1002"/>
<string key="objectName">Branches Controller</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">231</int>
<reference key="object" ref="892732705"/>
@@ -2748,7 +2703,6 @@
<string>17.IBPluginDependency</string>
<string>18.IBPluginDependency</string>
<string>19.IBPluginDependency</string>
<string>190.IBPluginDependency</string>
<string>2.CustomClassName</string>
<string>2.IBEditorWindowLastContentRect</string>
<string>2.IBPluginDependency</string>
@@ -2847,7 +2801,6 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>PBNiceSplitView</string>
<string>{{312, 577}, {852, 384}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+4 -5
View File
@@ -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
+1 -22
View File
@@ -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
+2 -8
View File
@@ -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]) {
+2 -2
View File
@@ -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