Skip to content

Commit

Permalink
merging krasnyk/stashes branch to soundevolution/svn
Browse files Browse the repository at this point in the history
Merge branch 'refs/heads/stashes' into testing

Conflicts:
	GitX.xcodeproj/project.pbxproj
	PBGitHistoryView.xib
	PBGitSidebarView.xib
  • Loading branch information
Adi Luhung Suryadi committed Jan 5, 2011
2 parents a3bba2e + 33e21e2 commit 13a4fd6
Show file tree
Hide file tree
Showing 88 changed files with 4,393 additions and 453 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,5 +1,6 @@
build
build/revision
._*
*.xcodeproj/
!*.xcodeproj/project.pbxproj
Nightly.app.zip
5 changes: 3 additions & 2 deletions ApplicationController.h
Expand Up @@ -32,7 +32,8 @@
- (IBAction)installCliTool:(id)sender;

- (IBAction)saveAction:sender;
- (IBAction) showHelp:(id) sender;
- (IBAction)showHelp:(id)sender;
- (IBAction)reportAProblem:(id)sender;

- (IBAction) showCloneRepository:(id)sender;
- (IBAction)showCloneRepository:(id)sender;
@end
46 changes: 41 additions & 5 deletions ApplicationController.m
Expand Up @@ -64,6 +64,7 @@ - (void)registerServices
- (void)applicationDidFinishLaunching:(NSNotification*)notification
{
[[SUUpdater sharedUpdater] setSendsSystemProfile:YES];
[[SUUpdater sharedUpdater] setDelegate:self];

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

- (IBAction) showHelp:(id) sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://gitx.frim.nl/user_manual.html"]];
}

- (NSString *)applicationSupportFolder {

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
Expand Down Expand Up @@ -380,4 +376,44 @@ - (void) dealloc {
[managedObjectModel release], managedObjectModel = nil;
[super dealloc];
}


#pragma mark Sparkle delegate methods

- (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile
{
NSArray *keys = [NSArray arrayWithObjects:@"key", @"displayKey", @"value", @"displayValue", nil];
NSMutableArray *feedParameters = [NSMutableArray array];

// only add parameters if the profile is being sent this time
if (sendingProfile) {
NSString *CFBundleGitVersion = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleGitVersion"];
if (CFBundleGitVersion)
[feedParameters addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"CFBundleGitVersion", @"Full Version", CFBundleGitVersion, CFBundleGitVersion, nil]
forKeys:keys]];

NSString *gitVersion = [PBGitBinary version];
if (gitVersion)
[feedParameters addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"gitVersion", @"git Version", gitVersion, gitVersion, nil]
forKeys:keys]];
}

return feedParameters;
}


#pragma mark Help menu

- (IBAction)showHelp:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://gitx.frim.nl/user_manual.html"]];
}

- (IBAction)reportAProblem:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://gitx.lighthouseapp.com/tickets"]];
}



@end
16 changes: 12 additions & 4 deletions Commands/PBCommand.h
Expand Up @@ -7,22 +7,30 @@
//

#import <Foundation/Foundation.h>

#import "PBGitRepository.h"

@interface PBCommand : NSObject {
PBGitRepository *repository;

// for the user to see what it triggers
NSString *displayName;
// shown during command execution
NSString *commandTitle;
NSString *commandDescription;

NSArray *parameters;
NSMutableArray *parameters;
BOOL canBeFired;
}
@property (nonatomic) BOOL canBeFired;
@property (nonatomic, retain, readonly) PBGitRepository *repository;
@property (nonatomic, retain) NSString *commandTitle;
@property (nonatomic, retain) NSString *commandDescription;
@property (nonatomic, copy) NSString *displayName;
@property (nonatomic, retain, readonly) NSArray *parameters;

- (id) initWithDisplayName:(NSString *) aDisplayName parameters:(NSArray *) params;
- (id) initWithDisplayName:(NSString *) aDisplayName parameters:(NSArray *) params repository:(PBGitRepository *) repo;

- (void) invoke;

- (NSArray *) allParameters;
- (void) appendParameters:(NSArray *) params;
@end
26 changes: 23 additions & 3 deletions Commands/PBCommand.m
Expand Up @@ -7,38 +7,58 @@
//

#import "PBCommand.h"
#import "PBRemoteProgressSheet.h"

@interface PBCommand()
@property (nonatomic, retain) PBGitRepository *repository;
@end

@implementation PBCommand
@synthesize displayName;
@synthesize parameters;
@synthesize commandDescription;
@synthesize commandTitle;
@synthesize repository;
@synthesize canBeFired;

- (id) initWithDisplayName:(NSString *) aDisplayName parameters:(NSArray *) params {
return [self initWithDisplayName:aDisplayName parameters:params repository:nil];
}

- (id) initWithDisplayName:(NSString *) aDisplayName parameters:(NSArray *) params repository:(PBGitRepository *) repo {
self = [super init];
if (self != nil) {
self.displayName = aDisplayName;
parameters = [params retain];
parameters = [[NSMutableArray alloc] initWithArray:params];

// default values
self.commandTitle = @"";
self.commandDescription = @"";
self.repository = repo;
self.canBeFired = YES;
}
return self;
}


- (void) dealloc {
[repository release];
[commandDescription release];
[commandTitle release];
[parameters release];
[displayName release];
[super dealloc];
}

- (NSArray *) allParameters {
return parameters;
}

- (void) appendParameters:(NSArray *) params {
[parameters addObjectsFromArray:params];
}

- (void) invoke {
NSLog(@"Warning: Empty/abstrac command has been fired!");
[PBRemoteProgressSheet beginRemoteProgressSheetForArguments:[self allParameters] title:self.commandTitle description:self.commandDescription inRepository:self.repository];
}

@end
23 changes: 23 additions & 0 deletions Commands/PBCommandWithParameter.h
@@ -0,0 +1,23 @@
//
// PBCommandWithParameter.h
// GitX
//
// Created by Tomasz Krasnyk on 10-11-06.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "PBCommand.h"


@interface PBCommandWithParameter : PBCommand {
PBCommand *command;
NSString *parameterName;
NSString *parameterDisplayName;
}
@property (nonatomic, retain, readonly) PBCommand *command;
@property (nonatomic, retain, readonly) NSString *parameterName;
@property (nonatomic, retain, readonly) NSString *parameterDisplayName;

- initWithCommand:(PBCommand *) command parameterName:(NSString *) param parameterDisplayName:(NSString *) paramDisplayName;
@end
40 changes: 40 additions & 0 deletions Commands/PBCommandWithParameter.m
@@ -0,0 +1,40 @@
//
// PBCommandWithParameter.m
// GitX
//
// Created by Tomasz Krasnyk on 10-11-06.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "PBCommandWithParameter.h"
#import "PBArgumentPickerController.h"


@implementation PBCommandWithParameter
@synthesize command;
@synthesize parameterName;
@synthesize parameterDisplayName;

- initWithCommand:(PBCommand *) aCommand parameterName:(NSString *) param parameterDisplayName:(NSString *) paramDisplayName {
if (self = [super initWithDisplayName:[aCommand displayName] parameters:nil repository:[aCommand repository]]) {
command = [aCommand retain];
parameterName = [param retain];
parameterDisplayName = [paramDisplayName retain];
}
return self;
}

- (void) dealloc {
[command release];
[parameterName release];
[parameterDisplayName release];
[super dealloc];
}


- (void) invoke {
PBArgumentPickerController *controller = [[PBArgumentPickerController alloc] initWithCommandWithParameter:self];
[NSApp beginSheet:[controller window] modalForWindow:[command.repository.windowController window] modalDelegate:controller didEndSelector:nil contextInfo:NULL];
[controller release];
}
@end
17 changes: 17 additions & 0 deletions Commands/PBOpenDocumentCommand.h
@@ -0,0 +1,17 @@
//
// PBOpenDocumentCommand.h
// GitX
//
// Created by Tomasz Krasnyk on 10-11-07.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "PBCommand.h"

@interface PBOpenDocumentCommand : PBCommand {
NSURL *documentURL;
}

- (id) initWithDocumentAbsolutePath:(NSString *) path;
@end
26 changes: 26 additions & 0 deletions Commands/PBOpenDocumentCommand.m
@@ -0,0 +1,26 @@
//
// PBOpenDocumentCommand.m
// GitX
//
// Created by Tomasz Krasnyk on 10-11-07.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "PBOpenDocumentCommand.h"
#import "PBRepositoryDocumentController.h"
#import "PBGitRepository.h"

@implementation PBOpenDocumentCommand

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

- (void) invoke {
[[PBRepositoryDocumentController sharedDocumentController] documentForLocation:documentURL];
}

@end
17 changes: 17 additions & 0 deletions Commands/PBRemoteCommandFactory.h
@@ -0,0 +1,17 @@
//
// PBRemoteCommandFactory.h
// GitX
//
// Created by Tomasz Krasnyk on 10-11-07.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "PBCommandFactory.h"


@interface PBRemoteCommandFactory : NSObject<PBCommandFactory> {

}

@end
68 changes: 68 additions & 0 deletions Commands/PBRemoteCommandFactory.m
@@ -0,0 +1,68 @@
//
// PBRemoteCommandFactory.m
// GitX
//
// Created by Tomasz Krasnyk on 10-11-07.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "PBRemoteCommandFactory.h"
#import "PBOpenDocumentCommand.h"
#import "PBGitSubmodule.h"
#import "PBRevealWithFinderCommand.h"


@implementation PBRemoteCommandFactory

+ (NSArray *) commandsForSubmodule:(PBGitSubmodule *) submodule inRepository:(PBGitRepository *) repository {
NSMutableArray *commands = [[NSMutableArray alloc] init];

NSString *repoPath = [repository workingDirectory];
NSString *path = [repoPath stringByAppendingPathComponent:[submodule path]];
NSString *submodulePath = [submodule path];

if ([submodule submoduleState] == PBGitSubmoduleStateNotInitialized) {
NSArray *params = [NSArray arrayWithObjects:@"submodule", @"init", submodulePath, nil];
PBCommand *initCmd = [[PBCommand alloc] initWithDisplayName:@"Init" parameters:params repository:repository];
initCmd.commandTitle = initCmd.displayName;
initCmd.commandDescription = [NSString stringWithFormat:@"Initializing submodule %@", submodulePath];
[commands addObject:initCmd];
}

// update
NSArray *params = [NSArray arrayWithObjects:@"submodule", @"update", submodulePath, nil];
PBCommand *updateCmd = [[PBCommand alloc] initWithDisplayName:@"Update" parameters:params repository:repository];
updateCmd.commandTitle = updateCmd.displayName;
updateCmd.commandDescription = [NSString stringWithFormat:@"Updating submodule %@", submodulePath];
[commands addObject:updateCmd];

if ([[submodule submodules] count] > 0) {
// update recursively
NSArray *recursiveUpdate = [NSArray arrayWithObjects:@"submodule", @"update", @"--recursive", submodulePath, nil];
PBCommand *updateRecursively = [[PBCommand alloc] initWithDisplayName:@"Update recursively" parameters:recursiveUpdate repository:repository];
updateRecursively.commandTitle = updateRecursively.displayName;
updateRecursively.commandDescription = [NSString stringWithFormat:@"Updating submodule %@ (recursively)", submodulePath];
[commands addObject:updateRecursively];
}

if ([submodule submoduleState] != PBGitSubmoduleStateNotInitialized) {
// open
PBOpenDocumentCommand *command = [[PBOpenDocumentCommand alloc] initWithDocumentAbsolutePath:path];
command.commandTitle = command.displayName;
command.commandDescription = @"Opening document";
[commands addObject:command];

[commands addObject:[[PBRevealWithFinderCommand alloc] initWithDocumentAbsolutePath:path]];
}

return commands;
}

+ (NSArray *) commandsForObject:(NSObject *) object repository:(PBGitRepository *) repository {
if ([object isKindOfClass:[PBGitSubmodule class]]) {
return [PBRemoteCommandFactory commandsForSubmodule:(id)object inRepository:repository];
}
return nil;
}

@end
17 changes: 17 additions & 0 deletions Commands/PBRevealWithFinderCommand.h
@@ -0,0 +1,17 @@
//
// PBRevealWithFinder.h
// GitX
//
// Created by Tomasz Krasnyk on 10-11-27.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "PBOpenDocumentCommand.h"

@interface PBRevealWithFinderCommand : PBOpenDocumentCommand {

}


@end

0 comments on commit 13a4fd6

Please sign in to comment.