Skip to content

Commit 13a4fd6

Browse files
author
Adi Luhung Suryadi
committed
merging krasnyk/stashes branch to soundevolution/svn
Merge branch 'refs/heads/stashes' into testing Conflicts: GitX.xcodeproj/project.pbxproj PBGitHistoryView.xib PBGitSidebarView.xib
2 parents a3bba2e + 33e21e2 commit 13a4fd6

File tree

88 files changed

+4393
-453
lines changed

Some content is hidden

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

88 files changed

+4393
-453
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
build
22
build/revision
3+
._*
34
*.xcodeproj/
45
!*.xcodeproj/project.pbxproj
56
Nightly.app.zip

ApplicationController.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
- (IBAction)installCliTool:(id)sender;
3333

3434
- (IBAction)saveAction:sender;
35-
- (IBAction) showHelp:(id) sender;
35+
- (IBAction)showHelp:(id)sender;
36+
- (IBAction)reportAProblem:(id)sender;
3637

37-
- (IBAction) showCloneRepository:(id)sender;
38+
- (IBAction)showCloneRepository:(id)sender;
3839
@end

ApplicationController.m

+41-5
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ - (void)registerServices
6464
- (void)applicationDidFinishLaunching:(NSNotification*)notification
6565
{
6666
[[SUUpdater sharedUpdater] setSendsSystemProfile:YES];
67+
[[SUUpdater sharedUpdater] setDelegate:self];
6768

6869
// Make sure Git's SSH password requests get forwarded to our little UI tool:
6970
setenv( "SSH_ASKPASS", [[[NSBundle mainBundle] pathForResource: @"gitx_askpasswd" ofType: @""] UTF8String], 1 );
@@ -196,11 +197,6 @@ - (IBAction)installCliTool:(id)sender;
196197
former cannot be found), the system's temporary directory.
197198
*/
198199

199-
- (IBAction) showHelp:(id) sender
200-
{
201-
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://gitx.frim.nl/user_manual.html"]];
202-
}
203-
204200
- (NSString *)applicationSupportFolder {
205201

206202
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
@@ -380,4 +376,44 @@ - (void) dealloc {
380376
[managedObjectModel release], managedObjectModel = nil;
381377
[super dealloc];
382378
}
379+
380+
381+
#pragma mark Sparkle delegate methods
382+
383+
- (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile
384+
{
385+
NSArray *keys = [NSArray arrayWithObjects:@"key", @"displayKey", @"value", @"displayValue", nil];
386+
NSMutableArray *feedParameters = [NSMutableArray array];
387+
388+
// only add parameters if the profile is being sent this time
389+
if (sendingProfile) {
390+
NSString *CFBundleGitVersion = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleGitVersion"];
391+
if (CFBundleGitVersion)
392+
[feedParameters addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"CFBundleGitVersion", @"Full Version", CFBundleGitVersion, CFBundleGitVersion, nil]
393+
forKeys:keys]];
394+
395+
NSString *gitVersion = [PBGitBinary version];
396+
if (gitVersion)
397+
[feedParameters addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"gitVersion", @"git Version", gitVersion, gitVersion, nil]
398+
forKeys:keys]];
399+
}
400+
401+
return feedParameters;
402+
}
403+
404+
405+
#pragma mark Help menu
406+
407+
- (IBAction)showHelp:(id)sender
408+
{
409+
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://gitx.frim.nl/user_manual.html"]];
410+
}
411+
412+
- (IBAction)reportAProblem:(id)sender
413+
{
414+
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://gitx.lighthouseapp.com/tickets"]];
415+
}
416+
417+
418+
383419
@end

Commands/PBCommand.h

+12-4
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,30 @@
77
//
88

99
#import <Foundation/Foundation.h>
10-
10+
#import "PBGitRepository.h"
1111

1212
@interface PBCommand : NSObject {
13+
PBGitRepository *repository;
14+
1315
// for the user to see what it triggers
1416
NSString *displayName;
1517
// shown during command execution
1618
NSString *commandTitle;
1719
NSString *commandDescription;
1820

19-
NSArray *parameters;
21+
NSMutableArray *parameters;
22+
BOOL canBeFired;
2023
}
24+
@property (nonatomic) BOOL canBeFired;
25+
@property (nonatomic, retain, readonly) PBGitRepository *repository;
2126
@property (nonatomic, retain) NSString *commandTitle;
2227
@property (nonatomic, retain) NSString *commandDescription;
2328
@property (nonatomic, copy) NSString *displayName;
24-
@property (nonatomic, retain, readonly) NSArray *parameters;
2529

26-
- (id) initWithDisplayName:(NSString *) aDisplayName parameters:(NSArray *) params;
30+
- (id) initWithDisplayName:(NSString *) aDisplayName parameters:(NSArray *) params repository:(PBGitRepository *) repo;
31+
2732
- (void) invoke;
33+
34+
- (NSArray *) allParameters;
35+
- (void) appendParameters:(NSArray *) params;
2836
@end

Commands/PBCommand.m

+23-3
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,58 @@
77
//
88

99
#import "PBCommand.h"
10+
#import "PBRemoteProgressSheet.h"
1011

12+
@interface PBCommand()
13+
@property (nonatomic, retain) PBGitRepository *repository;
14+
@end
1115

1216
@implementation PBCommand
1317
@synthesize displayName;
14-
@synthesize parameters;
1518
@synthesize commandDescription;
1619
@synthesize commandTitle;
20+
@synthesize repository;
21+
@synthesize canBeFired;
1722

1823
- (id) initWithDisplayName:(NSString *) aDisplayName parameters:(NSArray *) params {
24+
return [self initWithDisplayName:aDisplayName parameters:params repository:nil];
25+
}
26+
27+
- (id) initWithDisplayName:(NSString *) aDisplayName parameters:(NSArray *) params repository:(PBGitRepository *) repo {
1928
self = [super init];
2029
if (self != nil) {
2130
self.displayName = aDisplayName;
22-
parameters = [params retain];
31+
parameters = [[NSMutableArray alloc] initWithArray:params];
2332

2433
// default values
2534
self.commandTitle = @"";
2635
self.commandDescription = @"";
36+
self.repository = repo;
37+
self.canBeFired = YES;
2738
}
2839
return self;
2940
}
3041

3142

3243
- (void) dealloc {
44+
[repository release];
3345
[commandDescription release];
3446
[commandTitle release];
3547
[parameters release];
3648
[displayName release];
3749
[super dealloc];
3850
}
3951

52+
- (NSArray *) allParameters {
53+
return parameters;
54+
}
55+
56+
- (void) appendParameters:(NSArray *) params {
57+
[parameters addObjectsFromArray:params];
58+
}
59+
4060
- (void) invoke {
41-
NSLog(@"Warning: Empty/abstrac command has been fired!");
61+
[PBRemoteProgressSheet beginRemoteProgressSheetForArguments:[self allParameters] title:self.commandTitle description:self.commandDescription inRepository:self.repository];
4262
}
4363

4464
@end

Commands/PBCommandWithParameter.h

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// PBCommandWithParameter.h
3+
// GitX
4+
//
5+
// Created by Tomasz Krasnyk on 10-11-06.
6+
// Copyright 2010 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import <Cocoa/Cocoa.h>
10+
#import "PBCommand.h"
11+
12+
13+
@interface PBCommandWithParameter : PBCommand {
14+
PBCommand *command;
15+
NSString *parameterName;
16+
NSString *parameterDisplayName;
17+
}
18+
@property (nonatomic, retain, readonly) PBCommand *command;
19+
@property (nonatomic, retain, readonly) NSString *parameterName;
20+
@property (nonatomic, retain, readonly) NSString *parameterDisplayName;
21+
22+
- initWithCommand:(PBCommand *) command parameterName:(NSString *) param parameterDisplayName:(NSString *) paramDisplayName;
23+
@end

Commands/PBCommandWithParameter.m

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//
2+
// PBCommandWithParameter.m
3+
// GitX
4+
//
5+
// Created by Tomasz Krasnyk on 10-11-06.
6+
// Copyright 2010 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import "PBCommandWithParameter.h"
10+
#import "PBArgumentPickerController.h"
11+
12+
13+
@implementation PBCommandWithParameter
14+
@synthesize command;
15+
@synthesize parameterName;
16+
@synthesize parameterDisplayName;
17+
18+
- initWithCommand:(PBCommand *) aCommand parameterName:(NSString *) param parameterDisplayName:(NSString *) paramDisplayName {
19+
if (self = [super initWithDisplayName:[aCommand displayName] parameters:nil repository:[aCommand repository]]) {
20+
command = [aCommand retain];
21+
parameterName = [param retain];
22+
parameterDisplayName = [paramDisplayName retain];
23+
}
24+
return self;
25+
}
26+
27+
- (void) dealloc {
28+
[command release];
29+
[parameterName release];
30+
[parameterDisplayName release];
31+
[super dealloc];
32+
}
33+
34+
35+
- (void) invoke {
36+
PBArgumentPickerController *controller = [[PBArgumentPickerController alloc] initWithCommandWithParameter:self];
37+
[NSApp beginSheet:[controller window] modalForWindow:[command.repository.windowController window] modalDelegate:controller didEndSelector:nil contextInfo:NULL];
38+
[controller release];
39+
}
40+
@end

Commands/PBOpenDocumentCommand.h

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// PBOpenDocumentCommand.h
3+
// GitX
4+
//
5+
// Created by Tomasz Krasnyk on 10-11-07.
6+
// Copyright 2010 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import <Cocoa/Cocoa.h>
10+
#import "PBCommand.h"
11+
12+
@interface PBOpenDocumentCommand : PBCommand {
13+
NSURL *documentURL;
14+
}
15+
16+
- (id) initWithDocumentAbsolutePath:(NSString *) path;
17+
@end

Commands/PBOpenDocumentCommand.m

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// PBOpenDocumentCommand.m
3+
// GitX
4+
//
5+
// Created by Tomasz Krasnyk on 10-11-07.
6+
// Copyright 2010 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import "PBOpenDocumentCommand.h"
10+
#import "PBRepositoryDocumentController.h"
11+
#import "PBGitRepository.h"
12+
13+
@implementation PBOpenDocumentCommand
14+
15+
- (id) initWithDocumentAbsolutePath:(NSString *) path {
16+
if (self = [super initWithDisplayName:@"Open" parameters:nil repository:nil]) {
17+
documentURL = [[NSURL alloc] initWithString:path];
18+
}
19+
return self;
20+
}
21+
22+
- (void) invoke {
23+
[[PBRepositoryDocumentController sharedDocumentController] documentForLocation:documentURL];
24+
}
25+
26+
@end

Commands/PBRemoteCommandFactory.h

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// PBRemoteCommandFactory.h
3+
// GitX
4+
//
5+
// Created by Tomasz Krasnyk on 10-11-07.
6+
// Copyright 2010 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import <Cocoa/Cocoa.h>
10+
#import "PBCommandFactory.h"
11+
12+
13+
@interface PBRemoteCommandFactory : NSObject<PBCommandFactory> {
14+
15+
}
16+
17+
@end

Commands/PBRemoteCommandFactory.m

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
//
2+
// PBRemoteCommandFactory.m
3+
// GitX
4+
//
5+
// Created by Tomasz Krasnyk on 10-11-07.
6+
// Copyright 2010 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import "PBRemoteCommandFactory.h"
10+
#import "PBOpenDocumentCommand.h"
11+
#import "PBGitSubmodule.h"
12+
#import "PBRevealWithFinderCommand.h"
13+
14+
15+
@implementation PBRemoteCommandFactory
16+
17+
+ (NSArray *) commandsForSubmodule:(PBGitSubmodule *) submodule inRepository:(PBGitRepository *) repository {
18+
NSMutableArray *commands = [[NSMutableArray alloc] init];
19+
20+
NSString *repoPath = [repository workingDirectory];
21+
NSString *path = [repoPath stringByAppendingPathComponent:[submodule path]];
22+
NSString *submodulePath = [submodule path];
23+
24+
if ([submodule submoduleState] == PBGitSubmoduleStateNotInitialized) {
25+
NSArray *params = [NSArray arrayWithObjects:@"submodule", @"init", submodulePath, nil];
26+
PBCommand *initCmd = [[PBCommand alloc] initWithDisplayName:@"Init" parameters:params repository:repository];
27+
initCmd.commandTitle = initCmd.displayName;
28+
initCmd.commandDescription = [NSString stringWithFormat:@"Initializing submodule %@", submodulePath];
29+
[commands addObject:initCmd];
30+
}
31+
32+
// update
33+
NSArray *params = [NSArray arrayWithObjects:@"submodule", @"update", submodulePath, nil];
34+
PBCommand *updateCmd = [[PBCommand alloc] initWithDisplayName:@"Update" parameters:params repository:repository];
35+
updateCmd.commandTitle = updateCmd.displayName;
36+
updateCmd.commandDescription = [NSString stringWithFormat:@"Updating submodule %@", submodulePath];
37+
[commands addObject:updateCmd];
38+
39+
if ([[submodule submodules] count] > 0) {
40+
// update recursively
41+
NSArray *recursiveUpdate = [NSArray arrayWithObjects:@"submodule", @"update", @"--recursive", submodulePath, nil];
42+
PBCommand *updateRecursively = [[PBCommand alloc] initWithDisplayName:@"Update recursively" parameters:recursiveUpdate repository:repository];
43+
updateRecursively.commandTitle = updateRecursively.displayName;
44+
updateRecursively.commandDescription = [NSString stringWithFormat:@"Updating submodule %@ (recursively)", submodulePath];
45+
[commands addObject:updateRecursively];
46+
}
47+
48+
if ([submodule submoduleState] != PBGitSubmoduleStateNotInitialized) {
49+
// open
50+
PBOpenDocumentCommand *command = [[PBOpenDocumentCommand alloc] initWithDocumentAbsolutePath:path];
51+
command.commandTitle = command.displayName;
52+
command.commandDescription = @"Opening document";
53+
[commands addObject:command];
54+
55+
[commands addObject:[[PBRevealWithFinderCommand alloc] initWithDocumentAbsolutePath:path]];
56+
}
57+
58+
return commands;
59+
}
60+
61+
+ (NSArray *) commandsForObject:(NSObject *) object repository:(PBGitRepository *) repository {
62+
if ([object isKindOfClass:[PBGitSubmodule class]]) {
63+
return [PBRemoteCommandFactory commandsForSubmodule:(id)object inRepository:repository];
64+
}
65+
return nil;
66+
}
67+
68+
@end

Commands/PBRevealWithFinderCommand.h

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// PBRevealWithFinder.h
3+
// GitX
4+
//
5+
// Created by Tomasz Krasnyk on 10-11-27.
6+
// Copyright 2010 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import <Cocoa/Cocoa.h>
10+
#import "PBOpenDocumentCommand.h"
11+
12+
@interface PBRevealWithFinderCommand : PBOpenDocumentCommand {
13+
14+
}
15+
16+
17+
@end

0 commit comments

Comments
 (0)