Merge branch 'master' into gui-refresh

This commit is contained in:
Alex Brand
2011-03-09 12:15:57 +01:00
22 changed files with 717 additions and 896 deletions
+162 -10
View File
@@ -2,17 +2,17 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">804</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<string key="IBDocument.SystemVersion">10J567</string>
<string key="IBDocument.InterfaceBuilderVersion">788</string>
<string key="IBDocument.AppKitVersion">1038.35</string>
<string key="IBDocument.HIToolboxVersion">462.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">804</string>
<string key="NS.object.0">788</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="5"/>
<integer value="367"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -58,6 +58,7 @@
<string>41FA1145-D953-446F-B6DF-0230885AB433</string>
<string>7A8FEE7B-B273-4AF3-8A22-53A9DAF786FA</string>
<string>B15C57F2-985F-4446-9A29-34C76DBA9042</string>
<string>D43D38AE-6110-463C-8514-FC8ACC0F327C</string>
<string>FF15EAEC-D5AB-4C6F-9E13-4B62C6692BFC</string>
<string>NSToolbarFlexibleSpaceItem</string>
<string>NSToolbarSeparatorItem</string>
@@ -92,9 +93,10 @@
<string key="NSToolbarItemPaletteLabel">Clone Repository To</string>
<nil key="NSToolbarItemToolTip"/>
<object class="NSButton" key="NSToolbarItemView" id="703553818">
<nil key="NSNextResponder"/>
<reference 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>
@@ -137,9 +139,10 @@
<string key="NSToolbarItemPaletteLabel">Refresh</string>
<nil key="NSToolbarItemToolTip"/>
<object class="NSButton" key="NSToolbarItemView" id="438380428">
<nil key="NSNextResponder"/>
<reference 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>
@@ -170,6 +173,67 @@
<bool key="NSToolbarIsUserRemovable">YES</bool>
<int key="NSToolbarItemVisibilityPriority">0</int>
</object>
<object class="NSToolbarItem" id="121507526">
<object class="NSMutableString" key="NSToolbarItemIdentifier">
<characters key="NS.bytes">D43D38AE-6110-463C-8514-FC8ACC0F327C</characters>
</object>
<string key="NSToolbarItemLabel">View</string>
<string key="NSToolbarItemPaletteLabel">View</string>
<nil key="NSToolbarItemToolTip"/>
<object class="NSSegmentedControl" key="NSToolbarItemView" id="371591001">
<reference key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{0, 14}, {94, 25}}</string>
<reference key="NSSuperview"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSegmentedCell" key="NSCell" id="399933706">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">0</int>
<object class="NSFont" key="NSSupport">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">13</double>
<int key="NSfFlags">16</int>
</object>
<reference key="NSControlView" ref="371591001"/>
<object class="NSMutableArray" key="NSSegmentImages">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSSegmentItem">
<double key="NSSegmentItemWidth">44</double>
<object class="NSCustomResource" key="NSSegmentItemImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">sidebar_Template</string>
</object>
<string key="NSSegmentItemLabel"/>
<bool key="NSSegmentItemSelected">YES</bool>
<int key="NSSegmentItemImageScaling">2</int>
</object>
<object class="NSSegmentItem">
<double key="NSSegmentItemWidth">43</double>
<object class="NSCustomResource" key="NSSegmentItemImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">list_Template</string>
</object>
<string key="NSSegmentItemLabel"/>
<int key="NSSegmentItemTag">1</int>
<bool key="NSSegmentItemSelected">YES</bool>
<int key="NSSegmentItemImageScaling">0</int>
</object>
</object>
<int key="NSTrackingMode">1</int>
<int key="NSSegmentStyle">2</int>
</object>
</object>
<nil key="NSToolbarItemImage"/>
<nil key="NSToolbarItemTarget"/>
<nil key="NSToolbarItemAction"/>
<string key="NSToolbarItemMinSize">{94, 25}</string>
<string key="NSToolbarItemMaxSize">{94, 25}</string>
<bool key="NSToolbarItemEnabled">YES</bool>
<bool key="NSToolbarItemAutovalidates">YES</bool>
<int key="NSToolbarItemTag">0</int>
<bool key="NSToolbarIsUserRemovable">YES</bool>
<int key="NSToolbarItemVisibilityPriority">0</int>
</object>
<object class="NSToolbarItem" id="684497462">
<object class="NSMutableString" key="NSToolbarItemIdentifier">
<characters key="NS.bytes">FF15EAEC-D5AB-4C6F-9E13-4B62C6692BFC</characters>
@@ -287,11 +351,14 @@
<reference ref="430741773"/>
<reference ref="136647420"/>
<reference ref="442829492"/>
<reference ref="121507526"/>
</object>
<object class="NSMutableArray" key="NSToolbarIBDefaultItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="79199737"/>
<reference ref="442829492"/>
<reference ref="121507526"/>
<reference ref="430741773"/>
<reference ref="286515344"/>
<reference ref="684497462"/>
</object>
@@ -520,6 +587,14 @@
</object>
<int key="connectionID">419</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">changeLayout:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="121507526"/>
</object>
<int key="connectionID">423</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -603,6 +678,7 @@
<reference ref="684497462"/>
<reference ref="894083033"/>
<reference ref="79199737"/>
<reference ref="121507526"/>
</object>
<reference key="parent" ref="491121796"/>
</object>
@@ -719,6 +795,29 @@
<reference key="parent" ref="120427370"/>
<string key="objectName">Content SplitView</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">422</int>
<reference key="object" ref="121507526"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="371591001"/>
</object>
<reference key="parent" ref="1033396020"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">420</int>
<reference key="object" ref="371591001"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="399933706"/>
</object>
<reference key="parent" ref="121507526"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">421</int>
<reference key="object" ref="399933706"/>
<reference key="parent" ref="371591001"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -757,6 +856,12 @@
<string>415.IBPluginDependency</string>
<string>416.IBPluginDependency</string>
<string>417.IBPluginDependency</string>
<string>420.IBPluginDependency</string>
<string>420.IBSegmentedControlTracker.RoundRobinState</string>
<string>420.IBSegmentedControlTracker.WasGrowing</string>
<string>421.IBPluginDependency</string>
<string>421.IBSegmentedControlInspectorSelectedSegmentMetadataKey</string>
<string>422.toolbarItem.selectable</string>
<string>5.IBPluginDependency</string>
<string>5.ImportedFromIB2</string>
</object>
@@ -779,7 +884,7 @@
<bytes key="NSTransformStruct">AUM5AAAAAAAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{347, 1169}, {616, 0}}</string>
<string>{{207, 573}, {616, 227}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -801,6 +906,12 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="0"/>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="0"/>
<boolean value="NO"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
</object>
</object>
@@ -820,7 +931,7 @@
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">419</int>
<int key="maxID">423</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -832,6 +943,13 @@
<string key="minorKey">NSApplication+GitXScripting.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSCell</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">View/CellTrackingRect.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">PBGitWindowController</string>
<string key="superclassName">NSWindowController</string>
@@ -839,6 +957,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>changeLayout:</string>
<string>cloneTo:</string>
<string>openInTerminal:</string>
<string>refresh:</string>
@@ -854,12 +973,14 @@
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>changeLayout:</string>
<string>cloneTo:</string>
<string>openInTerminal:</string>
<string>refresh:</string>
@@ -869,6 +990,10 @@
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">changeLayout:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">cloneTo:</string>
<string key="candidateClassName">id</string>
@@ -1349,6 +1474,13 @@
<string key="minorKey">QuartzCore.framework/Headers/CIImageProvider.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">ScriptingBridge.framework/Headers/SBApplication.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -1456,6 +1588,22 @@
<string key="minorKey">AppKit.framework/Headers/NSResponder.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSSegmentedCell</string>
<string key="superclassName">NSActionCell</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSSegmentedCell.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSSegmentedControl</string>
<string key="superclassName">NSControl</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSSegmentedControl.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSSplitView</string>
<string key="superclassName">NSView</string>
@@ -1587,6 +1735,8 @@
<string>NSMenuCheckmark</string>
<string>NSMenuMixedState</string>
<string>NSRefreshTemplate</string>
<string>list_Template</string>
<string>sidebar_Template</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1594,6 +1744,8 @@
<string>{9, 8}</string>
<string>{7, 2}</string>
<string>{10, 12}</string>
<string>{16, 16}</string>
<string>{16, 16}</string>
</object>
</object>
</data>
+1
View File
@@ -40,6 +40,7 @@
+(BOOL)isBinaryFile:(NSString *)line;
+(NSString*)mimeTypeForFileName:(NSString*)file;
+(BOOL)isImage:(NSString*)file;
+(BOOL)isDiffHeader:(NSString*)line;
@property(retain) NSMutableArray *groups;
@property(retain) NSString *logFormat;
+65 -54
View File
@@ -125,7 +125,7 @@
}
}
#if 1
#ifdef DEBUG_BUILD
NSString *dom=[[[[view mainFrame] DOMDocument] documentElement] outerHTML];
NSString *tmpFile=@"~/tmp/test.html";
[dom writeToFile:[tmpFile stringByExpandingTildeInPath] atomically:true encoding:NSUTF8StringEncoding error:nil];
@@ -274,61 +274,27 @@
NSArray *lines = [txt componentsSeparatedByString:@"\n"];
NSString *line;
NSMutableString *res=[NSMutableString string];
BOOL inDiff=FALSE;
BOOL inBlock=FALSE;
int l_line,l_end;
int r_line,r_end;
int i;
for (i=0; i<[lines count]; i++) {
int i=0;
do {
line=[lines objectAtIndex:i];
if([GLFileView isStartBlock:line]){
[res appendString:@"</td></tr></thead><tbody>"];
inDiff=FALSE;
NSString *header=[line substringFromIndex:3];
NSRange hr = NSMakeRange(0, [header rangeOfString:@" @@"].location);
header=[header substringWithRange:hr];
NSArray *pos=[header componentsSeparatedByString:@" "];
NSArray *pos_l=[[pos objectAtIndex:0] componentsSeparatedByString:@","];
NSArray *pos_r=[[pos objectAtIndex:1] componentsSeparatedByString:@","];
l_end=l_line=abs([[pos_l objectAtIndex:0]integerValue]);
if ([pos_l count]>1) {
l_end=l_line+[[pos_l objectAtIndex:1]integerValue];
}
r_end=r_line=[[pos_r objectAtIndex:0]integerValue];
if ([pos_r count]>1) {
r_end=r_line+[[pos_r objectAtIndex:1]integerValue];
}
[res appendString:[NSString stringWithFormat:@"<tr class='header'><td colspan='3'>%@</td></tr>",line]];
inBlock=TRUE;
}else if(inBlock){
NSString *s=[line substringToIndex:1];
if([s isEqualToString:@" "]){
[res appendString:[NSString stringWithFormat:@"<tr><td class='l'>%d</td><td class='r'>%d</td>",l_line++,r_line++]];
}else if([s isEqualToString:@"-"]){
[res appendString:[NSString stringWithFormat:@"<tr class='l'><td class='l'>%d</td><td class='r'></td>",l_line++]];
}else if([s isEqualToString:@"+"]){
[res appendString:[NSString stringWithFormat:@"<tr class='r'><td class='l'></td><td class='r'>%d</td>",r_line++]];
}
[res appendString:[NSString stringWithFormat:@"<td class='code'>%@</td></tr>",[line substringFromIndex:1]]];
if(!(l_line<l_end) && !(r_line<r_end))
inBlock=FALSE;
}else if([GLFileView isStartDiff:line]){
if(inDiff)
[res appendString:@"</tbody></table>"];
inDiff=TRUE;
if([GLFileView isStartDiff:line]){
NSString *fileName=[self getFileName:line];
[res appendString:[NSString stringWithFormat:@"<table id='%@' class='diff'><thead><tr><td colspan='3'>",fileName]];
[res appendString:[NSString stringWithFormat:@"<p>%@</p>",line]];
}else if(inDiff){
[res appendString:[NSString stringWithFormat:@"<p>%@</p>",line]];
[res appendString:[NSString stringWithFormat:@"<table id='%@' class='diff'><thead><tr><td colspan='3'><div style='float:left;'>",fileName]];
do{
[res appendString:[NSString stringWithFormat:@"<p>%@</p>",line]];
line=[lines objectAtIndex:++i];
}while([GLFileView isDiffHeader:line]);
[res appendString:@"</div>"];
if(![self isBinaryFile:line]){
[res appendString:[NSString stringWithFormat:@"<div class='filemerge'><a href='' onclick='openFileMerge(\"%@\",\"{SHA}\"); return false;'><img src='GitX://app:/filemerge' width='32' height='32'/><br/>open in<br/>FileMerge</a></div>",fileName]];
}
[res appendString:@"</td></tr></thead><tbody>"];
if([self isBinaryFile:line]){
[res appendString:@"</td></tr></thead><tbody>"];
NSArray *files=[self getFilesNames:line];
if(![[files objectAtIndex:0] isAbsolutePath]){
[res appendString:[NSString stringWithFormat:@"<tr><td colspan='3'>%@</td></tr>",[files objectAtIndex:0]]];
@@ -342,11 +308,50 @@
[res appendString:[NSString stringWithFormat:@"<tr><td colspan='3'><img src='GitX://{SHA}/%@'/></td></tr>",[files objectAtIndex:1]]];
}
}
}else{
do{
NSString *header=[line substringFromIndex:3];
NSRange hr = NSMakeRange(0, [header rangeOfString:@" @@"].location);
header=[header substringWithRange:hr];
NSArray *pos=[header componentsSeparatedByString:@" "];
NSArray *pos_l=[[pos objectAtIndex:0] componentsSeparatedByString:@","];
NSArray *pos_r=[[pos objectAtIndex:1] componentsSeparatedByString:@","];
l_end=l_line=abs([[pos_l objectAtIndex:0]integerValue]);
if ([pos_l count]>1) {
l_end=l_line+[[pos_l objectAtIndex:1]integerValue];
}
r_end=r_line=[[pos_r objectAtIndex:0]integerValue];
if ([pos_r count]>1) {
r_end=r_line+[[pos_r objectAtIndex:1]integerValue];
}
[res appendString:[NSString stringWithFormat:@"<tr class='header'><td colspan='3'>%@</td></tr>",line]];
do{
line=[lines objectAtIndex:++i];
NSString *s=[line substringToIndex:1];
if([s isEqualToString:@" "]){
[res appendString:[NSString stringWithFormat:@"<tr><td class='l'>%d</td><td class='r'>%d</td>",l_line++,r_line++]];
}else if([s isEqualToString:@"-"]){
[res appendString:[NSString stringWithFormat:@"<tr class='l'><td class='l'>%d</td><td class='r'></td>",l_line++]];
}else if([s isEqualToString:@"+"]){
[res appendString:[NSString stringWithFormat:@"<tr class='r'><td class='l'></td><td class='r'>%d</td>",r_line++]];
}
[res appendString:[NSString stringWithFormat:@"<td class='code'>%@</td></tr>",[line substringFromIndex:1]]];
}while((l_line<l_end) || (r_line<r_end));
if(i<([lines count]-1)){
line=[lines objectAtIndex:++i];
}
}while([GLFileView isStartBlock:line]);
}
[res appendString:@"</tbody></table>"];
}else {
i++;
}
}
if(inDiff)
[res appendString:@"</tbody></table>"];
}while(i<[lines count]);
return res;
}
@@ -395,6 +400,12 @@
return mimeType;
}
+(BOOL)isDiffHeader:(NSString*)line
{
unichar c=[line characterAtIndex:0];
return (c=='i') || (c=='m') || (c=='n') || (c=='d') || (c=='-') || (c=='+');
}
+(BOOL)isImage:(NSString*)file
{
NSString *mimeType=[GLFileView mimeTypeForFileName:file];
+8
View File
@@ -60,6 +60,8 @@
31460CD4124185BA00B90AED /* ReadMe.txt in Resources */ = {isa = PBXBuildFile; fileRef = 31460CAF124185BA00B90AED /* ReadMe.txt */; };
31460CD5124185BA00B90AED /* Source Code License.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 31460CB0124185BA00B90AED /* Source Code License.rtf */; };
31460CD6124185BA00B90AED /* TODO in Resources */ = {isa = PBXBuildFile; fileRef = 31460CB1124185BA00B90AED /* TODO */; };
316E7202131EE9C600AFBB36 /* list_Template.png in Resources */ = {isa = PBXBuildFile; fileRef = 316E7200131EE9C600AFBB36 /* list_Template.png */; };
316E7203131EE9C600AFBB36 /* sidebar_Template.png in Resources */ = {isa = PBXBuildFile; fileRef = 316E7201131EE9C600AFBB36 /* sidebar_Template.png */; };
31DAA7ED1317737100463846 /* gitx_l_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 31DAA7EC1317737100463846 /* gitx_l_pub.pem */; };
3BC07F4C0ED5A5C5009A7768 /* HistoryViewTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = 3BC07F4A0ED5A5C5009A7768 /* HistoryViewTemplate.png */; };
3BC07F4D0ED5A5C5009A7768 /* CommitViewTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = 3BC07F4B0ED5A5C5009A7768 /* CommitViewTemplate.png */; };
@@ -348,6 +350,8 @@
31460CAF124185BA00B90AED /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadMe.txt; sourceTree = "<group>"; };
31460CB0124185BA00B90AED /* Source Code License.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = "Source Code License.rtf"; sourceTree = "<group>"; };
31460CB1124185BA00B90AED /* TODO */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TODO; sourceTree = "<group>"; };
316E7200131EE9C600AFBB36 /* list_Template.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = list_Template.png; sourceTree = "<group>"; };
316E7201131EE9C600AFBB36 /* sidebar_Template.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = sidebar_Template.png; sourceTree = "<group>"; };
31DAA7EC1317737100463846 /* gitx_l_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = gitx_l_pub.pem; sourceTree = "<group>"; };
32CA4F630368D1EE00C91783 /* GitX_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GitX_Prefix.pch; sourceTree = "<group>"; };
3BC07F4A0ED5A5C5009A7768 /* HistoryViewTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = HistoryViewTemplate.png; path = Images/HistoryViewTemplate.png; sourceTree = "<group>"; };
@@ -816,6 +820,8 @@
isa = PBXGroup;
children = (
FA8DFF37131AEDD400C0F289 /* Start_iTerm2.applescript */,
316E7200131EE9C600AFBB36 /* list_Template.png */,
316E7201131EE9C600AFBB36 /* sidebar_Template.png */,
21025C1012947AB200D87200 /* sourceListAction.png */,
21025C1112947AB200D87200 /* sourceListActionOver.png */,
02B41A5F123E307F00DFC531 /* PBCommitHookFailedSheet.xib */,
@@ -1433,6 +1439,8 @@
212A49AD12A31350009DAFAD /* ignored_file.png in Resources */,
212A49AF12A3135C009DAFAD /* modified_file.png in Resources */,
31DAA7ED1317737100463846 /* gitx_l_pub.pem in Resources */,
316E7202131EE9C600AFBB36 /* list_Template.png in Resources */,
316E7203131EE9C600AFBB36 /* sidebar_Template.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
+3
View File
@@ -27,6 +27,7 @@
IBOutlet PBRefController *refController;
IBOutlet NSSearchField *searchField;
IBOutlet NSArrayController* commitController;
IBOutlet NSSearchField *filesSearchField;
IBOutlet NSTreeController* treeController;
IBOutlet NSOutlineView* fileBrowser;
NSArray *currentFileBrowserSelectionPath;
@@ -57,6 +58,7 @@
}
@property (readonly) NSTreeController* treeController;
@property (readonly) PBCollapsibleSplitView *historySplitView;
@property (assign) int selectedCommitDetailsIndex;
@property (retain) PBGitCommit *webCommit;
@property (retain) PBGitTree* gitTree;
@@ -93,6 +95,7 @@
// Find/Search methods
- (IBAction)selectNext:(id)sender;
- (IBAction)selectPrevious:(id)sender;
- (IBAction) updateSearch:(id) sender;
- (void) copyCommitInfo;
- (void) copyCommitSHA;
+29 -1
View File
@@ -48,6 +48,7 @@
@synthesize searchController;
@synthesize commitList;
@synthesize treeController;
@synthesize historySplitView;
- (void)awakeFromNib
{
@@ -231,7 +232,8 @@
{
if ([(NSString *)context isEqualToString: @"commitChange"]) {
[self updateKeys];
//[self restoreFileBrowserSelection];
[self restoreFileBrowserSelection];
[self updateSearch:filesSearchField];
}else if ([(NSString *)context isEqualToString: @"treeChange"]) {
[self updateQuicklookForce: NO];
[self saveFileBrowserSelection];
@@ -810,6 +812,32 @@
NSImage *image = [workspace iconForFile:path];
[image setSize:NSMakeSize(15, 15)];
[cell setImage:image];
NSColor *textColor = [NSColor blackColor];
if ([object filterPredicate] && !([[filesSearchField stringValue] length] > 0 && [[object filterPredicate] evaluateWithObject:object])) {
textColor = [NSColor lightGrayColor];
}
[cell setTextColor:textColor];
}
#pragma mark -
- (IBAction) updateSearch:(NSSearchField *) sender {
static NSPredicate *predicateTemplate = nil;
if (!predicateTemplate) {
predicateTemplate = [NSPredicate predicateWithFormat:@"path CONTAINS[c] $SEARCH_STRING"];
}
NSString *searchString = [sender stringValue];
NSPredicate *predicate = nil;
if ([searchString length] > 0) {
predicate = [predicateTemplate predicateWithSubstitutionVariables:
[NSDictionary dictionaryWithObject:searchString forKey:@"SEARCH_STRING"]];
}
[gitTree setFilterPredicate:predicate];
[treeController setContent:gitTree.filteredChildren];
}
@end
+274 -800
View File
File diff suppressed because it is too large Load Diff
-1
View File
@@ -145,7 +145,6 @@ static NSString * PBStringFromBranchFilterType(PBGitXBranchFilterType type) {
// for the scripting bridge
- (void)findInModeScriptCommand:(NSScriptCommand *)command;
-(NSNumber *)countCommintsOf:(NSString *)branchs;
- (NSMenu *) menu;
+(bool)isLocalBranch:(NSString *)branch branchNameInto:(NSString **)name;
+13 -7
View File
@@ -150,17 +150,17 @@ static NSString * const kObservingContextSubmodules = @"submodulesChanged";
[sourceView reloadData];
}else if ([@"updateRefs" isEqualToString:context]) {
for(PBGitSVRemoteItem* remote in [remotes children]){
NSLog(@"remote.title=%@",[remote title]);
[remote setAlert:[self remoteNeedFetch:[remote title]]];
[self performSelectorInBackground:@selector(evaluateRemoteBadge:) withObject:remote];
}
for(PBGitSVBranchItem* branch in [branches children]){
NSString *bName=[branch title];
[branch setAhead:[self countCommintsOf:[NSString stringWithFormat:@"origin/%@..%@",bName,bName]]];
[branch setBehind:[self countCommintsOf:[NSString stringWithFormat:@"%@..origin/%@",bName,bName]]];
[branch setIsCheckedOut:[branch.revSpecifier isEqual:[repository headRef]]];
if([branch isKindOfClass:[PBGitSVBranchItem class]]){
NSString *bName=[branch title];
[branch setAhead:[self countCommintsOf:[NSString stringWithFormat:@"origin/%@..%@",bName,bName]]];
[branch setBehind:[self countCommintsOf:[NSString stringWithFormat:@"%@..origin/%@",bName,bName]]];
[branch setIsCheckedOut:[branch.revSpecifier isEqual:[repository headRef]]];
}
}
}else{
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
@@ -168,6 +168,12 @@ static NSString * const kObservingContextSubmodules = @"submodulesChanged";
#pragma mark Badges Methods
-(void)evaluateRemoteBadge:(PBGitSVRemoteItem *)remote
{
NSLog(@"remote.title=%@",[remote title]);
[remote setAlert:[self remoteNeedFetch:[remote title]]];
}
-(NSNumber *)countCommintsOf:(NSString *)range
{
NSArray *args = [NSArray arrayWithObjects:@"rev-list", range, nil];
+6
View File
@@ -21,6 +21,9 @@
NSString* localFileName;
NSDate* localMtime;
NSPredicate *filterPredicate;
NSMutableArray *filteredChildren;
}
+ (PBGitTree*) rootForCommit: (id) commit;
@@ -41,6 +44,9 @@
@property(retain) PBGitRepository* repository;
@property(assign) __weak PBGitTree* parent;
@property (nonatomic, copy) NSPredicate *filterPredicate;
@property(readonly) NSArray *filteredChildren;
@property(readonly) NSArray* children;
@property(readonly) NSString* fullPath;
@property(readonly) NSString* contents;
+50
View File
@@ -15,6 +15,55 @@
@implementation PBGitTree
@synthesize sha, path, repository, leaf, parent;
@synthesize filterPredicate;
@synthesize filteredChildren;
#pragma mark -
#pragma mark get/set
- (NSArray *) filteredChildren {
if (!filteredChildren) {
filteredChildren = [[NSMutableArray alloc] init];
[filteredChildren addObjectsFromArray:self.children];
}
return filteredChildren;
}
- (void) setFilterPredicate:(NSPredicate *) newPredicate {
if (newPredicate != filterPredicate) {
[filterPredicate release];
filterPredicate = [newPredicate retain];
if (leaf) {
return;
}
// initiate filtering
[filteredChildren removeAllObjects];
filteredChildren = [[NSMutableArray alloc] init];
if (filterPredicate == nil) {
[filteredChildren addObjectsFromArray:self.children];
}
for (id item in self.children) {
[item setFilterPredicate:filterPredicate];
if (filterPredicate) {
if ([item leaf]) {
if ([filterPredicate evaluateWithObject:item]) {
[filteredChildren addObject:item];
}
} else {
if ([[item filteredChildren] count] > 0) {
[filteredChildren addObject:item];
}
}
}
}
}
}
#pragma mark -
+ (PBGitTree*) rootForCommit:(id) commit
{
@@ -40,6 +89,7 @@
- init
{
filteredChildren = nil;
children = nil;
localFileName = nil;
leaf = YES;
+5
View File
@@ -9,6 +9,9 @@
#import <Cocoa/Cocoa.h>
#import "PBGitRepository.h"
#define kGitSplitViewMinWidth 150.0f
#define kGitSplitViewMaxWidth 300.0f
@class PBViewController, PBGitSidebarController, PBGitCommitController;
@interface PBGitWindowController : NSWindowController {
@@ -39,6 +42,7 @@
- (void)showMessageSheet:(NSString *)messageText infoText:(NSString *)infoText;
- (void)showErrorSheet:(NSError *)error;
- (void)showErrorSheetTitle:(NSString *)title message:(NSString *)message arguments:(NSArray *)arguments output:(NSString *)output;
- (void)collapseSplitView:(NSSplitView *)sp show:(BOOL)show;
- (IBAction) showCommitView:(id)sender;
- (IBAction) showHistoryView:(id)sender;
@@ -46,6 +50,7 @@
- (IBAction) openInTerminal:(id)sender;
- (IBAction) cloneTo:(id)sender;
- (IBAction) refresh:(id)sender;
- (IBAction) changeLayout:(id)sender;
- (void)setHistorySearch:(NSString *)searchString mode:(NSInteger)mode;
+29 -3
View File
@@ -237,14 +237,40 @@
[sidebarController setHistorySearch:searchString mode:mode];
}
- (IBAction) changeLayout:(id)sender{
NSLog(@"selectedSegment=%ld (%d)",[sender selectedSegment],[sender isSelectedForSegment:[sender selectedSegment]]);
NSSplitView *sp=nil;
switch ([sender selectedSegment]) {
case 0:
sp=splitView;
break;
case 1:
sp=[[sidebarController historyViewController] historySplitView];
break;
}
NSLog(@"sp=%@",sp);
if(sp!=nil) {
[self collapseSplitView:sp show:[sender isSelectedForSegment:[sender selectedSegment]]];
}
}
- (void)collapseSplitView:(NSSplitView *)sp show:(BOOL)show{
NSView *clipview = [[sp subviews] objectAtIndex:0];
NSRect clipFrame = [clipview frame];
if ([sp isVertical]) {
clipFrame.size.width = kGitSplitViewMinWidth * show;
}else{
clipFrame.size.height = kGitSplitViewMinWidth * show;
}
[[clipview animator] setFrame:clipFrame];
[sp adjustSubviews];
}
#pragma mark -
#pragma mark SplitView Delegates
#define kGitSplitViewMinWidth 150.0f
#define kGitSplitViewMaxWidth 300.0f
#pragma mark min/max widths while moving the divider
- (CGFloat)splitView:(NSSplitView *)view constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex
+46 -18
View File
@@ -11,6 +11,19 @@
@implementation PBGitXProtocol
- (id)initWithRequest:(NSURLRequest *)request cachedResponse:(NSCachedURLResponse *)cachedResponse client:(id <NSURLProtocolClient>)client
{
// work around for NSURLProtocol bug
// note that this leaks!
CFRetain(client);
if (self = [super initWithRequest:request cachedResponse:cachedResponse client:client])
{
}
return self;
}
+ (BOOL) canInitWithRequest:(NSURLRequest *)request
{
return [[[request URL] scheme] isEqualToString:@"GitX"];
@@ -31,25 +44,40 @@
return;
}
NSString *path=[[url path] substringFromIndex:1];
NSString *v=@"";
if ([[path substringToIndex:5] isEqualToString:@"prev/"]) {
path=[path substringFromIndex:5];
v=@"^";
if ([[url host] isEqualToString:@"app"]) {
NSString *app=[[url path] substringFromIndex:1];
NSString *appPath=[[NSWorkspace sharedWorkspace] fullPathForApplication:app];
NSLog(@"app=%@ appPath=%@",app,appPath);
if(appPath){
NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:appPath];
NSLog(@"icon=%@",icon);
[[self client] URLProtocol:self didLoadData:[icon TIFFRepresentation]];
[[self client] URLProtocolDidFinishLoading:self];
}else{
[[self client] URLProtocol:self didFailWithError:[NSError errorWithDomain:@"gitx" code:404 userInfo:nil]];
}
}else {
NSString *path=[[url path] substringFromIndex:1];
NSString *v=@"";
if ([[path substringToIndex:5] isEqualToString:@"prev/"]) {
path=[path substringFromIndex:5];
v=@"^";
}
NSString *specifier = [NSString stringWithFormat:@"%@%@:%@", [url host], v,path];
handle = [repo handleInWorkDirForArguments:[NSArray arrayWithObjects:@"cat-file", @"blob", specifier, nil]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didFinishFileLoad:) name:NSFileHandleReadToEndOfFileCompletionNotification object:handle];
[handle readToEndOfFileInBackgroundAndNotify];
NSURLResponse *response = [[NSURLResponse alloc] initWithURL:[[self request] URL]
MIMEType:nil
expectedContentLength:-1
textEncodingName:nil];
[[self client] URLProtocol:self
didReceiveResponse:response
cacheStoragePolicy:NSURLCacheStorageNotAllowed];
}
NSString *specifier = [NSString stringWithFormat:@"%@%@:%@", [url host], v,path];
handle = [repo handleInWorkDirForArguments:[NSArray arrayWithObjects:@"cat-file", @"blob", specifier, nil]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didFinishFileLoad:) name:NSFileHandleReadToEndOfFileCompletionNotification object:handle];
[handle readToEndOfFileInBackgroundAndNotify];
NSURLResponse *response = [[NSURLResponse alloc] initWithURL:[[self request] URL]
MIMEType:nil
expectedContentLength:-1
textEncodingName:nil];
[[self client] URLProtocol:self
didReceiveResponse:response
cacheStoragePolicy:NSURLCacheStorageNotAllowed];
}
- (void) didFinishFileLoad:(NSNotification *)notification
+5
View File
@@ -76,6 +76,11 @@
NSLog(@"Error from webkit: %@", dictionary);
}
- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame
{
NSLog(@"Message from webkit: %@", message);
}
- (NSURLRequest *)webView:(WebView *)sender
resource:(id)identifier
willSendRequest:(NSURLRequest *)request
+1
View File
@@ -29,6 +29,7 @@
- (NSString *)parseHeader:(NSString *)txt withRefs:(NSString *)badges;
- (NSMutableDictionary *)parseStats:(NSString *)txt;
- (NSString *) someMethodThatReturnsSomeHashForSomeString:(NSString*)concat;
- (void) openFileMerge:(NSString*)file sha:(NSString *)sha;
@property (readonly) NSString* diff;
@end
+8 -1
View File
@@ -120,7 +120,7 @@
[[view windowScriptObject] callWebScriptMethod:@"showCommit" withArguments:[NSArray arrayWithObject:html]];
#if 1
#ifdef DEBUG_BUILD
NSString *dom=[[[[view mainFrame] DOMDocument] documentElement] outerHTML];
NSString *tmpFile=@"~/tmp/test2.html";
[dom writeToFile:[tmpFile stringByExpandingTildeInPath] atomically:true encoding:NSUTF8StringEncoding error:nil];
@@ -224,6 +224,13 @@
[historyController selectCommit:[PBGitSHA shaWithString:sha]];
}
- (void) openFileMerge:(NSString*)file sha:(NSString *)sha
{
NSArray *args=[NSArray arrayWithObjects:@"difftool",@"--no-prompt",@"--tool=opendiff",[NSString stringWithFormat:@"%@^",sha],sha,@"--",file,nil];
[historyController.repository handleForArguments:args];
}
- (void) sendKey: (NSString*) key
{
id script = [view windowScriptObject];
+1 -1
View File
@@ -37,7 +37,7 @@
NSButton* rememberCheck;
}
-(NSPanel*) passwordPanel;
-(NSPanel*)passwordPanel:(NSString *)prompt remember:(BOOL)remember;
-(IBAction) doOKButton: (id)sender;
-(IBAction) doCancelButton: (id)sender;
+5
View File
@@ -317,4 +317,9 @@ a.showdiff {
-webkit-box-shadow: 5px 5px 5px #ccc;
width: 98%;
margin: auto auto 20px 1%;
}
.filemerge {
float: right;
text-align: center;
}
+6
View File
@@ -2,6 +2,12 @@ var selectCommit = function(a) {
Controller.selectCommit_(a);
}
var openFileMerge = function(file,sha) {
alert(file);
alert(sha);
Controller.openFileMerge_sha_(file,sha);
}
var showImage = function(element, filename)
{
element.outerHTML = '<img src="GitX://' + commit.sha + '/' + filename + '">';
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B