Skip to content

Commit 1490db8

Browse files
committed
Merge branch 'master' into gui-refresh
2 parents b785abb + 5e9210d commit 1490db8

File tree

122 files changed

+3001
-8000
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+3001
-8000
lines changed

ApplicationController.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ - (ApplicationController*)init
3131

3232
if(![[NSBundle bundleWithPath:@"/System/Library/Frameworks/Quartz.framework/Frameworks/QuickLookUI.framework"] load])
3333
if(![[NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/QuickLookUI.framework"] load])
34-
NSLog(@"Could not load QuickLook");
34+
DLog(@"Could not load QuickLook");
3535

3636
/* Value Transformers */
3737
NSValueTransformer *transformer = [[PBNSURLPathUserDefaultsTransfomer alloc] init];
@@ -55,7 +55,7 @@ - (void)registerServices
5555
int serviceVersion = [[NSUserDefaults standardUserDefaults] integerForKey:@"Services Version"];
5656
if (serviceVersion < 2)
5757
{
58-
NSLog(@"Updating services menu…");
58+
DLog(@"Updating services menu…");
5959
NSUpdateDynamicServices();
6060
[[NSUserDefaults standardUserDefaults] setInteger:2 forKey:@"Services Version"];
6161
}
@@ -245,7 +245,7 @@ - (NSPersistentStoreCoordinator *) persistentStoreCoordinator {
245245
fileManager = [NSFileManager defaultManager];
246246
applicationSupportFolder = [self applicationSupportFolder];
247247
if ( ![fileManager fileExistsAtPath:applicationSupportFolder isDirectory:NULL] ) {
248-
[fileManager createDirectoryAtPath:applicationSupportFolder attributes:nil];
248+
[fileManager createDirectoryAtPath:applicationSupportFolder withIntermediateDirectories:YES attributes:nil error:nil];
249249
}
250250

251251
url = [NSURL fileURLWithPath: [applicationSupportFolder stringByAppendingPathComponent: @"GitTest.xml"]];
@@ -414,7 +414,7 @@ - (IBAction)showHelp:(id)sender
414414

415415
- (IBAction)reportAProblem:(id)sender
416416
{
417-
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://gitx.lighthouseapp.com/tickets"]];
417+
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://github.com/laullon/gitx/issues"]];
418418
}
419419

420420

Commands/PBCommandFactory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
#import "PBGitRepository.h"
1010

1111
@protocol PBCommandFactory
12-
+ (NSArray *) commandsForObject:(NSObject *) object repository:(PBGitRepository *) repository;
12+
+ (NSArray *) commandsForObject:(id<PBPresentable>) object repository:(PBGitRepository *) repository;
1313
@end

Commands/PBCommandWithParameter.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ @implementation PBCommandWithParameter
1616
@synthesize parameterDisplayName;
1717

1818
- initWithCommand:(PBCommand *) aCommand parameterName:(NSString *) param parameterDisplayName:(NSString *) paramDisplayName {
19-
if (self = [super initWithDisplayName:[aCommand displayName] parameters:nil repository:[aCommand repository]]) {
19+
if ((self = [super initWithDisplayName:[aCommand displayName] parameters:nil repository:[aCommand repository]])) {
2020
command = [aCommand retain];
2121
parameterName = [param retain];
2222
parameterDisplayName = [paramDisplayName retain];

Commands/PBOpenDocumentCommand.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
@implementation PBOpenDocumentCommand
1414

1515
- (id) initWithDocumentAbsolutePath:(NSString *) path {
16-
if (self = [super initWithDisplayName:@"Open" parameters:nil repository:nil]) {
16+
if ((self = [super initWithDisplayName:@"Open" parameters:nil repository:nil])) {
1717
documentURL = [[NSURL alloc] initWithString:path];
1818
}
1919
return self;

Commands/PBRemoteCommandFactory.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ + (NSArray *) commandsForSubmodule:(PBGitSubmodule *) submodule inRepository:(PB
5858
return commands;
5959
}
6060

61-
+ (NSArray *) commandsForObject:(NSObject *) object repository:(PBGitRepository *) repository {
61+
+ (NSArray *) commandsForObject:(id<PBPresentable>) object repository:(PBGitRepository *) repository {
6262
if ([object isKindOfClass:[PBGitSubmodule class]]) {
6363
return [PBRemoteCommandFactory commandsForSubmodule:(id)object inRepository:repository];
6464
}

Commands/PBRevealWithFinderCommand.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ - (id) initWithDocumentAbsolutePath:(NSString *) path {
1717
return nil;
1818
}
1919

20-
if (self = [super initWithDisplayName:@"Reveal in Finder" parameters:nil repository:nil]) {
20+
if ((self = [super initWithDisplayName:@"Reveal in Finder" parameters:nil repository:nil])) {
2121
documentURL = [[NSURL alloc] initWithString:path];
2222
}
2323
return self;

Commands/PBStashCommandFactory.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ + (NSArray *) commandsForRef:(PBGitRef *) ref repository:(PBGitRepository *) rep
2222

2323
@implementation PBStashCommandFactory
2424

25-
+ (NSArray *) commandsForObject:(NSObject *) object repository:(PBGitRepository *) repository {
25+
+ (NSArray *) commandsForObject:(id<PBPresentable>) object repository:(PBGitRepository *) repository {
2626
NSArray *cmds = nil;
2727
if ([object isKindOfClass:[PBGitStash class]]) {
2828
cmds = [PBStashCommandFactory commandsForStash:(id)object repository:repository];

Controller/PBArgumentPickerController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
@implementation PBArgumentPickerController
1414

1515
- initWithCommandWithParameter:(PBCommandWithParameter *) aCommand {
16-
if (self = [super initWithWindowNibName:@"PBArgumentPicker" owner:self]) {
16+
if ((self = [super initWithWindowNibName:@"PBArgumentPicker" owner:self])) {
1717
cmdWithParameter = [aCommand retain];
1818
}
1919
return self;

Controller/PBGitResetController.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
//
88

99
#import <Cocoa/Cocoa.h>
10+
#import "PBResetSheet.h"
1011

1112
@class PBGitRepository;
13+
@protocol PBGitRefish;
1214

1315
@interface PBGitResetController : NSObject {
1416
PBGitRepository *repository;
@@ -17,8 +19,8 @@
1719

1820
- (NSArray *) menuItems;
1921

20-
2122
// actions
23+
- (void) resetToRefish: (id<PBGitRefish>) spec type: (PBResetType) type;
2224
- (void) resetHardToHead;
2325

2426
@end

Controller/PBGitResetController.m

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,25 @@
99
#import "PBGitResetController.h"
1010
#import "PBGitRepository.h"
1111
#import "PBCommand.h"
12+
#import "PBGitRefish.h"
13+
#import "PBResetSheet.h"
1214

13-
static NSString * const kCommandKey = @"command";
1415

1516
@implementation PBGitResetController
1617

1718
- (id) initWithRepository:(PBGitRepository *) repo {
18-
if (self = [super init]){
19+
if ((self = [super init])){
1920
repository = [repo retain];
2021
}
2122
return self;
2223
}
2324

2425
- (void) resetHardToHead {
25-
NSAlert *alert = [NSAlert alertWithMessageText:@"Reseting working copy and index"
26-
defaultButton:@"Cancel"
27-
alternateButton:nil
28-
otherButton:@"Reset"
29-
informativeTextWithFormat:@"Are you sure you want to reset your working copy and index? All changes to them will be gone!"];
30-
31-
NSArray *arguments = [NSArray arrayWithObjects:@"reset", @"--hard", @"HEAD", nil];
32-
PBCommand *cmd = [[PBCommand alloc] initWithDisplayName:@"Reset hard to HEAD" parameters:arguments repository:repository];
33-
cmd.commandTitle = cmd.displayName;
34-
cmd.commandDescription = @"Reseting head";
35-
36-
NSMutableDictionary *info = [NSMutableDictionary dictionaryWithObject:cmd forKey:kCommandKey];
37-
38-
[alert beginSheetModalForWindow:[repository.windowController window]
39-
modalDelegate:self
40-
didEndSelector:@selector(confirmResetSheetDidEnd:returnCode:contextInfo:)
41-
contextInfo:info];
26+
[self resetToRefish: [PBGitRef refFromString: @"HEAD"] type: PBResetTypeHard];
27+
}
28+
29+
- (void) resetToRefish:(id<PBGitRefish>) refish type:(PBResetType)type {
30+
[PBResetSheet beginResetSheetForRepository: repository refish: refish andType: type];
4231
}
4332

4433
- (void) reset {
@@ -70,18 +59,4 @@ - (void) dealloc {
7059
[super dealloc];
7160
}
7261

73-
#pragma mark -
74-
#pragma mark Confirm Window
75-
76-
- (void) confirmResetSheetDidEnd:(NSAlert *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
77-
{
78-
[[sheet window] orderOut:nil];
79-
80-
if (returnCode != NSAlertDefaultReturn) {
81-
PBCommand *cmd = [(NSDictionary *)contextInfo objectForKey:kCommandKey];
82-
[cmd invoke];
83-
}
84-
}
85-
86-
8762
@end

0 commit comments

Comments
 (0)