From b4f6ba270c1ca0e54fe5b717c10d2ac724a8023d Mon Sep 17 00:00:00 2001 From: glaullon Date: Thu, 24 Jun 2010 15:54:49 -0700 Subject: [PATCH] Only Commit / All Files --- PBGitHistoryController.h | 4 +- PBGitHistoryController.m | 41 ++++- PBGitHistoryView.xib | 360 ++++++++++++++++++++++++--------------- PBGitTree.h | 2 + PBGitTree.m | 16 +- 5 files changed, 276 insertions(+), 147 deletions(-) diff --git a/PBGitHistoryController.h b/PBGitHistoryController.h index a7d7fac..c59aabd 100644 --- a/PBGitHistoryController.h +++ b/PBGitHistoryController.h @@ -22,7 +22,7 @@ @class PBCommitList; @class PBSourceViewItem; -@interface PBGitHistoryController : PBViewController { +@interface PBGitHistoryController : PBViewController { IBOutlet PBRefController *refController; IBOutlet PBCommitList* commitList; IBOutlet PBCollapsibleSplitView *historySplitView; @@ -54,6 +54,8 @@ BOOL forceSelectionUpdate; NSArray *currentFileBrowserSelectionPath; + IBOutlet MGScopeBar *treeStyle; + NSArray *treeOpts; PBGitTree *gitTree; PBGitCommit *webCommit; PBGitCommit *selectedCommit; diff --git a/PBGitHistoryController.m b/PBGitHistoryController.m index 4e7d76c..9652d50 100644 --- a/PBGitHistoryController.m +++ b/PBGitHistoryController.m @@ -142,7 +142,13 @@ } if (self.selectedCommitDetailsIndex == kHistoryTreeViewIndex) { - self.gitTree = selectedCommit.tree; + PBGitTree *pt = selectedCommit.tree; + + NSString *show=[[[treeStyle selectedItems] objectAtIndex:0] objectAtIndex:0]; + pt.onlyCommit=[show isEqualToString:@"Only Commit"]; + + self.gitTree=pt; + [self restoreFileBrowserSelection]; } else // kHistoryDetailViewIndex @@ -854,5 +860,38 @@ enum { return YES; } +#pragma mark + +- (int)numberOfGroupsInScopeBar:(MGScopeBar *)theScopeBar +{ + return 1; +} + +- (NSArray *)scopeBar:(MGScopeBar *)theScopeBar itemIdentifiersForGroup:(int)groupNumber +{ + return [NSArray arrayWithObjects:@"Only Commit",@"All Files",nil]; +} + +- (NSString *)scopeBar:(MGScopeBar *)theScopeBar labelForGroup:(int)groupNumber +{ + return nil; +} + +- (MGScopeBarGroupSelectionMode)scopeBar:(MGScopeBar *)theScopeBar selectionModeForGroup:(int)groupNumber +{ + return MGRadioSelectionMode; +} + +- (NSString *)scopeBar:(MGScopeBar *)theScopeBar titleOfItem:(NSString *)identifier inGroup:(int)groupNumber +{ + return identifier; +} + +- (void)scopeBar:(MGScopeBar *)theScopeBar selectedStateChanged:(BOOL)selected forItem:(NSString *)identifier inGroup:(int)groupNumber +{ + [self updateKeys]; +} + + @end diff --git a/PBGitHistoryView.xib b/PBGitHistoryView.xib index 3c946f3..f57d693 100644 --- a/PBGitHistoryView.xib +++ b/PBGitHistoryView.xib @@ -2,10 +2,10 @@ 1050 - 10D573 + 10F569 762 1038.29 - 460.00 + 461.00 YES @@ -21,7 +21,7 @@ YES - + YES @@ -913,114 +913,131 @@ 4370 YES - + - 4372 + 274 YES - - - 2304 + + + 266 + {{0, 204}, {172, 30}} + + MGScopeBar + + + + 4370 YES - - - 4368 - {187, 232} - - YES - - - 256 - {{223, 0}, {16, 17}} - - + + + 2304 + YES - - 184 - 16 - 1000 - - 75628096 - 2048 - - - - 3 - MC4zMzMzMzI5ODU2AA + + + 4368 + {154, 202} + + YES + + + 256 + {{223, 0}, {16, 17}} + + + YES + + 151 + 16 + 1000 + + 75628096 + 2048 + + + + 3 + MC4zMzMzMzI5ODU2AA + + + + + 337772096 + 2048 + Text Cell + + + + + + 3 + YES + - - - 337772096 - 2048 - Text Cell - - - - - - 3 - YES - + 3 + 2 + + + 17 + -624951296 + + + 4 + 15 + 0 + YES + 0 - 3 - 2 - - - 17 - -624951296 - - - 4 - 15 - 0 - YES - 0 + {{1, 1}, {154, 202}} + + + + + 4 + + + + 256 + {{155, 1}, {15, 202}} + + + _doScroller: + 0.99481862783432007 + + + + -2147483392 + {{-100, -100}, {502, 15}} + + 1 + + _doScroller: + 0.0045045050792396069 + 0.99801188707351685 - {{1, 1}, {187, 232}} - - - - - 4 - - - - 256 - {{188, 1}, {15, 232}} - - - _doScroller: - 0.99481862783432007 - - - - -2147483392 - {{-100, -100}, {502, 15}} - - 1 - - _doScroller: - 0.0045045050792396069 - 0.99801188707351685 + {171, 204} + + + 18 + + + + QSAAAEEgAABBmAAAQZgAAA - {204, 234} + {172, 234} - - 18 - - - - QSAAAEEgAABBmAAAQZgAAA + NSView 268 - {{205, 0}, {649, 234}} + {{173, 0}, {681, 234}} NSView @@ -1721,6 +1738,22 @@ 411 + + + treeStyle + + + + 414 + + + + delegate + + + + 416 + @@ -1970,56 +2003,11 @@ YES - + - - 10 - - - YES - - - - - - File List Scroll View - - - 17 - - - - - 16 - - - - - 15 - - - YES - - - - - - 18 - - - YES - - - - - - 19 - - - 311 @@ -2234,6 +2222,66 @@ + + 412 + + + YES + + + + + + + 10 + + + YES + + + + + + File List Scroll View + + + 15 + + + YES + + + + + + 16 + + + + + 17 + + + + + 18 + + + YES + + + + + + 19 + + + + + 413 + + + @@ -2325,6 +2373,8 @@ 400.IBPluginDependency 400.IBSegmentedControlInspectorSelectedSegmentMetadataKey 410.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency 46.IBEditorWindowLastContentRect 46.IBPluginDependency 48.IBPluginDependency @@ -2492,7 +2542,9 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{221, 356}, {852, 432}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{68, 19}, {852, 432}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2528,11 +2580,23 @@ - 411 + 416 YES + + MGScopeBar + NSView + + delegate + id + + + IBProjectSource + MGScopeBar/MGScopeBar.h + + NSObject @@ -2660,6 +2724,7 @@ searchField selectedBranchFilterItem treeController + treeStyle upperToolbarView webView @@ -2681,6 +2746,7 @@ NSSearchField NSButton NSTreeController + MGScopeBar PBGitGradientBarView id @@ -3286,6 +3352,13 @@ ImageKit.framework/Headers/IKImageBrowserView.h + + NSObject + + IBFrameworkSource + ImageKit.framework/Headers/IKSaveOptions.h + + NSObject @@ -3328,6 +3401,13 @@ QuartzFilters.framework/Headers/QuartzFilterManager.h + + NSObject + + IBFrameworkSource + QuickLookUI.framework/Headers/QLPreviewPanel.h + + NSObject diff --git a/PBGitTree.h b/PBGitTree.h index 1fcb969..2a552f4 100644 --- a/PBGitTree.h +++ b/PBGitTree.h @@ -26,6 +26,7 @@ NSString * absolutePath; NSImage * iconImage; + } + (PBGitTree*) rootForCommit: (id) commit; + (PBGitTree*) treeForTree: (PBGitTree*) tree andPath: (NSString*) path; @@ -37,6 +38,7 @@ @property(copy) NSString* sha; @property(copy) NSString* path; @property(assign) BOOL leaf; +@property(assign) BOOL onlyCommit; @property(retain) PBGitRepository* repository; @property(assign) __weak PBGitTree* parent; diff --git a/PBGitTree.m b/PBGitTree.m index 3bad70d..be7aebc 100644 --- a/PBGitTree.m +++ b/PBGitTree.m @@ -14,7 +14,7 @@ @implementation PBGitTree -@synthesize sha, path, repository, leaf, parent, iconImage, absolutePath; +@synthesize sha, path, repository, leaf, parent, iconImage, absolutePath, onlyCommit; + (PBGitTree*) rootForCommit:(id) commit { @@ -46,6 +46,7 @@ leaf = YES; absolutePath = [PBGitRepository basePath]; } + onlyCommit=true; return self; } @@ -230,17 +231,22 @@ if (children != nil) return children; - NSString* ref = [self refSpec]; - NSFileHandle* handle = [repository handleForArguments:[NSArray arrayWithObjects:@"show",@"--pretty=format:",@"--name-only", self.sha, nil]]; - //[handle readLine]; + NSFileHandle* handle; + + if(onlyCommit){ + handle = [repository handleForArguments:[NSArray arrayWithObjects:@"show",@"--pretty=format:",@"--name-only", self.sha,nil]]; + }else{ + NSString* ref = [self refSpec]; + handle = [repository handleForArguments:[NSArray arrayWithObjects:@"show", ref, nil]]; + [handle readLine]; + } [handle readLine]; NSMutableArray* c = [NSMutableArray array]; NSString* p = [handle readLine]; while ([p length] > 0) { - NSLog(@"-->%@",p); if ([p isEqualToString:@"\r"]) break;