Skip to content

Commit

Permalink
Merge pull request #192 from jphalip/master
Browse files Browse the repository at this point in the history
More UI improvements
  • Loading branch information
laullon committed Jun 4, 2012
2 parents f38201d + cd2e8de commit aae5e7c
Show file tree
Hide file tree
Showing 12 changed files with 358 additions and 197 deletions.
151 changes: 117 additions & 34 deletions English.lproj/Preferences.xib

Large diffs are not rendered by default.

98 changes: 85 additions & 13 deletions English.lproj/RepositoryWindow.xib
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<data>
<int key="IBDocument.SystemTarget">1070</int>
<string key="IBDocument.SystemVersion">11D50</string>
<string key="IBDocument.InterfaceBuilderVersion">2177</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.32</string>
<string key="IBDocument.HIToolboxVersion">568.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2177</string>
<string key="NS.object.0">2182</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down Expand Up @@ -109,10 +109,9 @@
<string key="NSToolbarItemPaletteLabel">Clone Repository To</string>
<nil key="NSToolbarItemToolTip"/>
<object class="NSButton" key="NSToolbarItemView" id="703553818">
<reference key="NSNextResponder"/>
<nil key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{38, 14}, {40, 25}}</string>
<reference key="NSSuperview"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="64590231">
<int key="NSCellFlags">-2080244224</int>
Expand Down Expand Up @@ -155,10 +154,9 @@
<string key="NSToolbarItemPaletteLabel">Refresh</string>
<nil key="NSToolbarItemToolTip"/>
<object class="NSButton" key="NSToolbarItemView" id="438380428">
<reference key="NSNextResponder"/>
<nil key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{8, 14}, {32, 25}}</string>
<reference key="NSSuperview"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="604536609">
<int key="NSCellFlags">-2080244224</int>
Expand Down Expand Up @@ -197,10 +195,9 @@
<string key="NSToolbarItemPaletteLabel">View</string>
<nil key="NSToolbarItemToolTip"/>
<object class="NSSegmentedControl" key="NSToolbarItemView" id="371591001">
<reference key="NSNextResponder"/>
<nil key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{0, 14}, {90, 25}}</string>
<reference key="NSSuperview"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSegmentedCell" key="NSCell" id="399933706">
<int key="NSCellFlags">67239424</int>
Expand Down Expand Up @@ -438,7 +435,7 @@
<reference key="NSNextResponder" ref="44848571"/>
<int key="NSvFlags">1292</int>
<object class="NSPSMatrix" key="NSDrawMatrix"/>
<string key="NSFrame">{{20, 7}, {16, 16}}</string>
<string key="NSFrame">{{225, 8}, {16, 16}}</string>
<reference key="NSSuperview" ref="44848571"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="508249619"/>
Expand All @@ -448,13 +445,14 @@
<object class="NSTextField" id="508249619">
<reference key="NSNextResponder" ref="44848571"/>
<int key="NSvFlags">266</int>
<string key="NSFrame">{{41, 8}, {188, 14}}</string>
<string key="NSFrame">{{32, 8}, {188, 14}}</string>
<reference key="NSSuperview" ref="44848571"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="708164574">
<int key="NSCellFlags">67239488</int>
<int key="NSCellFlags2">4327424</int>
<int key="NSCellFlags2">71436288</int>
<string key="NSContents">Label</string>
<object class="NSFont" key="NSSupport">
<string key="NSName">LucidaGrande</string>
Expand Down Expand Up @@ -483,7 +481,7 @@
</object>
</object>
</object>
<string key="NSFrame">{{552, 0}, {246, 31}}</string>
<string key="NSFrame">{{644, 0}, {246, 31}}</string>
<reference key="NSSuperview" ref="751230759"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="490597384"/>
Expand All @@ -495,7 +493,7 @@
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="120427370"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMinSize">{600, 528}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<string key="NSFrameAutosaveName">GitX</string>
Expand Down Expand Up @@ -1010,6 +1008,80 @@
</object>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>contentSplitView</string>
<string>finderItem</string>
<string>mainSplitView</string>
<string>progressIndicator</string>
<string>sourceListControlsView</string>
<string>sourceSplitView</string>
<string>statusField</string>
<string>terminalItem</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSView</string>
<string>NSToolbarItem</string>
<string>NSSplitView</string>
<string>NSProgressIndicator</string>
<string>NSView</string>
<string>NSView</string>
<string>NSTextField</string>
<string>NSToolbarItem</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>contentSplitView</string>
<string>finderItem</string>
<string>mainSplitView</string>
<string>progressIndicator</string>
<string>sourceListControlsView</string>
<string>sourceSplitView</string>
<string>statusField</string>
<string>terminalItem</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">contentSplitView</string>
<string key="candidateClassName">NSView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">finderItem</string>
<string key="candidateClassName">NSToolbarItem</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">mainSplitView</string>
<string key="candidateClassName">NSSplitView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">progressIndicator</string>
<string key="candidateClassName">NSProgressIndicator</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">sourceListControlsView</string>
<string key="candidateClassName">NSView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">sourceSplitView</string>
<string key="candidateClassName">NSView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">statusField</string>
<string key="candidateClassName">NSTextField</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">terminalItem</string>
<string key="candidateClassName">NSToolbarItem</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/PBGitWindowController.h</string>
Expand Down
2 changes: 1 addition & 1 deletion GLFileView.m
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ + (NSString *)parseDiff:(NSString *)txt
[res appendString:[GLFileView parseDiffBlock:[NSString stringWithFormat:@"diff --%@",block]]];
}

return res;
return [NSString stringWithFormat:@"<div id='diffs'>%@</div>",res];
}

+ (NSString *)parseDiffBlock:(NSString *)txt
Expand Down
38 changes: 28 additions & 10 deletions PBDiffWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#import "PBGitCommit.h"
#import "PBGitDefaults.h"
#import "GLFileView.h"
#import "PBWebCommitController.h"


@implementation PBDiffWindowController
Expand All @@ -36,28 +37,45 @@ + (void) showDiffWindowWithFiles:(NSArray *)filePaths fromCommit:(PBGitCommit *)
diffCommit = [startCommit.repository headCommit];

NSString *commitSelector = [NSString stringWithFormat:@"%@..%@", [startCommit realSha], [diffCommit realSha]];
NSMutableArray *arguments = [NSMutableArray arrayWithObjects:@"diff", @"--no-ext-diff", commitSelector, nil];
NSMutableArray *args = [NSMutableArray arrayWithObjects:@"diff", @"--no-ext-diff", commitSelector, nil];

if (![PBGitDefaults showWhitespaceDifferences])
[arguments insertObject:@"-w" atIndex:1];
[args insertObject:@"-w" atIndex:1];

if (filePaths) {
[arguments addObject:@"--"];
[arguments addObjectsFromArray:filePaths];
[args addObject:@"--"];
[args addObjectsFromArray:filePaths];
}

int retValue;
NSString *diff = [startCommit.repository outputInWorkdirForArguments:arguments retValue:&retValue];
NSString *diff = [startCommit.repository outputInWorkdirForArguments:args retValue:&retValue];
if (retValue) {
DLog(@"diff failed with retValue: %d for command: '%@' output: '%@'", retValue, [arguments componentsJoinedByString:@" "], diff);
DLog(@"diff failed with retValue: %d for command: '%@' output: '%@'", retValue, [args componentsJoinedByString:@" "], diff);
return;
}

diff=[GLFileView parseDiff:diff];
diff=[diff stringByReplacingOccurrencesOfString:@"{SHA_PREV}" withString:[startCommit realSha]];
diff=[diff stringByReplacingOccurrencesOfString:@"{SHA}" withString:[diffCommit realSha]];
// File Stats
args = [NSMutableArray arrayWithObjects:@"show", @"--numstat", @"--summary", @"--pretty=raw", [startCommit realSha], [diffCommit realSha], nil];
if (![PBGitDefaults showWhitespaceDifferences])
[args insertObject:@"-w" atIndex:1];
NSString *details = [startCommit.repository outputInWorkdirForArguments:args];
NSMutableDictionary *stats = [PBWebCommitController parseStats:details];

// File list
args = [NSMutableArray arrayWithObjects:@"diff-tree", @"--root", @"-r", @"-C90%", @"-M90%", nil];
[args addObject:[startCommit realSha]];
[args addObject:[diffCommit realSha]];
NSString *dt = [startCommit.repository outputInWorkdirForArguments:args];
NSString *fileList = [GLFileView parseDiffTree:dt withStats:stats];

// Hunk list
NSString *hunks = [GLFileView parseDiff:diff];
hunks=[hunks stringByReplacingOccurrencesOfString:@"{SHA_PREV}" withString:[startCommit realSha]];
hunks=[hunks stringByReplacingOccurrencesOfString:@"{SHA}" withString:[diffCommit realSha]];

PBDiffWindowController *diffController = [[PBDiffWindowController alloc] initWithDiff:diff];
NSString *html = [NSString stringWithFormat:@"%@%@",fileList,hunks];

PBDiffWindowController *diffController = [[PBDiffWindowController alloc] initWithDiff:html];
[diffController showWindow:nil];
}

Expand Down
Loading

0 comments on commit aae5e7c

Please sign in to comment.