From c8a7e5bfe907a30b9c71717d8188e6675d96e6f0 Mon Sep 17 00:00:00 2001 From: Aron Cedercrantz Date: Fri, 17 Jul 2009 22:10:35 +0200 Subject: [PATCH 01/20] Add automatic refresh preferences. --- English.lproj/Preferences.xib | 875 ++++++++++++++++++++++++++++++---- PBGitDefaults.h | 3 +- PBGitDefaults.m | 22 +- 3 files changed, 804 insertions(+), 96 deletions(-) diff --git a/English.lproj/Preferences.xib b/English.lproj/Preferences.xib index 5058653..e91e538 100644 --- a/English.lproj/Preferences.xib +++ b/English.lproj/Preferences.xib @@ -1,26 +1,26 @@ - + 1050 - 9J61 - 677 - 949.46 - 353.00 + 10A411 + 731 + 1033 + 435.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 731 + YES - - - YES - com.apple.InterfaceBuilderKit com.apple.InterfaceBuilder.CocoaPlugin YES - + YES @@ -43,29 +43,29 @@ 268 YES - + 268 - {{17, 74}, {99, 17}} + {{118, 99}, {192, 28}} YES - - 68288064 - 272630784 - Git Executable: - + + 67239424 + 272760832 + Will refresh the repository window when it is selected. + LucidaGrande - 1.300000e+01 - 1044 + 11 + 3100 - + 6 System controlColor 3 - MC42NjY2NjY2OQA + MC42NjY2NjY2NjY3AA @@ -79,12 +79,59 @@ + + + 268 + {{18, 129}, {158, 18}} + + YES + + -2080244224 + 0 + Refresh automatically + + LucidaGrande + 13 + 1044 + + + 1211912703 + 2 + + NSImage + NSSwitch + + + NSSwitch + + + + 200 + 25 + + + + + 268 + {{17, 74}, {99, 17}} + + YES + + 68288064 + 272630784 + Git Executable: + + + + + + 268 YES - + YES Apple URL pasteboard type NSFilenamesPboardType @@ -96,11 +143,7 @@ 337772033 163840 - - LucidaGrande - 1.100000e+01 - 3100 - + YES @@ -153,7 +196,7 @@ 268 - {{18, 103}, {203, 18}} + {{18, 151}, {203, 18}} YES @@ -164,13 +207,8 @@ 1211912703 130 - - NSImage - NSSwitch - - - NSSwitch - + + 200 @@ -178,12 +216,12 @@ - {400, 139} + {400, 187} NSView - + 268 YES @@ -217,7 +255,7 @@ 1211912703 130 - + @@ -342,7 +380,7 @@ YES - + YES dateFormat_10_0 dateStyle @@ -352,12 +390,12 @@ YES %m/%d/%y - + - EEEE, MMMM d, yyyy h:mm:ss a + EEEE, dd MMMM, yyyy HH:mm:ss NO @@ -387,11 +425,10 @@ {400, 139} - NSView - + 268 YES @@ -409,7 +446,7 @@ 1211912703 130 - + @@ -419,21 +456,16 @@ {239, 54} - NSView SUUpdater - - YES - PBShowWhitespaceDifferences - YES - + 268 YES @@ -446,12 +478,12 @@ -2080244224 0 - RW5hYmxlICdHaXN0IGl0Jw + Enable 'Gist it' 1211912703 130 - + @@ -473,7 +505,7 @@ 1211912703 130 - + @@ -495,7 +527,7 @@ 1211912703 130 - + @@ -517,7 +549,7 @@ 1211912703 130 - + @@ -527,7 +559,6 @@ {400, 116} - NSView @@ -727,7 +758,7 @@ values.gitExecutable YES - + YES NSAllowsEditingMultipleValuesSelection NSNullPlaceholder @@ -865,34 +896,48 @@ 117 + + + value: values.PBRefreshAutomatically + + + + + + value: values.PBRefreshAutomatically + value + values.PBRefreshAutomatically + 2 + + + 123 + YES 0 - - YES - + -2 - - RmlsZSdzIE93bmVyA + + File's Owner -1 - + First Responder -3 - + Application @@ -905,8 +950,10 @@ + + - + General @@ -921,7 +968,7 @@ - + Updates @@ -1051,12 +1098,12 @@ 26 - + 28 - + 42 @@ -1112,7 +1159,7 @@ YES - + Open Panel Accessory @@ -1153,7 +1200,7 @@ - + Integration @@ -1226,14 +1273,40 @@ + + 118 + + + YES + + + + + + 119 + + + + + 148 + + + YES + + + + + + 149 + + + YES - + YES - -1.IBPluginDependency - -2.IBPluginDependency -3.IBPluginDependency 1.IBEditorWindowLastContentRect 1.IBPluginDependency @@ -1246,9 +1319,13 @@ 11.IBPluginDependency 114.IBPluginDependency 115.IBPluginDependency + 118.IBPluginDependency + 119.IBPluginDependency 12.IBPluginDependency 13.IBPluginDependency 14.IBPluginDependency + 148.IBPluginDependency + 149.IBPluginDependency 15.IBEditorWindowLastContentRect 15.IBPluginDependency 16.IBPluginDependency @@ -1261,7 +1338,7 @@ 23.IBPluginDependency 24.IBPluginDependency 25.IBPluginDependency - 26.IBPluginDependency + 28.IBPluginDependency 4.IBEditorWindowLastContentRect 4.IBPluginDependency 4.IBUserGuides @@ -1291,15 +1368,13 @@ YES com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilderKit - com.apple.InterfaceBuilderKit - {{477, 551}, {400, 139}} + {{855, 318}, {400, 187}} com.apple.InterfaceBuilder.CocoaPlugin YES - 1.210000e+02 + 121 0 @@ -1314,6 +1389,10 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin {{514, 459}, {106, 71}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1333,7 +1412,7 @@ YES - 4.200000e+01 + 42 0 @@ -1363,9 +1442,7 @@ YES - - YES - + YES @@ -1373,15 +1450,13 @@ YES - - YES - + YES - 117 + 149 @@ -1399,7 +1474,7 @@ DBPrefsWindowController YES - + YES checkGitValidity: resetGitPath: @@ -1414,7 +1489,7 @@ YES - + YES badGitPathIcon generalPrefsView @@ -1469,8 +1544,632 @@ + + YES + + NSActionCell + NSCell + + IBFrameworkSource + AppKit.framework/Headers/NSActionCell.h + + + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSButton + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSButton.h + + + + NSButtonCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSButtonCell.h + + + + NSCell + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSCell.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSController + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSController.h + + + + NSDateFormatter + NSFormatter + + IBFrameworkSource + Foundation.framework/Headers/NSDateFormatter.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSImageView + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSImageView.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSMenuItem + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSMenuItemCell + NSButtonCell + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItemCell.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSObject + + IBFrameworkSource + Sparkle.framework/Headers/SUAppcast.h + + + + NSObject + + IBFrameworkSource + Sparkle.framework/Headers/SUUpdater.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebDownload.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebEditingDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebFrameLoadDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebJavaPlugIn.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPlugin.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPluginContainer.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebPolicyDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebResourceLoadDelegate.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebScriptObject.h + + + + NSObject + + IBFrameworkSource + WebKit.framework/Headers/WebUIDelegate.h + + + + NSPathCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSPathCell.h + + + + NSPathControl + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSPathControl.h + + + + NSPopUpButton + NSButton + + IBFrameworkSource + AppKit.framework/Headers/NSPopUpButton.h + + + + NSPopUpButtonCell + NSMenuItemCell + + IBFrameworkSource + AppKit.framework/Headers/NSPopUpButtonCell.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSTextField + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSTextField.h + + + + NSTextFieldCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSTextFieldCell.h + + + + NSUserDefaultsController + NSController + + IBFrameworkSource + AppKit.framework/Headers/NSUserDefaultsController.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + NSWindowController + NSResponder + + showWindow: + id + + + IBFrameworkSource + AppKit.framework/Headers/NSWindowController.h + + + + SUUpdater + NSObject + + checkForUpdates: + id + + + delegate + id + + + + 0 + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES ../GitX.xcodeproj 3 diff --git a/PBGitDefaults.h b/PBGitDefaults.h index 6610681..ee8cfef 100644 --- a/PBGitDefaults.h +++ b/PBGitDefaults.h @@ -16,6 +16,7 @@ + (BOOL) isGravatarEnabled; + (BOOL) confirmPublicGists; + (BOOL) isGistPublic; -+ (BOOL)showWhitespaceDifferences; ++ (BOOL) showWhitespaceDifferences; ++ (BOOL) refreshAutomatically; @end diff --git a/PBGitDefaults.m b/PBGitDefaults.m index c605617..ca55b98 100644 --- a/PBGitDefaults.m +++ b/PBGitDefaults.m @@ -15,6 +15,7 @@ #define kConfirmPublicGists @"PBConfirmPublicGists" #define kPublicGist @"PBGistPublic" #define kShowWhitespaceDifferences @"PBShowWhitespaceDifferences" +#define kRefreshAutomatically @"PBRefreshAutomatically" @implementation PBGitDefaults @@ -24,15 +25,18 @@ [defaultValues setObject:[NSNumber numberWithInt:kDefaultVerticalLineLength] forKey:kCommitMessageViewVerticalLineLength]; [defaultValues setObject:[NSNumber numberWithBool:YES] - forKey:kEnableGist]; + forKey:kEnableGist]; [defaultValues setObject:[NSNumber numberWithBool:YES] - forKey:kEnableGravatar]; + forKey:kEnableGravatar]; [defaultValues setObject:[NSNumber numberWithBool:YES] - forKey:kConfirmPublicGists]; + forKey:kConfirmPublicGists]; [defaultValues setObject:[NSNumber numberWithBool:NO] - forKey:kPublicGist]; + forKey:kPublicGist]; [defaultValues setObject:[NSNumber numberWithBool:YES] - forKey:kShowWhitespaceDifferences]; + forKey:kShowWhitespaceDifferences]; + [defaultValues setObject:[NSNumber numberWithBool:YES] + forKey:kRefreshAutomatically]; + [[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues]; } @@ -61,9 +65,13 @@ return [[NSUserDefaults standardUserDefaults] boolForKey:kPublicGist]; } - -+ (BOOL)showWhitespaceDifferences ++ (BOOL) showWhitespaceDifferences { return [[NSUserDefaults standardUserDefaults] boolForKey:kShowWhitespaceDifferences]; } + ++ (BOOL) refreshAutomatically +{ + return [[NSUserDefaults standardUserDefaults] boolForKey:kRefreshAutomatically]; +} @end From 4e0871c2e200e2c2ea9effa330b4ba8ff2c90400 Mon Sep 17 00:00:00 2001 From: Aron Cedercrantz Date: Fri, 17 Jul 2009 22:14:59 +0200 Subject: [PATCH 02/20] Add on window selection refresh. The changes in PBViewController is only there to supress a compiler warning. --- PBGitWindowController.m | 7 +++++++ PBViewController.h | 1 + PBViewController.m | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/PBGitWindowController.m b/PBGitWindowController.m index aba1987..25a22ed 100644 --- a/PBGitWindowController.m +++ b/PBGitWindowController.m @@ -9,6 +9,7 @@ #import "PBGitWindowController.h" #import "PBGitHistoryController.h" #import "PBGitCommitController.h" +#import "PBGitDefaults.h" @implementation PBGitWindowController @@ -137,6 +138,12 @@ [[NSAlert alertWithError:error] beginSheetModalForWindow: [self window] modalDelegate:self didEndSelector:nil contextInfo:nil]; } +- (void)windowDidBecomeKey:(NSNotification *)notification +{ + if (self.viewController && [PBGitDefaults refreshAutomatically]) { + [(PBViewController *)self.viewController refresh:nil]; + } +} #pragma mark - #pragma mark Toolbar Delegates diff --git a/PBViewController.h b/PBViewController.h index 4715c61..6055ace 100644 --- a/PBViewController.h +++ b/PBViewController.h @@ -25,4 +25,5 @@ - (void) updateView; - (NSResponder *)firstResponder; +- (IBAction) refresh:(id)sender; @end diff --git a/PBViewController.m b/PBViewController.m index 510b7a7..3368d16 100644 --- a/PBViewController.m +++ b/PBViewController.m @@ -45,4 +45,9 @@ { return nil; } + +- (IBAction) refresh:(id)sender +{ + return; +} @end From 7a1019fc5ab4ab0b7082a4dbf7dbeee90d830185 Mon Sep 17 00:00:00 2001 From: Aron Cedercrantz Date: Sun, 21 Feb 2010 15:54:22 +0100 Subject: [PATCH 03/20] Changed nothing, this is from a newly cloned repo. I have changed nothing... --- html/lib/md5.js | 512 ++++++++++++++++++++++++------------------------ 1 file changed, 256 insertions(+), 256 deletions(-) diff --git a/html/lib/md5.js b/html/lib/md5.js index 36fc1c2..46d2aab 100644 --- a/html/lib/md5.js +++ b/html/lib/md5.js @@ -1,256 +1,256 @@ -/* - * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message - * Digest Algorithm, as defined in RFC 1321. - * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * Distributed under the BSD License - * See http://pajhome.org.uk/crypt/md5 for more info. - */ - -/* - * Configurable variables. You may need to tweak these to be compatible with - * the server-side, but the defaults work in most cases. - */ -var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ -var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ -var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ - -/* - * These are the functions you'll usually want to call - * They take string arguments and return either hex or base-64 encoded strings - */ -function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));} -function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));} -function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));} -function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); } -function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); } -function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); } - -/* - * Perform a simple self-test to see if the VM is working - */ -function md5_vm_test() -{ - return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"; -} - -/* - * Calculate the MD5 of an array of little-endian words, and a bit length - */ -function core_md5(x, len) -{ - /* append padding */ - x[len >> 5] |= 0x80 << ((len) % 32); - x[(((len + 64) >>> 9) << 4) + 14] = len; - - var a = 1732584193; - var b = -271733879; - var c = -1732584194; - var d = 271733878; - - for(var i = 0; i < x.length; i += 16) - { - var olda = a; - var oldb = b; - var oldc = c; - var oldd = d; - - a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); - d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); - c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); - b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); - a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); - d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); - c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); - b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); - a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); - d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); - c = md5_ff(c, d, a, b, x[i+10], 17, -42063); - b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); - a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); - d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); - c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); - b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); - - a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); - d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); - c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); - b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); - a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); - d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); - c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); - b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); - a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); - d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); - c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); - b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); - a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); - d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); - c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); - b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); - - a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); - d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); - c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); - b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); - a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); - d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); - c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); - b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); - a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); - d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); - c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); - b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); - a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); - d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); - c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); - b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); - - a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); - d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); - c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); - b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); - a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); - d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); - c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); - b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); - a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); - d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); - c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); - b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); - a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); - d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); - c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); - b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); - - a = safe_add(a, olda); - b = safe_add(b, oldb); - c = safe_add(c, oldc); - d = safe_add(d, oldd); - } - return Array(a, b, c, d); - -} - -/* - * These functions implement the four basic operations the algorithm uses. - */ -function md5_cmn(q, a, b, x, s, t) -{ - return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); -} -function md5_ff(a, b, c, d, x, s, t) -{ - return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); -} -function md5_gg(a, b, c, d, x, s, t) -{ - return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); -} -function md5_hh(a, b, c, d, x, s, t) -{ - return md5_cmn(b ^ c ^ d, a, b, x, s, t); -} -function md5_ii(a, b, c, d, x, s, t) -{ - return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); -} - -/* - * Calculate the HMAC-MD5, of a key and some data - */ -function core_hmac_md5(key, data) -{ - var bkey = str2binl(key); - if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); - - var ipad = Array(16), opad = Array(16); - for(var i = 0; i < 16; i++) - { - ipad[i] = bkey[i] ^ 0x36363636; - opad[i] = bkey[i] ^ 0x5C5C5C5C; - } - - var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); - return core_md5(opad.concat(hash), 512 + 128); -} - -/* - * Add integers, wrapping at 2^32. This uses 16-bit operations internally - * to work around bugs in some JS interpreters. - */ -function safe_add(x, y) -{ - var lsw = (x & 0xFFFF) + (y & 0xFFFF); - var msw = (x >> 16) + (y >> 16) + (lsw >> 16); - return (msw << 16) | (lsw & 0xFFFF); -} - -/* - * Bitwise rotate a 32-bit number to the left. - */ -function bit_rol(num, cnt) -{ - return (num << cnt) | (num >>> (32 - cnt)); -} - -/* - * Convert a string to an array of little-endian words - * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. - */ -function str2binl(str) -{ - var bin = Array(); - var mask = (1 << chrsz) - 1; - for(var i = 0; i < str.length * chrsz; i += chrsz) - bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); - return bin; -} - -/* - * Convert an array of little-endian words to a string - */ -function binl2str(bin) -{ - var str = ""; - var mask = (1 << chrsz) - 1; - for(var i = 0; i < bin.length * 32; i += chrsz) - str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); - return str; -} - -/* - * Convert an array of little-endian words to a hex string. - */ -function binl2hex(binarray) -{ - var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; - var str = ""; - for(var i = 0; i < binarray.length * 4; i++) - { - str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + - hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); - } - return str; -} - -/* - * Convert an array of little-endian words to a base-64 string - */ -function binl2b64(binarray) -{ - var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - var str = ""; - for(var i = 0; i < binarray.length * 4; i += 3) - { - var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) - | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) - | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); - for(var j = 0; j < 4; j++) - { - if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; - else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); - } - } - return str; -} +/* + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message + * Digest Algorithm, as defined in RFC 1321. + * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for more info. + */ + +/* + * Configurable variables. You may need to tweak these to be compatible with + * the server-side, but the defaults work in most cases. + */ +var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ +var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ +var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ + +/* + * These are the functions you'll usually want to call + * They take string arguments and return either hex or base-64 encoded strings + */ +function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));} +function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));} +function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));} +function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); } +function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); } +function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); } + +/* + * Perform a simple self-test to see if the VM is working + */ +function md5_vm_test() +{ + return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"; +} + +/* + * Calculate the MD5 of an array of little-endian words, and a bit length + */ +function core_md5(x, len) +{ + /* append padding */ + x[len >> 5] |= 0x80 << ((len) % 32); + x[(((len + 64) >>> 9) << 4) + 14] = len; + + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + + for(var i = 0; i < x.length; i += 16) + { + var olda = a; + var oldb = b; + var oldc = c; + var oldd = d; + + a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); + d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); + c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); + b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); + a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); + d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); + c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); + b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); + a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); + d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); + c = md5_ff(c, d, a, b, x[i+10], 17, -42063); + b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); + a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); + d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); + c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); + b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); + + a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); + d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); + c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); + b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); + a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); + d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); + c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); + b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); + a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); + d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); + c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); + b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); + a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); + d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); + c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); + b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); + + a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); + d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); + c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); + b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); + a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); + d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); + c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); + b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); + a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); + d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); + c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); + b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); + a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); + d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); + c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); + b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); + + a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); + d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); + c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); + b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); + a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); + d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); + c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); + b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); + a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); + d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); + c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); + b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); + a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); + d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); + c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); + b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); + + a = safe_add(a, olda); + b = safe_add(b, oldb); + c = safe_add(c, oldc); + d = safe_add(d, oldd); + } + return Array(a, b, c, d); + +} + +/* + * These functions implement the four basic operations the algorithm uses. + */ +function md5_cmn(q, a, b, x, s, t) +{ + return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); +} +function md5_ff(a, b, c, d, x, s, t) +{ + return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); +} +function md5_gg(a, b, c, d, x, s, t) +{ + return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); +} +function md5_hh(a, b, c, d, x, s, t) +{ + return md5_cmn(b ^ c ^ d, a, b, x, s, t); +} +function md5_ii(a, b, c, d, x, s, t) +{ + return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); +} + +/* + * Calculate the HMAC-MD5, of a key and some data + */ +function core_hmac_md5(key, data) +{ + var bkey = str2binl(key); + if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); + + var ipad = Array(16), opad = Array(16); + for(var i = 0; i < 16; i++) + { + ipad[i] = bkey[i] ^ 0x36363636; + opad[i] = bkey[i] ^ 0x5C5C5C5C; + } + + var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); + return core_md5(opad.concat(hash), 512 + 128); +} + +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ +function safe_add(x, y) +{ + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function bit_rol(num, cnt) +{ + return (num << cnt) | (num >>> (32 - cnt)); +} + +/* + * Convert a string to an array of little-endian words + * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. + */ +function str2binl(str) +{ + var bin = Array(); + var mask = (1 << chrsz) - 1; + for(var i = 0; i < str.length * chrsz; i += chrsz) + bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); + return bin; +} + +/* + * Convert an array of little-endian words to a string + */ +function binl2str(bin) +{ + var str = ""; + var mask = (1 << chrsz) - 1; + for(var i = 0; i < bin.length * 32; i += chrsz) + str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); + return str; +} + +/* + * Convert an array of little-endian words to a hex string. + */ +function binl2hex(binarray) +{ + var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i++) + { + str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); + } + return str; +} + +/* + * Convert an array of little-endian words to a base-64 string + */ +function binl2b64(binarray) +{ + var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var str = ""; + for(var i = 0; i < binarray.length * 4; i += 3) + { + var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) + | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) + | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); + for(var j = 0; j < 4; j++) + { + if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; + else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); + } + } + return str; +} From 7007996c08ce2bf46649ef3c01c4d2c2b6b4ae49 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Wed, 5 Jan 2011 21:06:51 -0800 Subject: [PATCH 04/20] File names with whites spaces on history view --- GLFileView.m | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/GLFileView.m b/GLFileView.m index 3c114f2..3fa1ee8 100644 --- a/GLFileView.m +++ b/GLFileView.m @@ -238,11 +238,10 @@ NSArray *lines = [txt componentsSeparatedByString:@"\n"]; NSMutableString *res=[NSMutableString string]; [res appendString:@""]; - int i; - for (i=1; i<[lines count]; i++) { - NSString *line=[lines objectAtIndex:i]; - NSArray *fields=[line componentsSeparatedByString:@" "]; - NSArray *fileStatus=[[fields objectAtIndex:4] componentsSeparatedByString:@"\t"]; + for (NSString *line in lines) { + if([line length]<98) continue; + line=[line substringFromIndex:97]; + NSArray *fileStatus=[line componentsSeparatedByString:@"\t"]; NSString *status=[[fileStatus objectAtIndex:0] substringToIndex:1]; // ignore the score NSString *file=[fileStatus objectAtIndex:1]; NSString *txt=file; From bee812f85ac0aeae0b9109b521a3622bbbe0e8e1 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Wed, 5 Jan 2011 21:46:12 -0800 Subject: [PATCH 05/20] only show images as images ;) --- GLFileView.h | 5 +++++ GLFileView.m | 38 +++++++++++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/GLFileView.h b/GLFileView.h index dfeb15e..7dd9125 100644 --- a/GLFileView.h +++ b/GLFileView.h @@ -36,6 +36,11 @@ +(BOOL)isStartDiff:(NSString *)line; +(BOOL)isStartBlock:(NSString *)line; ++(NSArray *)getFilesNames:(NSString *)line; ++(BOOL)isBinaryFile:(NSString *)line; ++(NSString*)mimeTypeForFileName:(NSString*)file; ++(BOOL)isImage:(NSString*)file; + @property(retain) NSMutableArray *groups; @property(retain) NSString *logFormat; diff --git a/GLFileView.m b/GLFileView.m index 3fa1ee8..a4b6ba0 100644 --- a/GLFileView.m +++ b/GLFileView.m @@ -181,7 +181,6 @@ - (void)scopeBar:(MGScopeBar *)theScopeBar selectedStateChanged:(BOOL)selected forItem:(NSString *)identifier inGroup:(int)groupNumber { - NSLog(@"startFile=%@ identifier=%@ groupNumber=%d",startFile,identifier,groupNumber); if((groupNumber==0) && (startFile!=identifier)){ NSString *path = [NSString stringWithFormat:@"html/views/%@", identifier]; NSString *html = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:path]; @@ -330,17 +329,19 @@ }else if(inDiff){ [res appendString:[NSString stringWithFormat:@"

%@

",line]]; if([self isBinaryFile:line]){ - NSLog(@"line='%@'",line); [res appendString:@"
"]; NSArray *files=[self getFilesNames:line]; - NSLog(@"files='%@'",files); if(![[files objectAtIndex:0] isAbsolutePath]){ [res appendString:[NSString stringWithFormat:@"",[files objectAtIndex:0]]]; - [res appendString:[NSString stringWithFormat:@"",[files objectAtIndex:0]]]; + if([GLFileView isImage:[files objectAtIndex:0]]){ + [res appendString:[NSString stringWithFormat:@"",[files objectAtIndex:0]]]; + } } if(![[files objectAtIndex:1] isAbsolutePath]){ [res appendString:[NSString stringWithFormat:@"",[files objectAtIndex:1]]]; - [res appendString:[NSString stringWithFormat:@"",[files objectAtIndex:1]]]; + if([GLFileView isImage:[files objectAtIndex:1]]){ + [res appendString:[NSString stringWithFormat:@"",[files objectAtIndex:1]]]; + } } } } @@ -361,7 +362,6 @@ { NSString *a; NSString *b; - NSLog(@"line='%@'",line); NSScanner *scanner=[NSScanner scannerWithString:line]; if([scanner scanString:@"Binary files " intoString:NULL]){ [scanner scanUpToString:@" and" intoString:&a]; @@ -374,10 +374,34 @@ if (![b isAbsolutePath]) { b=[b substringFromIndex:2]; } - + return [NSArray arrayWithObjects:a,b,nil]; } ++(NSString*)mimeTypeForFileName:(NSString*)name +{ + NSString *mimeType = nil; + NSInteger i=[name rangeOfString:@"." options:NSBackwardsSearch].location; + if(i!=NSNotFound){ + NSString *ext=[name substringFromIndex:i+1]; + CFStringRef UTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (CFStringRef)ext, NULL); + if(UTI){ + CFStringRef registeredType = UTTypeCopyPreferredTagWithClass(UTI, kUTTagClassMIMEType); + if(registeredType){ + mimeType = NSMakeCollectable(registeredType); + } + CFRelease(UTI); + } + } + return mimeType; +} + ++(BOOL)isImage:(NSString*)file +{ + NSString *mimeType=[GLFileView mimeTypeForFileName:file]; + return (mimeType!=nil) && ([mimeType rangeOfString:@"image/" options:NSCaseInsensitiveSearch].location!=NSNotFound); +} + +(BOOL)isBinaryFile:(NSString *)line { return (([line length]>12) && [[line substringToIndex:12] isEqualToString:@"Binary files"]); From b4d2b0d9bd06ca0d224d2075a57426f90b7b2b62 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Wed, 5 Jan 2011 23:08:52 -0800 Subject: [PATCH 06/20] check bug --- PBGitSidebarController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PBGitSidebarController.m b/PBGitSidebarController.m index 301bf16..9f33709 100644 --- a/PBGitSidebarController.m +++ b/PBGitSidebarController.m @@ -223,8 +223,8 @@ - (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(PBSourceViewCell *)cell forTableColumn:(NSTableColumn *)tableColumn item:(PBSourceViewItem *)item { + cell.isCheckedOut = [item.revSpecifier isEqual:[repository headRef]]; if(item.revSpecifier!=NULL){ - cell.isCheckedOut = [item.revSpecifier isEqual:[repository headRef]]; cell.behind=[item.revSpecifier behind]; cell.ahead=[item.revSpecifier ahead]; }else{ From 526f246896e3d50fbc733b3a402fc39b6e2176dc Mon Sep 17 00:00:00 2001 From: German Laullon Date: Wed, 5 Jan 2011 23:37:16 -0800 Subject: [PATCH 07/20] correct branch ahead/behind counters --- PBGitRepository.h | 2 +- PBGitRepository.m | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/PBGitRepository.h b/PBGitRepository.h index a16acc0..9c61a60 100644 --- a/PBGitRepository.h +++ b/PBGitRepository.h @@ -129,7 +129,7 @@ static NSString * PBStringFromBranchFilterType(PBGitXBranchFilterType type) { - (void)findInModeScriptCommand:(NSScriptCommand *)command; -(NSNumber *)countCommintsOf:(NSString *)branchs; -+(bool)isLocalBranch:(NSString *)name; ++(bool)isLocalBranch:(NSString *)branch branchNameInto:(NSString **)name; @property (assign) BOOL hasChanged; diff --git a/PBGitRepository.m b/PBGitRepository.m index edec8ec..db5e650 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -269,9 +269,10 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; PBGitRef *newRef = [PBGitRef refFromString:[components objectAtIndex:0]]; PBGitRevSpecifier *revSpec = [[PBGitRevSpecifier alloc] initWithRef:newRef]; - if([PBGitRepository isLocalBranch:[components objectAtIndex:0]]){ - [revSpec setAhead:[self countCommintsOf:[NSString stringWithFormat:@"origin..%@",[components objectAtIndex:0]]]]; - [revSpec setBehind:[self countCommintsOf:[NSString stringWithFormat:@"%@..origin",[components objectAtIndex:0]]]]; + NSString *bName; + if([PBGitRepository isLocalBranch:[components objectAtIndex:0] branchNameInto:&bName]){ + [revSpec setAhead:[self countCommintsOf:[NSString stringWithFormat:@"origin/%@..%@",bName,bName]]]; + [revSpec setBehind:[self countCommintsOf:[NSString stringWithFormat:@"%@..origin/%@",bName,bName]]]; } [self addBranch:revSpec]; [self addRef:newRef fromParameters:components]; @@ -288,14 +289,19 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; [[[self windowController] window] setTitle:[self displayName]]; } -+(bool)isLocalBranch:(NSString *)name ++(bool)isLocalBranch:(NSString *)branch branchNameInto:(NSString **)name { - NSScanner *scanner=[NSScanner scannerWithString:name]; - return [scanner scanString:@"refs/heads/" intoString:NULL]; + NSScanner *scanner=[NSScanner scannerWithString:branch]; + bool is=[scanner scanString:@"refs/heads/" intoString:NULL]; + if(is && (name)){ + *name=[branch substringFromIndex:[scanner scanLocation]]; + } + return is; } -(NSNumber *)countCommintsOf:(NSString *)branchs { + NSLog(@"branchs:'%@'",branchs); NSArray *args = [NSArray arrayWithObjects:@"rev-list", branchs, nil]; NSString *o = [self outputForArguments:args]; if ([o length]==0) { From 8249c9605d99509debf0f40013bccf7750373dad Mon Sep 17 00:00:00 2001 From: German Laullon Date: Thu, 6 Jan 2011 00:03:21 -0800 Subject: [PATCH 08/20] error control on branch counters --- PBGitRepository.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PBGitRepository.m b/PBGitRepository.m index db5e650..01992c8 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -303,8 +303,9 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; { NSLog(@"branchs:'%@'",branchs); NSArray *args = [NSArray arrayWithObjects:@"rev-list", branchs, nil]; - NSString *o = [self outputForArguments:args]; - if ([o length]==0) { + int ret; + NSString *o = [self outputForArguments:args retValue:&ret]; + if ((ret!=0) || ([o length]==0)) { return NULL; } NSArray *commits = [o componentsSeparatedByString:@"\n"]; From 0253054fe5f6f13f940bf01951c6a77d02862414 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Thu, 6 Jan 2011 00:03:44 -0800 Subject: [PATCH 09/20] avoid unnecessary reloads --- PBGitHistoryList.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PBGitHistoryList.m b/PBGitHistoryList.m index 0a4433f..0ab1324 100644 --- a/PBGitHistoryList.m +++ b/PBGitHistoryList.m @@ -287,7 +287,7 @@ - (BOOL) haveRefsBeenModified { - [repository reloadRefs]; + //[repository reloadRefs]; NSMutableSet *currentRefSHAs = [NSMutableSet setWithArray:[repository.refs allKeys]]; [currentRefSHAs minusSet:lastRefSHAs]; From 0151598af03e1abc744e1ff1b64925bfd0a03b82 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Fri, 7 Jan 2011 00:37:29 -0800 Subject: [PATCH 10/20] (inital) display if remotes need a fetch --- PBGitSVRemoteItem.h | 4 +++- PBGitSVRemoteItem.m | 1 + PBGitSidebarController.h | 2 ++ PBGitSidebarController.m | 26 +++++++++++++++++++++----- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/PBGitSVRemoteItem.h b/PBGitSVRemoteItem.h index a64084c..8f27532 100644 --- a/PBGitSVRemoteItem.h +++ b/PBGitSVRemoteItem.h @@ -11,9 +11,11 @@ @interface PBGitSVRemoteItem : PBSourceViewItem { - + BOOL alert; } +@property (assign) BOOL alert; + + (id)remoteItemWithTitle:(NSString *)title; @end diff --git a/PBGitSVRemoteItem.m b/PBGitSVRemoteItem.m index 4ce251d..cbc4c32 100644 --- a/PBGitSVRemoteItem.m +++ b/PBGitSVRemoteItem.m @@ -12,6 +12,7 @@ @implementation PBGitSVRemoteItem +@synthesize alert; + (id)remoteItemWithTitle:(NSString *)title { diff --git a/PBGitSidebarController.h b/PBGitSidebarController.h index 268ba5c..134c251 100644 --- a/PBGitSidebarController.h +++ b/PBGitSidebarController.h @@ -40,6 +40,8 @@ - (void)setHistorySearch:(NSString *)searchString mode:(NSInteger)mode; +-(bool)remoteNeedFetch:(NSString *)remote; + @property(readonly) NSMutableArray *items; @property(readonly) NSView *sourceListControlsView; @property(readonly) PBGitHistoryController *historyViewController; diff --git a/PBGitSidebarController.m b/PBGitSidebarController.m index 9f33709..528bafd 100644 --- a/PBGitSidebarController.m +++ b/PBGitSidebarController.m @@ -51,6 +51,7 @@ historyViewController = [[PBGitHistoryController alloc] initWithRepository:repository superController:superController]; commitViewController = [[PBGitCommitController alloc] initWithRepository:repository superController:superController]; + [repository addObserver:self forKeyPath:@"refs" options:0 context:@"updateRefs"]; [repository addObserver:self forKeyPath:@"currentBranch" options:0 context:@"currentBranchChange"]; [repository addObserver:self forKeyPath:@"branches" options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:@"branchesModified"]; @@ -79,9 +80,7 @@ [sourceView reloadData]; [self selectCurrentBranch]; return; - } - - if ([@"branchesModified" isEqualToString:context]) { + }else if ([@"branchesModified" isEqualToString:context]) { NSInteger changeKind = [(NSNumber *)[change objectForKey:NSKeyValueChangeKindKey] intValue]; if (changeKind == NSKeyValueChangeInsertion) { @@ -97,10 +96,22 @@ for (PBGitRevSpecifier *rev in removedRevSpecs) [self removeRevSpec:rev]; } - return; + }else if ([@"updateRefs" isEqualToString:context]) { + for(PBGitSVRemoteItem* remote in [remotes children]){ + NSLog(@"remote.title=%@",[remote title]); + [remote setAlert:[self remoteNeedFetch:[remote title]]]; + } + }else{ + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } +} - [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; +-(bool)remoteNeedFetch:(NSString *)remote +{ + int ret; + NSArray *args = [NSArray arrayWithObjects:@"fetch", @"--dry-run", remote, nil]; + NSString *o = [repository outputForArguments:args retValue:&ret]; + return ((ret==0) && ([o length]!=0)); } - (PBSourceViewItem *) selectedItem @@ -231,6 +242,11 @@ cell.behind=nil; cell.ahead=nil; } + + if([item isKindOfClass:[PBGitSVRemoteItem class]]){ + NSLog(@"title: %@",[item title]); + cell.isCheckedOut=[item alert]; + } [cell setImage:[item icon]]; } From 5c9d7163e1a9926fe36c00c03716caa81d2cbc72 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Fri, 7 Jan 2011 12:10:44 -0800 Subject: [PATCH 11/20] badge system recoded --- PBGitRepository.m | 18 ------------------ PBGitSVBranchItem.h | 8 +++++++- PBGitSVBranchItem.m | 15 +++++++++++++++ PBGitSVRemoteItem.m | 4 ++++ PBGitSidebarController.h | 1 + PBGitSidebarController.m | 39 ++++++++++++++++++++++++++------------- PBSourceViewCell.h | 10 ++-------- PBSourceViewCell.m | 9 ++------- PBSourceViewItem.h | 2 ++ PBSourceViewItem.m | 5 +++++ 10 files changed, 64 insertions(+), 47 deletions(-) diff --git a/PBGitRepository.m b/PBGitRepository.m index 01992c8..34f10f3 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -269,11 +269,6 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; PBGitRef *newRef = [PBGitRef refFromString:[components objectAtIndex:0]]; PBGitRevSpecifier *revSpec = [[PBGitRevSpecifier alloc] initWithRef:newRef]; - NSString *bName; - if([PBGitRepository isLocalBranch:[components objectAtIndex:0] branchNameInto:&bName]){ - [revSpec setAhead:[self countCommintsOf:[NSString stringWithFormat:@"origin/%@..%@",bName,bName]]]; - [revSpec setBehind:[self countCommintsOf:[NSString stringWithFormat:@"%@..origin/%@",bName,bName]]]; - } [self addBranch:revSpec]; [self addRef:newRef fromParameters:components]; [oldBranches removeObject:revSpec]; @@ -299,19 +294,6 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; return is; } --(NSNumber *)countCommintsOf:(NSString *)branchs -{ - NSLog(@"branchs:'%@'",branchs); - NSArray *args = [NSArray arrayWithObjects:@"rev-list", branchs, nil]; - int ret; - NSString *o = [self outputForArguments:args retValue:&ret]; - if ((ret!=0) || ([o length]==0)) { - return NULL; - } - NSArray *commits = [o componentsSeparatedByString:@"\n"]; - return [NSNumber numberWithInt:[commits count]]; -} - - (void) lazyReload { if (!hasChanged) diff --git a/PBGitSVBranchItem.h b/PBGitSVBranchItem.h index c5e4538..cf1d56f 100644 --- a/PBGitSVBranchItem.h +++ b/PBGitSVBranchItem.h @@ -11,9 +11,15 @@ @interface PBGitSVBranchItem : PBSourceViewItem { - + BOOL isCheckedOut; + NSNumber *behind; + NSNumber *ahead; } + (id)branchItemWithRevSpec:(PBGitRevSpecifier *)revSpecifier; +@property (assign) BOOL isCheckedOut; +@property (assign) NSNumber *behind; +@property (assign) NSNumber *ahead; + @end diff --git a/PBGitSVBranchItem.m b/PBGitSVBranchItem.m index 6723096..3cf0389 100644 --- a/PBGitSVBranchItem.m +++ b/PBGitSVBranchItem.m @@ -11,6 +11,8 @@ @implementation PBGitSVBranchItem +@synthesize isCheckedOut; +@synthesize behind,ahead; + (id)branchItemWithRevSpec:(PBGitRevSpecifier *)revSpecifier { @@ -30,4 +32,17 @@ return branchImage; } + +- (NSString *) badge{ + NSMutableString *badge=nil; + if(isCheckedOut || ahead || behind){ + badge=[NSMutableString string]; + if(isCheckedOut) [badge appendString:@"✔ "]; + if(ahead) [badge appendFormat:@"+%@",ahead]; + if(behind) [badge appendFormat:@"-%@",behind]; + } + return badge; +} + + @end diff --git a/PBGitSVRemoteItem.m b/PBGitSVRemoteItem.m index cbc4c32..0947cfd 100644 --- a/PBGitSVRemoteItem.m +++ b/PBGitSVRemoteItem.m @@ -39,4 +39,8 @@ return [PBGitRef refFromString:[kGitXRemoteRefPrefix stringByAppendingString:self.title]]; } +- (NSString *)badge +{ + return (alert ? @"!" : nil); +} @end diff --git a/PBGitSidebarController.h b/PBGitSidebarController.h index 134c251..78d05ec 100644 --- a/PBGitSidebarController.h +++ b/PBGitSidebarController.h @@ -40,6 +40,7 @@ - (void)setHistorySearch:(NSString *)searchString mode:(NSInteger)mode; +-(NSNumber *)countCommintsOf:(NSString *)range; -(bool)remoteNeedFetch:(NSString *)remote; @property(readonly) NSMutableArray *items; diff --git a/PBGitSidebarController.m b/PBGitSidebarController.m index 528bafd..48901ae 100644 --- a/PBGitSidebarController.m +++ b/PBGitSidebarController.m @@ -101,11 +101,34 @@ NSLog(@"remote.title=%@",[remote title]); [remote setAlert:[self remoteNeedFetch:[remote title]]]; } + + 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]]]; + } + }else{ [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } } +#pragma mark Badges Methods + +-(NSNumber *)countCommintsOf:(NSString *)range +{ + NSArray *args = [NSArray arrayWithObjects:@"rev-list", range, nil]; + int ret; + NSString *o = [repository outputForArguments:args retValue:&ret]; + if ((ret!=0) || ([o length]==0)) { + return NULL; + } + NSArray *commits = [o componentsSeparatedByString:@"\n"]; + return [NSNumber numberWithInt:[commits count]]; +} + + -(bool)remoteNeedFetch:(NSString *)remote { int ret; @@ -114,6 +137,8 @@ return ((ret==0) && ([o length]!=0)); } +#pragma mark ----- + - (PBSourceViewItem *) selectedItem { NSInteger index = [sourceView selectedRow]; @@ -234,19 +259,7 @@ - (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(PBSourceViewCell *)cell forTableColumn:(NSTableColumn *)tableColumn item:(PBSourceViewItem *)item { - cell.isCheckedOut = [item.revSpecifier isEqual:[repository headRef]]; - if(item.revSpecifier!=NULL){ - cell.behind=[item.revSpecifier behind]; - cell.ahead=[item.revSpecifier ahead]; - }else{ - cell.behind=nil; - cell.ahead=nil; - } - - if([item isKindOfClass:[PBGitSVRemoteItem class]]){ - NSLog(@"title: %@",[item title]); - cell.isCheckedOut=[item alert]; - } + [cell setBadge:[item badge]]; [cell setImage:[item icon]]; } diff --git a/PBSourceViewCell.h b/PBSourceViewCell.h index fb80ece..fc04a3e 100644 --- a/PBSourceViewCell.h +++ b/PBSourceViewCell.h @@ -9,16 +9,10 @@ #import #import "PBIconAndTextCell.h" - @interface PBSourceViewCell : PBIconAndTextCell { - BOOL isCheckedOut; - NSNumber *behind; - NSNumber *ahead; + NSString *badge; } -@property (assign) BOOL isCheckedOut; -@property (assign) NSNumber *behind; -@property (assign) NSNumber *ahead; - +@property (assign) NSString *badge; @end diff --git a/PBSourceViewCell.m b/PBSourceViewCell.m index f207e04..ed89668 100644 --- a/PBSourceViewCell.m +++ b/PBSourceViewCell.m @@ -15,8 +15,7 @@ @implementation PBSourceViewCell -@synthesize isCheckedOut; -@synthesize behind,ahead; +@synthesize badge; # pragma mark context menu delegate methods @@ -35,11 +34,7 @@ - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)outlineView { - if(behind || ahead || isCheckedOut){ - NSMutableString *badge=[NSMutableString string]; - if(isCheckedOut) [badge appendString:@"✔ "]; - if(ahead) [badge appendFormat:@"+%@",ahead]; - if(behind) [badge appendFormat:@"-%@",behind]; + if(badge){ NSImage *checkedOutImage = [PBSourceViewBadge badge:badge forCell:self]; NSSize imageSize = [checkedOutImage size]; NSRect imageFrame; diff --git a/PBSourceViewItem.h b/PBSourceViewItem.h index 399f8e7..012eef9 100644 --- a/PBSourceViewItem.h +++ b/PBSourceViewItem.h @@ -26,6 +26,8 @@ + (id)itemWithRevSpec:(PBGitRevSpecifier *)revSpecifier; + (id)itemWithTitle:(NSString *)title; +- (NSString *)badge; + - (void)addChild:(PBSourceViewItem *)child; - (void)removeChild:(PBSourceViewItem *)child; diff --git a/PBSourceViewItem.m b/PBSourceViewItem.m index 5d450fb..5e4f881 100644 --- a/PBSourceViewItem.m +++ b/PBSourceViewItem.m @@ -109,6 +109,11 @@ return nil; } +- (NSString *)badge +{ + return nil; +} + - (NSImage *) icon { return nil; From 2d998e34db70b2548cee368e361ccdde2e2b94df Mon Sep 17 00:00:00 2001 From: Aron Cedercrantz Date: Wed, 19 Jan 2011 13:26:01 +0100 Subject: [PATCH 12/20] Removed duplicated code. --- PBViewController.h | 1 - PBViewController.m | 4 ---- 2 files changed, 5 deletions(-) diff --git a/PBViewController.h b/PBViewController.h index 5636b3d..ec5dbd4 100644 --- a/PBViewController.h +++ b/PBViewController.h @@ -37,7 +37,6 @@ - (void)viewLoaded; - (NSResponder *)firstResponder; -- (IBAction) refresh:(id)sender; - (IBAction) refresh:(id)sender; @end diff --git a/PBViewController.m b/PBViewController.m index ba12e4a..77e4f3f 100644 --- a/PBViewController.m +++ b/PBViewController.m @@ -44,10 +44,6 @@ return nil; } -- (IBAction) refresh: sender -{ -} - // The next methods should be implemented in the subclass if necessary - (void)updateView { From 3ebfec6c62f12aaa7629a2eb6050218f1c9d65ad Mon Sep 17 00:00:00 2001 From: Aron Cedercrantz Date: Wed, 19 Jan 2011 13:28:52 +0100 Subject: [PATCH 13/20] Changed compiler to clang + llvm. Changed static analyzer property value so it's ran by default. --- GitX.xcodeproj/project.pbxproj | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/GitX.xcodeproj/project.pbxproj b/GitX.xcodeproj/project.pbxproj index b32a6aa..db0f544 100644 --- a/GitX.xcodeproj/project.pbxproj +++ b/GitX.xcodeproj/project.pbxproj @@ -1158,6 +1158,7 @@ isa = PBXProject; buildConfigurationList = 26FC0A880875C7B200E6366F /* Build configuration list for PBXProject "GitX" */; compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, @@ -1608,10 +1609,12 @@ GCC_ENABLE_OBJC_GC = required; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = DEBUG_BUILD; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_PREPROCESS = YES; PREBINDING = NO; + RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; }; name = Debug; @@ -1625,11 +1628,13 @@ x86_64, ); GCC_ENABLE_OBJC_GC = required; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_PREFIX_HEADER = $PROJECT_TEMP_DIR/revision; INFOPLIST_PREPROCESS = YES; PREBINDING = NO; + RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; }; name = Release; From 3c9cb12e84aa8324f368bc8180ddcbe00f67a7a7 Mon Sep 17 00:00:00 2001 From: Aron Cedercrantz Date: Wed, 19 Jan 2011 13:48:49 +0100 Subject: [PATCH 14/20] Fixed Preferences xib. --- English.lproj/Preferences.xib | 149 ++++++++++++++++++++++------------ 1 file changed, 96 insertions(+), 53 deletions(-) diff --git a/English.lproj/Preferences.xib b/English.lproj/Preferences.xib index faf64fb..fd43be8 100644 --- a/English.lproj/Preferences.xib +++ b/English.lproj/Preferences.xib @@ -2,13 +2,13 @@ 1050 - 10H574 - 804 + 10J567 + 851 1038.35 - 461.00 + 462.00 com.apple.InterfaceBuilder.CocoaPlugin - 804 + 851 YES @@ -43,6 +43,37 @@ 268 YES + + + 268 + {{18, 193}, {158, 18}} + + YES + + -2080244224 + 0 + Refresh automatically + + LucidaGrande + 13 + 1044 + + + 1211912703 + 2 + + NSImage + NSSwitch + + + NSSwitch + + + + 200 + 25 + + 268 @@ -53,11 +84,7 @@ 68288064 272630784 Reset all dialog warnings: - - LucidaGrande - 13 - 1044 - + 6 @@ -160,13 +187,8 @@ 1211912703 2 - - NSImage - NSSwitch - - - NSSwitch - + + 200 @@ -274,7 +296,7 @@ 1211912703 2 - + @@ -285,7 +307,7 @@ 268 - {{18, 193}, {279, 18}} + {{18, 218}, {279, 18}} YES @@ -296,29 +318,7 @@ 1211912703 2 - - - - - 200 - 25 - - - - - 268 - {{18, 77}, {158, 18}} - - YES - - -2080244224 - 0 - Refresh automatically - - - 1211912703 - 2 - + @@ -329,7 +329,7 @@ 268 - {{18, 218}, {207, 18}} + {{18, 243}, {207, 18}} YES @@ -340,7 +340,7 @@ 1211912703 2 - + @@ -349,7 +349,7 @@ - {400, 254} + {401, 279} NSView @@ -388,7 +388,7 @@ 1211912703 2 - + @@ -579,7 +579,7 @@ 1211912703 2 - + @@ -595,6 +595,10 @@ SUUpdater + + YES + PBRefreshAutomatically + YES @@ -616,7 +620,7 @@ 1211912703 2 - + @@ -638,7 +642,7 @@ 1211912703 2 - + @@ -660,7 +664,7 @@ 1211912703 2 - + @@ -682,7 +686,7 @@ 1211912703 2 - + @@ -1101,6 +1105,22 @@ 140 + + + value: values.PBRefreshAutomatically + + + + + + value: values.PBRefreshAutomatically + value + values.PBRefreshAutomatically + 2 + + + 144 + @@ -1146,6 +1166,7 @@ + General @@ -1565,6 +1586,20 @@ + + 141 + + + YES + + + + + + 142 + + + @@ -1603,6 +1638,9 @@ 138.IBPluginDependency 139.IBPluginDependency 14.IBPluginDependency + 141.IBPluginDependency + 141.IBViewBoundsToFrameTransform + 142.IBPluginDependency 15.IBEditorWindowLastContentRect 15.IBPluginDependency 16.IBPluginDependency @@ -1645,7 +1683,7 @@ YES com.apple.InterfaceBuilder.CocoaPlugin - {{845, 630}, {400, 254}} + {{511, 548}, {401, 279}} com.apple.InterfaceBuilder.CocoaPlugin YES @@ -1694,6 +1732,11 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAADBcAAAw3QAAA + + com.apple.InterfaceBuilder.CocoaPlugin {{443, 712}, {103, 71}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1707,7 +1750,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{450, 787}, {400, 139}} + {{324, 683}, {400, 139}} com.apple.InterfaceBuilder.CocoaPlugin YES @@ -1757,7 +1800,7 @@ - 140 + 144 From 1820973e70e6afbccc34d672d2c8a30d38181722 Mon Sep 17 00:00:00 2001 From: Aron Cedercrantz Date: Wed, 19 Jan 2011 13:50:01 +0100 Subject: [PATCH 15/20] Fixed automatic refresh (broken by merge). --- PBGitWindowController.h | 2 -- PBGitWindowController.m | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/PBGitWindowController.h b/PBGitWindowController.h index 0f38e22..9b008fc 100644 --- a/PBGitWindowController.h +++ b/PBGitWindowController.h @@ -25,8 +25,6 @@ IBOutlet NSTextField *statusField; IBOutlet NSProgressIndicator *progressIndicator; - PBViewController* viewController; - IBOutlet NSToolbarItem *terminalItem; IBOutlet NSToolbarItem *finderItem; } diff --git a/PBGitWindowController.m b/PBGitWindowController.m index 3e3e5ab..b08dfc2 100644 --- a/PBGitWindowController.m +++ b/PBGitWindowController.m @@ -136,8 +136,8 @@ - (void)windowDidBecomeKey:(NSNotification *)notification { - if (self.viewController && [PBGitDefaults refreshAutomatically]) { - [(PBViewController *)self.viewController refresh:nil]; + if ([PBGitDefaults refreshAutomatically]) { + [contentController refresh:nil]; } } From be65ac735831d44554328e7528f8029df6f19045 Mon Sep 17 00:00:00 2001 From: Aron Cedercrantz Date: Wed, 19 Jan 2011 13:52:47 +0100 Subject: [PATCH 16/20] libgit2 updated --- libgit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgit2 b/libgit2 index bda29d0..998a7bf 160000 --- a/libgit2 +++ b/libgit2 @@ -1 +1 @@ -Subproject commit bda29d0f7bc59a821b03c716562aef6ea3b5903a +Subproject commit 998a7bf824c5faca0f9766c9b89bb73ec1315272 From 0774e09bdd3fe0c43276eca4519a21e626da44a0 Mon Sep 17 00:00:00 2001 From: Aron Cedercrantz Date: Wed, 19 Jan 2011 14:01:16 +0100 Subject: [PATCH 17/20] Fixed a bug where an uninitialized pointer would be used. --- GLFileView.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GLFileView.m b/GLFileView.m index a4b6ba0..5484fee 100644 --- a/GLFileView.m +++ b/GLFileView.m @@ -360,8 +360,8 @@ +(NSArray *)getFilesNames:(NSString *)line { - NSString *a; - NSString *b; + NSString *a = nil; + NSString *b = nil; NSScanner *scanner=[NSScanner scannerWithString:line]; if([scanner scanString:@"Binary files " intoString:NULL]){ [scanner scanUpToString:@" and" intoString:&a]; From a0e13366feb9f4377d4cac1a895ed0c68006d382 Mon Sep 17 00:00:00 2001 From: Aron Cedercrantz Date: Wed, 19 Jan 2011 14:01:35 +0100 Subject: [PATCH 18/20] Fixed some bugs where a NULL dereference could occur. --- PBGitTree.m | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/PBGitTree.m b/PBGitTree.m index 2f7af52..c966fa5 100644 --- a/PBGitTree.m +++ b/PBGitTree.m @@ -131,7 +131,9 @@ if(error==nil){ res=[repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"blame", @"-p", sha, @"--", [self fullPath], nil]]; }else{ - *anError = [NSError errorWithDomain:@"blame" code:1 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:error,NSLocalizedDescriptionKey,nil]]; + if (anError != NULL) { + *anError = [NSError errorWithDomain:@"blame" code:1 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:error,NSLocalizedDescriptionKey,nil]]; + } } return res; @@ -147,7 +149,9 @@ if(error==nil){ res=[repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"log", [NSString stringWithFormat:@"--pretty=format:%@",format], @"--", [self fullPath], nil]]; }else{ - *anError = [NSError errorWithDomain:@"log" code:1 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:error,NSLocalizedDescriptionKey,nil]]; + if (anError != NULL) { + *anError = [NSError errorWithDomain:@"log" code:1 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:error,NSLocalizedDescriptionKey,nil]]; + } } return res; @@ -178,12 +182,16 @@ res=[repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"diff", sha, des,[self fullPath], nil]]; if ([res length]==0) { NSLog(@"--%d",[res length]); - *anError = [NSError errorWithDomain:@"diff" code:1 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"No Diff",NSLocalizedDescriptionKey,nil]]; + if (anError != NULL) { + *anError = [NSError errorWithDomain:@"diff" code:1 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"No Diff",NSLocalizedDescriptionKey,nil]]; + } }else{ NSLog(@"--%@",[res substringToIndex:80]); } }else{ - *anError = [NSError errorWithDomain:@"diff" code:1 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:error,NSLocalizedDescriptionKey,nil]]; + if (anError != NULL) { + *anError = [NSError errorWithDomain:@"diff" code:1 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:error,NSLocalizedDescriptionKey,nil]]; + } } return res; @@ -205,7 +213,9 @@ if(error==nil){ res = [self contents]; }else{ - *anError = [NSError errorWithDomain:@"show" code:1 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:error,NSLocalizedDescriptionKey,nil]]; + if (anError != NULL) { + *anError = [NSError errorWithDomain:@"show" code:1 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:error,NSLocalizedDescriptionKey,nil]]; + } } return res; From bb872a9cd160d5053649e88fa634e66480c03aa1 Mon Sep 17 00:00:00 2001 From: Aron Cedercrantz Date: Wed, 19 Jan 2011 14:02:48 +0100 Subject: [PATCH 19/20] Removed unused variable. --- GLFileView.m | 1 - 1 file changed, 1 deletion(-) diff --git a/GLFileView.m b/GLFileView.m index 5484fee..af619e8 100644 --- a/GLFileView.m +++ b/GLFileView.m @@ -253,7 +253,6 @@ NSArray *stat=[stats objectForKey:fileName]; NSInteger add=[[stat objectAtIndex:0] integerValue]; NSInteger rem=[[stat objectAtIndex:1] integerValue]; - NSInteger tot=add+rem; [res appendString:@"
%@
%@
"]; [res appendString:[NSString stringWithFormat:@"%@",status,file,fileName,txt]]; From da2e81ebfbd34f0a96be04979cf7a6ec4502bdd1 Mon Sep 17 00:00:00 2001 From: Aron Cedercrantz Date: Wed, 19 Jan 2011 14:05:19 +0100 Subject: [PATCH 20/20] Removed two unused variables. --- GLFileView.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/GLFileView.m b/GLFileView.m index af619e8..1598044 100644 --- a/GLFileView.m +++ b/GLFileView.m @@ -277,8 +277,8 @@ BOOL inDiff=FALSE; BOOL inBlock=FALSE; - int l_int,l_line,l_end; - int r_int,r_line,r_end; + int l_line,l_end; + int r_line,r_end; int i; for (i=0; i<[lines count]; i++) { line=[lines objectAtIndex:i]; @@ -294,12 +294,12 @@ NSArray *pos_l=[[pos objectAtIndex:0] componentsSeparatedByString:@","]; NSArray *pos_r=[[pos objectAtIndex:1] componentsSeparatedByString:@","]; - l_end=l_line=l_int=abs([[pos_l objectAtIndex:0]integerValue]); + 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=r_int=[[pos_r objectAtIndex:0]integerValue]; + r_end=r_line=[[pos_r objectAtIndex:0]integerValue]; if ([pos_r count]>1) { r_end=r_line+[[pos_r objectAtIndex:1]integerValue]; }