Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit a62e14ffe76ff3c3da96873efffe1c9e671ddc5b 1 parent 92437c6
@pieter authored
View
2  PBCLIProxy.mm
@@ -56,7 +56,7 @@ - (BOOL)openRepository:(NSURL*)repositoryPath arguments: (NSArray*) args error:(
((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];
View
1  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;
View
4 PBGitHistoryController.m
@@ -29,7 +29,7 @@ - (void)awakeFromNib
[fileBrowser setTarget:self];
[fileBrowser setDoubleAction:@selector(openSelectedFile:)];
- if ([repository.currentBranch count] == 0) {
+ if (!repository.currentBranch) {
[repository reloadRefs];
[repository readCurrentBranch];
}
@@ -41,8 +41,6 @@ - (void)awakeFromNib
[[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
View
47 PBGitHistoryView.xib
@@ -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>
@@ -1825,30 +1810,6 @@
</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>
<reference key="source" ref="449521666"/>
<reference key="destination" ref="391209158"/>
@@ -2465,12 +2426,6 @@
<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"/>
<reference key="parent" ref="1002"/>
@@ -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>
View
9 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
View
23 PBGitRepository.m
@@ -264,31 +264,10 @@ - (PBGitRevSpecifier*) addBranch: (PBGitRevSpecifier*) rev
[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
View
10 PBGitRevList.m
@@ -35,16 +35,10 @@ - (void) readCommitsForce: (BOOL) force
// 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]) {
View
4 PBRefController.m
@@ -285,7 +285,7 @@ - (void) updateBranchMenu
- (void) changeBranch:(NSMenuItem *)sender
{
PBGitRevSpecifier *rev = [sender representedObject];
- [historyController.repository selectBranch:rev];
- [branchPopUp selectItem:nil];
+ historyController.repository.currentBranch = rev;
+ [branchPopUp setTitle:[sender title]];
}
@end
Please sign in to comment.
Something went wrong with that request. Please try again.