Browse files

Merge branch 'stable'

* stable:
  HistoryView: Don't show the 'loading commit' thing until after 500 ms.
  HistoryView: Remove raw view
  HistoryView: don't load in commit information in a separate thread anymore
  Fix UTF-8 bug in NSString_RegEx
  CommitView: Don't keep rearranging when iterating over files
  IndexController: de-privatize the index-stopping stuff
  • Loading branch information...
2 parents 4476892 + 5972bd4 commit 1a5a211ddfdfa08622d1413cb5aa5634dcedaee2 @pieter committed Sep 17, 2009
View
4 NSString_RegEx.m
@@ -57,7 +57,9 @@ - (NSArray *) substringsMatchingRegularExpression:(NSString *)pattern count:(int
break;
NSRange range = NSMakeRange(pmatch[i].rm_so, pmatch[i].rm_eo - pmatch[i].rm_so);
- NSString * substring = [self substringWithRange:range];
+ NSString * substring = [[[NSString alloc] initWithBytes:[self UTF8String] + range.location
+ length:range.length
+ encoding:NSUTF8StringEncoding] autorelease];
[outMatches addObject:substring];
if (ranges)
View
14 PBGitCommit.m
@@ -66,20 +66,10 @@ - (NSString *)realSha
return str;
}
-// NOTE: This method should remain threadsafe, as we load it in async
-// from the web view.
+// FIXME: Remove this method once it's unused.
- (NSString*) details
{
- if (details != nil)
- return details;
-
- NSMutableArray *arguments = [NSMutableArray arrayWithObjects:@"show", @"--pretty=raw", @"-M", @"--no-color", [self realSha], nil];
- if (![PBGitDefaults showWhitespaceDifferences])
- [arguments insertObject:@"-w" atIndex:1];
-
- details = [self.repository outputForArguments:arguments];
-
- return details;
+ return @"";
}
- (NSString *) patch
View
4 PBGitCommitController.m
@@ -11,7 +11,7 @@
#import "PBChangedFile.h"
#import "PBWebChangesController.h"
#import "NSString_RegEx.h"
-
+#import "PBGitIndexController.h"
@interface PBGitCommitController (PrivateMethods)
- (NSArray *) linesFromNotification:(NSNotification *)notification;
@@ -240,6 +240,7 @@ - (NSMutableDictionary *)dictionaryForLines:(NSArray *)lines
- (void) addFilesFromDictionary:(NSMutableDictionary *)dictionary staged:(BOOL)staged tracked:(BOOL)tracked
{
// Iterate over all existing files
+ [indexController stopTrackingIndex];
for (PBChangedFile *file in files) {
NSArray *fileStatus = [dictionary objectForKey:file.path];
// Object found, this is still a cached / uncached thing
@@ -270,6 +271,7 @@ - (void) addFilesFromDictionary:(NSMutableDictionary *)dictionary staged:(BOOL)s
file.hasUnstagedChanges = NO;
}
}
+ [indexController resumeTrackingIndex];
// Do new files
if (![[dictionary allKeys] count])
View
3 PBGitHistoryController.m
@@ -66,8 +66,7 @@ - (void) updateKeys
switch (self.selectedTab) {
case 0: self.webCommit = realCommit; break;
- case 1: self.rawCommit = realCommit; break;
- case 2: self.gitTree = realCommit.tree; break;
+ case 1: self.gitTree = realCommit.tree; break;
}
}
View
506 PBGitHistoryView.xib
@@ -2,14 +2,14 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">9L30</string>
+ <string key="IBDocument.SystemVersion">9L31a</string>
<string key="IBDocument.InterfaceBuilderVersion">677</string>
<string key="IBDocument.AppKitVersion">949.54</string>
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="46"/>
<integer value="237"/>
+ <integer value="46"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -98,7 +98,7 @@
<object class="NSSegmentedControl" id="802449565">
<reference key="NSNextResponder" ref="319362431"/>
<int key="NSvFlags">293</int>
- <string key="NSFrame">{{376, 6}, {99, 25}}</string>
+ <string key="NSFrame">{{376, 6}, {71, 25}}</string>
<reference key="NSSuperview" ref="319362431"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSegmentedCell" key="NSCell" id="534046869">
@@ -126,21 +126,12 @@
<object class="NSSegmentItem">
<object class="NSCustomResource" key="NSSegmentItemImage">
<string key="NSClassName">NSImage</string>
- <string key="NSResourceName">NSListViewTemplate</string>
- </object>
- <string key="NSSegmentItemLabel"/>
- <string key="NSSegmentItemTooltip">Raw View</string>
- <int key="NSSegmentItemTag">1</int>
- <int key="NSSegmentItemImageScaling">2</int>
- </object>
- <object class="NSSegmentItem">
- <double key="NSSegmentItemWidth">3.200000e+01</double>
- <object class="NSCustomResource" key="NSSegmentItemImage">
- <string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSPathTemplate</string>
</object>
+ <string key="NSSegmentItemLabel"/>
<string key="NSSegmentItemTooltip">Tree View</string>
- <int key="NSSegmentItemImageScaling">0</int>
+ <int key="NSSegmentItemTag">9</int>
+ <int key="NSSegmentItemImageScaling">2</int>
</object>
</object>
<int key="NSSegmentStyle">2</int>
@@ -320,7 +311,6 @@
</object>
<int key="NSResizingMask">3</int>
<bool key="NSIsResizeable">YES</bool>
- <bool key="NSIsEditable">NO</bool>
<reference key="NSTableView" ref="254268962"/>
<bool key="NSHidden">YES</bool>
</object>
@@ -410,7 +400,7 @@
<object class="NSTabViewItem" id="375889551">
<string key="NSIdentifier">1</string>
<object class="NSView" key="NSView" id="859052736">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder" ref="135073984"/>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -477,268 +467,10 @@
</object>
<reference key="NSTabView" ref="135073984"/>
</object>
- <object class="NSTabViewItem" id="465071889">
- <string key="NSIdentifier">2</string>
- <object class="NSView" key="NSView" id="624894365">
- <nil key="NSNextResponder"/>
- <int key="NSvFlags">256</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSScrollView" id="670264682">
- <reference key="NSNextResponder" ref="624894365"/>
- <int key="NSvFlags">274</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSClipView" id="948090592">
- <reference key="NSNextResponder" ref="670264682"/>
- <int key="NSvFlags">2304</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSTextView" id="239018083">
- <reference key="NSNextResponder" ref="948090592"/>
- <int key="NSvFlags">2322</int>
- <string key="NSFrameSize">{835, 70}</string>
- <reference key="NSSuperview" ref="948090592"/>
- <object class="NSTextContainer" key="NSTextContainer" id="53511606">
- <object class="NSLayoutManager" key="NSLayoutManager">
- <object class="NSTextStorage" key="NSTextStorage">
- <object class="NSMutableString" key="NSString">
- <characters key="NS.bytes">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Et harumd und lookum like Greek to me, dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque civiuda</characters>
- </object>
- <object class="NSDictionary" key="NSAttributes" id="631771906">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSFont</string>
- <string>NSParagraphStyle</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSFont">
- <string key="NSName">Monaco</string>
- <double key="NSSize">1.000000e+01</double>
- <int key="NSfFlags">16</int>
- </object>
- <object class="NSParagraphStyle">
- <int key="NSAlignment">3</int>
- <object class="NSArray" key="NSTabStops">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSTextTab">
- <double key="NSLocation">0.000000e+00</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">5.600000e+01</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">1.120000e+02</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">1.680000e+02</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">2.240000e+02</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">2.800000e+02</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">3.360000e+02</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">3.920000e+02</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">4.480000e+02</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">5.040000e+02</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">5.600000e+02</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">6.160000e+02</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">6.720000e+02</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">7.280000e+02</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">7.840000e+02</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">8.400000e+02</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">8.960000e+02</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">9.520000e+02</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">1.008000e+03</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">1.064000e+03</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">1.120000e+03</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">1.176000e+03</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">1.232000e+03</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">1.288000e+03</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">1.344000e+03</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">1.400000e+03</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">1.456000e+03</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">1.512000e+03</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">1.568000e+03</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">1.624000e+03</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">1.680000e+03</double>
- </object>
- <object class="NSTextTab">
- <double key="NSLocation">1.736000e+03</double>
- </object>
- </object>
- </object>
- </object>
- </object>
- <nil key="NSDelegate"/>
- </object>
- <object class="NSMutableArray" key="NSTextContainers">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="53511606"/>
- </object>
- <int key="NSLMFlags">6</int>
- <nil key="NSDelegate"/>
- </object>
- <reference key="NSTextView" ref="239018083"/>
- <double key="NSWidth">8.350000e+02</double>
- <int key="NSTCFlags">1</int>
- </object>
- <object class="NSTextViewSharedData" key="NSSharedData">
- <int key="NSFlags">2369</int>
- <reference key="NSBackgroundColor" ref="965176493"/>
- <reference key="NSInsertionColor" ref="381686569"/>
- <object class="NSDictionary" key="NSSelectedAttributes">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSBackgroundColor</string>
- <string>NSColor</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSColor" id="688833546">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">selectedTextBackgroundColor</string>
- <reference key="NSColor" ref="827382333"/>
- </object>
- <object class="NSColor" id="349701971">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">selectedTextColor</string>
- <reference key="NSColor" ref="381686569"/>
- </object>
- </object>
- </object>
- <nil key="NSMarkedAttributes"/>
- <object class="NSDictionary" key="NSLinkAttributes">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSColor</string>
- <string>NSUnderline</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSColor" id="882067667">
- <int key="NSColorSpace">1</int>
- <bytes key="NSRGB">MCAwIDEAA</bytes>
- </object>
- <reference ref="9"/>
- </object>
- </object>
- <nil key="NSDefaultParagraphStyle"/>
- </object>
- <int key="NSTVFlags">6</int>
- <string key="NSMaxSize">{1687, 1e+07}</string>
- <string key="NSMinize">{83, 0}</string>
- <nil key="NSDelegate"/>
- </object>
- </object>
- <string key="NSFrame">{{1, 1}, {835, 185}}</string>
- <reference key="NSSuperview" ref="670264682"/>
- <reference key="NSNextKeyView" ref="239018083"/>
- <reference key="NSDocView" ref="239018083"/>
- <reference key="NSBGColor" ref="965176493"/>
- <object class="NSCursor" key="NSCursor" id="841457992">
- <string key="NSHotSpot">{4, -5}</string>
- <int key="NSCursorType">1</int>
- </object>
- <int key="NScvFlags">4</int>
- </object>
- <object class="NSScroller" id="722857290">
- <reference key="NSNextResponder" ref="670264682"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{836, 1}, {15, 185}}</string>
- <reference key="NSSuperview" ref="670264682"/>
- <reference key="NSTarget" ref="670264682"/>
- <string key="NSAction">_doScroller:</string>
- <double key="NSPercent">2.240493e-01</double>
- </object>
- <object class="NSScroller" id="585622122">
- <reference key="NSNextResponder" ref="670264682"/>
- <int key="NSvFlags">256</int>
- <string key="NSFrame">{{-100, -100}, {87, 18}}</string>
- <reference key="NSSuperview" ref="670264682"/>
- <int key="NSsFlags">1</int>
- <reference key="NSTarget" ref="670264682"/>
- <string key="NSAction">_doScroller:</string>
- <double key="NSCurValue">1.000000e+00</double>
- <double key="NSPercent">9.456522e-01</double>
- </object>
- </object>
- <string key="NSFrameSize">{852, 187}</string>
- <reference key="NSSuperview" ref="624894365"/>
- <reference key="NSNextKeyView" ref="948090592"/>
- <int key="NSsFlags">18</int>
- <reference key="NSVScroller" ref="722857290"/>
- <reference key="NSHScroller" ref="585622122"/>
- <reference key="NSContentView" ref="948090592"/>
- </object>
- </object>
- <string key="NSFrameSize">{852, 186}</string>
- </object>
- <string key="NSLabel">Raw</string>
- <reference key="NSColor" ref="457244339"/>
- <reference key="NSTabView" ref="135073984"/>
- </object>
<object class="NSTabViewItem" id="529992882">
<string key="NSIdentifier">Item 2</string>
<object class="NSView" key="NSView" id="657042048">
- <reference key="NSNextResponder" ref="135073984"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -869,7 +601,124 @@
<object class="NSMutableString" key="NSString">
<characters key="NS.bytes">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Et harumd und lookum like Greek to me, dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque civiuda</characters>
</object>
- <reference key="NSAttributes" ref="631771906"/>
+ <object class="NSDictionary" key="NSAttributes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSFont</string>
+ <string>NSParagraphStyle</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSFont">
+ <string key="NSName">Monaco</string>
+ <double key="NSSize">1.000000e+01</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <object class="NSParagraphStyle">
+ <int key="NSAlignment">3</int>
+ <object class="NSArray" key="NSTabStops">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTextTab">
+ <double key="NSLocation">0.000000e+00</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">5.600000e+01</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">1.120000e+02</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">1.680000e+02</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">2.240000e+02</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">2.800000e+02</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">3.360000e+02</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">3.920000e+02</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">4.480000e+02</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">5.040000e+02</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">5.600000e+02</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">6.160000e+02</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">6.720000e+02</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">7.280000e+02</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">7.840000e+02</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">8.400000e+02</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">8.960000e+02</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">9.520000e+02</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">1.008000e+03</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">1.064000e+03</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">1.120000e+03</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">1.176000e+03</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">1.232000e+03</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">1.288000e+03</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">1.344000e+03</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">1.400000e+03</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">1.456000e+03</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">1.512000e+03</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">1.568000e+03</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">1.624000e+03</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">1.680000e+03</double>
+ </object>
+ <object class="NSTextTab">
+ <double key="NSLocation">1.736000e+03</double>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
<nil key="NSDelegate"/>
</object>
<object class="NSMutableArray" key="NSTextContainers">
@@ -896,8 +745,18 @@
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="688833546"/>
- <reference ref="349701971"/>
+ <object class="NSColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">selectedTextBackgroundColor</string>
+ <reference key="NSColor" ref="827382333"/>
+ </object>
+ <object class="NSColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">selectedTextColor</string>
+ <reference key="NSColor" ref="381686569"/>
+ </object>
</object>
</object>
<nil key="NSMarkedAttributes"/>
@@ -910,7 +769,10 @@
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="882067667"/>
+ <object class="NSColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MCAwIDEAA</bytes>
+ </object>
<reference ref="9"/>
</object>
</object>
@@ -927,7 +789,10 @@
<reference key="NSNextKeyView" ref="75600241"/>
<reference key="NSDocView" ref="75600241"/>
<reference key="NSBGColor" ref="965176493"/>
- <reference key="NSCursor" ref="841457992"/>
+ <object class="NSCursor" key="NSCursor">
+ <string key="NSHotSpot">{4, -5}</string>
+ <int key="NSCursorType">1</int>
+ </object>
<int key="NScvFlags">4</int>
</object>
<object class="NSScroller" id="802032705">
@@ -967,21 +832,20 @@
</object>
</object>
<string key="NSFrameSize">{852, 186}</string>
- <reference key="NSSuperview" ref="135073984"/>
</object>
<string key="NSLabel">Tree</string>
<reference key="NSColor" ref="457244339"/>
<reference key="NSTabView" ref="135073984"/>
</object>
</object>
- <reference key="NSSelectedTabViewItem" ref="529992882"/>
+ <reference key="NSSelectedTabViewItem" ref="375889551"/>
<reference key="NSFont" ref="924107556"/>
<int key="NSTvFlags">6</int>
<bool key="NSAllowTruncatedLabels">YES</bool>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="657042048"/>
+ <reference ref="859052736"/>
</object>
</object>
</object>
@@ -1937,22 +1801,6 @@
<int key="connectionID">217</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: rawCommit.details</string>
- <reference key="source" ref="239018083"/>
- <reference key="destination" ref="1001"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="239018083"/>
- <reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">value: rawCommit.details</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">rawCommit.details</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">230</int>
- </object>
- <object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">commitController</string>
<reference key="source" ref="892732705"/>
@@ -2221,24 +2069,13 @@
<reference key="object" ref="135073984"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="465071889"/>
<reference ref="375889551"/>
<reference ref="529992882"/>
</object>
<reference key="parent" ref="202620420"/>
<string key="objectName">Bottom View</string>
</object>
<object class="IBObjectRecord">
- <int key="objectID">5</int>
- <reference key="object" ref="465071889"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="624894365"/>
- </object>
- <reference key="parent" ref="135073984"/>
- <string key="objectName">Raw View</string>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="375889551"/>
<object class="NSMutableArray" key="children">
@@ -2361,41 +2198,6 @@
<reference key="parent" ref="859052736"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">22</int>
- <reference key="object" ref="624894365"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="670264682"/>
- </object>
- <reference key="parent" ref="465071889"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">23</int>
- <reference key="object" ref="670264682"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="722857290"/>
- <reference ref="585622122"/>
- <reference ref="239018083"/>
- </object>
- <reference key="parent" ref="624894365"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">24</int>
- <reference key="object" ref="722857290"/>
- <reference key="parent" ref="670264682"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">25</int>
- <reference key="object" ref="585622122"/>
- <reference key="parent" ref="670264682"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">26</int>
- <reference key="object" ref="239018083"/>
- <reference key="parent" ref="670264682"/>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">47</int>
<reference key="object" ref="555671215"/>
<object class="NSMutableArray" key="children">
@@ -2819,11 +2621,9 @@
<string>20.IBPluginDependency</string>
<string>21.IBAttributePlaceholdersKey</string>
<string>21.IBPluginDependency</string>
- <string>22.IBPluginDependency</string>
<string>223.IBPluginDependency</string>
<string>224.IBPluginDependency</string>
<string>225.IBPluginDependency</string>
- <string>23.IBPluginDependency</string>
<string>231.IBPluginDependency</string>
<string>236.IBEditorWindowLastContentRect</string>
<string>236.IBWindowTemplateEditedContentRect</string>
@@ -2835,15 +2635,12 @@
<string>237.IBPluginDependency</string>
<string>238.IBPluginDependency</string>
<string>239.IBPluginDependency</string>
- <string>24.IBPluginDependency</string>
<string>240.IBPluginDependency</string>
<string>242.IBPluginDependency</string>
<string>243.IBPluginDependency</string>
<string>245.IBPluginDependency</string>
<string>246.IBPluginDependency</string>
<string>247.IBPluginDependency</string>
- <string>25.IBPluginDependency</string>
- <string>26.IBPluginDependency</string>
<string>261.IBAttributePlaceholdersKey</string>
<string>261.IBPluginDependency</string>
<string>262.IBPluginDependency</string>
@@ -2890,7 +2687,6 @@
<string>47.IBPluginDependency</string>
<string>48.IBPluginDependency</string>
<string>49.IBPluginDependency</string>
- <string>5.IBPluginDependency</string>
<string>50.IBPluginDependency</string>
<string>51.IBPluginDependency</string>
<string>52.IBPluginDependency</string>
@@ -2949,8 +2745,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>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{504, 612}, {346, 102}}</string>
<string>{{504, 612}, {346, 102}}</string>
<integer value="0" id="8"/>
@@ -2967,9 +2761,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>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
<string key="NS.key.0">ToolTip</string>
<object class="IBToolTipAttribute" key="NS.object.0">
@@ -3038,7 +2829,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>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
View
3 PBGitIndexController.h
@@ -36,5 +36,8 @@
- (NSString *) stagedChangesForFile:(PBChangedFile *)file;
- (NSString *) unstagedChangesForFile:(PBChangedFile *)file;
+- (void)stopTrackingIndex;
+- (void)resumeTrackingIndex;
+
- (NSMenu *) menuForTable:(NSTableView *)table;
@end
View
5 PBGitIndexController.m
@@ -12,11 +12,6 @@
#define FileChangesTableViewType @"GitFileChangedType"
-@interface PBGitIndexController (PrivateMethods)
-- (void)stopTrackingIndex;
-- (void)resumeTrackingIndex;
-@end
-
@implementation PBGitIndexController
@synthesize contextSize;
View
32 PBWebHistoryController.m
@@ -7,6 +7,7 @@
//
#import "PBWebHistoryController.h"
+#import "PBGitDefaults.h"
@implementation PBWebHistoryController
@@ -49,6 +50,37 @@ - (void) changeContentTo: (PBGitCommit *) content
NSArray *arguments = [NSArray arrayWithObjects:content, [[[historyController repository] headRef] simpleRef], nil];
[[self script] callWebScriptMethod:@"loadCommit" withArguments: arguments];
+
+ // Now we load the extended details. We used to do this in a separate thread,
+ // but this caused some funny behaviour because NSTask's and NSThread's don't really
+ // like each other. Instead, just do it async.
+
+ NSMutableArray *taskArguments = [NSMutableArray arrayWithObjects:@"show", @"--pretty=raw", @"-M", @"--no-color", currentSha, nil];
+ if (![PBGitDefaults showWhitespaceDifferences])
+ [taskArguments insertObject:@"-w" atIndex:1];
+
+ NSFileHandle *handle = [repository handleForArguments:taskArguments];
+ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
+ // Remove notification, in case we have another one running
+ [nc removeObserver:self];
+ [nc addObserver:self selector:@selector(commitDetailsLoaded:) name:NSFileHandleReadToEndOfFileCompletionNotification object:handle];
+ [handle readToEndOfFileInBackgroundAndNotify];
+}
+
+- (void)commitDetailsLoaded:(NSNotification *)notification
+{
+ NSData *data = [[notification userInfo] valueForKey:NSFileHandleNotificationDataItem];
+ if (!data)
+ return;
+
+ NSString *details = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
+ if (!details)
+ details = [[NSString alloc] initWithData:data encoding:NSISOLatin1StringEncoding];
+
+ if (!details)
+ return;
+
+ [[view windowScriptObject] callWebScriptMethod:@"loadCommitDetails" withArguments:[NSArray arrayWithObject:details]];
}
- (void) selectCommit: (NSString*) sha
View
40 html/views/history/history.js
@@ -1,4 +1,7 @@
var commit;
+
+// Create a new Commit object
+// obj: PBGitCommit object
var Commit = function(obj) {
this.object = obj;
@@ -7,12 +10,14 @@ var Commit = function(obj) {
this.sha = obj.realSha();
this.parents = obj.parents;
this.subject = obj.subject;
+ this.notificationID = null;
// TODO:
// this.author_date instant
- // This all needs to be async
- this.loadedRaw = function(details) {
+ // This can be called later with the output of
+ // 'git show' to fill in missing commit details (such as a diff)
+ this.parseDetails = function(details) {
this.raw = details;
var diffStart = this.raw.indexOf("\ndiff ");
@@ -138,6 +143,7 @@ var selectCommit = function(a) {
Controller.selectCommit_(a);
}
+// Relead only refs
var reload = function() {
$("notification").style.display = "none";
commit.reloadRefs();
@@ -159,14 +165,16 @@ var showRefs = function() {
var loadCommit = function(commitObject, currentRef) {
// These are only the things we can do instantly.
- // Other information will be loaded later by loadExtendedCommit
+ // Other information will be loaded later by loadCommitDetails,
+ // Which will be called from the controller once
+ // the commit details are in.
+
+ if (commit && commit.notificationID)
+ clearTimeout(commit.notificationID);
+
commit = new Commit(commitObject);
- Controller.callSelector_onObject_callBack_("details", commitObject,
- function(data) { commit.loadedRaw(data); loadExtendedCommit(commit); });
commit.currentRef = currentRef;
- notify("Loading commit…", 0);
-
$("commitID").innerHTML = commit.sha;
$("authorID").innerHTML = commit.author_name;
$("subjectID").innerHTML = commit.subject.escapeHTML();
@@ -196,9 +204,18 @@ var loadCommit = function(commitObject, currentRef) {
"<a href='' onclick='selectCommit(this.innerHTML); return false;'>" +
commit.parents[i] + "</a></td>";
}
+
+ commit.notificationID = setTimeout(function() {
+ if (!commit.fullyLoaded)
+ notify("Loading commit…", 0);
+ commit.notificationID = null;
+ }, 500);
+
}
var showDiff = function() {
+
+ // Callback for the diff highlighter. Used to generate a filelist
var newfile = function(name1, name2, id, mode_change, old_mode, new_mode) {
var button = document.createElement("div");
var p = document.createElement("p");
@@ -270,8 +287,15 @@ var enableFeatures = function()
enableFeature("gravatar", $("gravatar"))
}
-var loadExtendedCommit = function(commit)
+var loadCommitDetails = function(data)
{
+ commit.parseDetails(data);
+
+ if (commit.notificationID)
+ clearTimeout(commit.notificationID)
+ else
+ $("notification").style.display = "none";
+
var formatEmail = function(name, email) {
return email ? name + " &lt;<a href='mailto:" + email + "'>" + email + "</a>&gt;" : name;
}

0 comments on commit 1a5a211

Please sign in to comment.