Skip to content

Commit a3bba2e

Browse files
author
Adi Luhung Suryadi
committed
Merge commit '0a3b60066c0662c4097e2d1db22e95fb1080abb9' into testing
Conflicts: GitX.xcodeproj/project.pbxproj
2 parents 51d56b9 + 0a3b600 commit a3bba2e

20 files changed

+565
-11
lines changed

Commands/PBCommand.h

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//
2+
// PBCommand.h
3+
// GitX
4+
//
5+
// Created by Tomasz Krasnyk on 10-11-06.
6+
// Copyright 2010 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
12+
@interface PBCommand : NSObject {
13+
// for the user to see what it triggers
14+
NSString *displayName;
15+
// shown during command execution
16+
NSString *commandTitle;
17+
NSString *commandDescription;
18+
19+
NSArray *parameters;
20+
}
21+
@property (nonatomic, retain) NSString *commandTitle;
22+
@property (nonatomic, retain) NSString *commandDescription;
23+
@property (nonatomic, copy) NSString *displayName;
24+
@property (nonatomic, retain, readonly) NSArray *parameters;
25+
26+
- (id) initWithDisplayName:(NSString *) aDisplayName parameters:(NSArray *) params;
27+
- (void) invoke;
28+
@end

Commands/PBCommand.m

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// PBCommand.m
3+
// GitX
4+
//
5+
// Created by Tomasz Krasnyk on 10-11-06.
6+
// Copyright 2010 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import "PBCommand.h"
10+
11+
12+
@implementation PBCommand
13+
@synthesize displayName;
14+
@synthesize parameters;
15+
@synthesize commandDescription;
16+
@synthesize commandTitle;
17+
18+
- (id) initWithDisplayName:(NSString *) aDisplayName parameters:(NSArray *) params {
19+
self = [super init];
20+
if (self != nil) {
21+
self.displayName = aDisplayName;
22+
parameters = [params retain];
23+
24+
// default values
25+
self.commandTitle = @"";
26+
self.commandDescription = @"";
27+
}
28+
return self;
29+
}
30+
31+
32+
- (void) dealloc {
33+
[commandDescription release];
34+
[commandTitle release];
35+
[parameters release];
36+
[displayName release];
37+
[super dealloc];
38+
}
39+
40+
- (void) invoke {
41+
NSLog(@"Warning: Empty/abstrac command has been fired!");
42+
}
43+
44+
@end

Commands/PBCommandFactory.h

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// PBCommandFactory.h
3+
// GitX
4+
//
5+
// Created by Tomasz Krasnyk on 10-11-06.
6+
// Copyright 2010 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import "PBGitRepository.h"
10+
11+
@protocol PBCommandFactory
12+
+ (NSArray *) commandsForObject:(NSObject *) object repository:(PBGitRepository *) repository;
13+
@end

Commands/PBStashCommand.h

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// PBStashCommand.h
3+
// GitX
4+
//
5+
// Created by Tomasz Krasnyk on 10-11-06.
6+
// Copyright 2010 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
#import "PBCommand.h"
11+
#import "PBGitRepository.h"
12+
13+
@interface PBStashCommand : PBCommand {
14+
PBGitRepository *repository;
15+
NSArray *arguments;
16+
}
17+
18+
- initWithDisplayName:(NSString *) aDisplayName arguments:(NSArray *) args repository:(PBGitRepository *) repo;
19+
@end

Commands/PBStashCommand.m

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// PBStashCommand.m
3+
// GitX
4+
//
5+
// Created by Tomasz Krasnyk on 10-11-06.
6+
// Copyright 2010 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import "PBStashCommand.h"
10+
#import "PBRemoteProgressSheet.h"
11+
12+
@interface PBStashCommand()
13+
@property (nonatomic, retain) PBGitRepository *repository;
14+
@property (nonatomic, retain) NSArray *arguments;
15+
@end
16+
17+
18+
@implementation PBStashCommand
19+
@synthesize repository;
20+
@synthesize arguments;
21+
22+
- initWithDisplayName:(NSString *) aDisplayName arguments:(NSArray *) args repository:(PBGitRepository *) repo {
23+
if (self = [super initWithDisplayName:aDisplayName parameters:[NSArray arrayWithObject:@"stash"]]) {
24+
self.arguments = args;
25+
self.repository = repo;
26+
}
27+
return self;
28+
}
29+
30+
- (void) dealloc {
31+
[parameters release];
32+
[repository release];
33+
[super dealloc];
34+
}
35+
36+
37+
- (void) invoke {
38+
NSMutableArray *args = [[NSMutableArray alloc] initWithArray:super.parameters];
39+
[args addObjectsFromArray:self.arguments];
40+
[PBRemoteProgressSheet beginRemoteProgressSheetForArguments:args title:self.commandTitle description:self.commandDescription inRepository:self.repository];
41+
[args release];
42+
}
43+
44+
@end

Commands/PBStashCommandFactory.h

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

Commands/PBStashCommandFactory.m

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//
2+
// PBStashCommandFactory.m
3+
// GitX
4+
//
5+
// Created by Tomasz Krasnyk on 10-11-06.
6+
// Copyright 2010 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import "PBStashCommandFactory.h"
10+
#import "PBStashCommand.h"
11+
12+
// model
13+
#import "PBGitStash.h"
14+
15+
@implementation PBStashCommandFactory
16+
17+
+ (NSArray *) commandsForObject:(NSObject *) object repository:(PBGitRepository *) repository {
18+
if (![object isKindOfClass:[PBGitStash class]]) {
19+
return nil;
20+
}
21+
PBGitStash *stash = (PBGitStash *) object;
22+
NSMutableArray *commands = [[NSMutableArray alloc] init];
23+
24+
NSArray *args = [NSArray arrayWithObjects:@"apply", [stash name], nil];
25+
PBStashCommand *command = [[PBStashCommand alloc] initWithDisplayName:@"Apply" arguments:args repository:repository];
26+
command.commandTitle = command.displayName;
27+
command.commandDescription = [NSString stringWithFormat:@"Applying stash: '%@'", stash];
28+
[commands addObject:command];
29+
30+
args = [NSArray arrayWithObjects:@"pop", [stash name], nil];
31+
command = [[PBStashCommand alloc] initWithDisplayName:@"Pop" arguments:args repository:repository];
32+
command.commandTitle = command.displayName;
33+
command.commandDescription = [NSString stringWithFormat:@"Poping stash: '%@'", stash];
34+
[commands addObject:command];
35+
36+
args = [NSArray arrayWithObjects:@"drop", [stash name], nil];
37+
command = [[PBStashCommand alloc] initWithDisplayName:@"Drop" arguments:args repository:repository];
38+
command.commandTitle = command.displayName;
39+
command.commandDescription = [NSString stringWithFormat:@"Dropping stash: '%@'", stash];
40+
[commands addObject:command];
41+
42+
43+
return [commands autorelease];
44+
}
45+
46+
@end

GitX.xcodeproj/project.pbxproj

+67
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
02B41A5E123E307200DFC531 /* PBCommitHookFailedSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 02B41A5D123E307200DFC531 /* PBCommitHookFailedSheet.m */; };
2525
02B41A60123E307F00DFC531 /* PBCommitHookFailedSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 02B41A5F123E307F00DFC531 /* PBCommitHookFailedSheet.xib */; };
2626
056438B70ED0C40B00985397 /* DetailViewTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = 056438B60ED0C40B00985397 /* DetailViewTemplate.png */; };
27+
21230CB11284B26A0046E5A1 /* PBGitSVStashItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 21230CB01284B26A0046E5A1 /* PBGitSVStashItem.m */; };
28+
21230D351284C5080046E5A1 /* PBGitStash.m in Sources */ = {isa = PBXBuildFile; fileRef = 21230D341284C5080046E5A1 /* PBGitStash.m */; };
29+
21230D821284D1CC0046E5A1 /* stash-icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 21230D811284D1CC0046E5A1 /* stash-icon.png */; };
30+
21230D9C128552720046E5A1 /* PBCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 21230D9B128552720046E5A1 /* PBCommand.m */; };
31+
21230D9F128552FA0046E5A1 /* PBStashCommandFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 21230D9E128552FA0046E5A1 /* PBStashCommandFactory.m */; };
32+
21230DAA1285550B0046E5A1 /* PBCommandMenuItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 21230DA91285550B0046E5A1 /* PBCommandMenuItem.m */; };
33+
21230DEE12855A990046E5A1 /* PBStashCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 21230DED12855A990046E5A1 /* PBStashCommand.m */; };
2734
310DC1D81240599E0017A0F7 /* GLFileView.m in Sources */ = {isa = PBXBuildFile; fileRef = 310DC1D71240599E0017A0F7 /* GLFileView.m */; };
2835
31460CD2124185BA00B90AED /* MGRecessedPopUpButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 31460CA7124185BA00B90AED /* MGRecessedPopUpButtonCell.m */; };
2936
31460CD3124185BA00B90AED /* MGScopeBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 31460CA9124185BA00B90AED /* MGScopeBar.m */; };
@@ -251,6 +258,21 @@
251258
056438B60ED0C40B00985397 /* DetailViewTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = DetailViewTemplate.png; path = Images/DetailViewTemplate.png; sourceTree = "<group>"; };
252259
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
253260
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
261+
21230CAF1284B26A0046E5A1 /* PBGitSVStashItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitSVStashItem.h; sourceTree = "<group>"; };
262+
21230CB01284B26A0046E5A1 /* PBGitSVStashItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitSVStashItem.m; sourceTree = "<group>"; };
263+
21230D331284C5080046E5A1 /* PBGitStash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitStash.h; sourceTree = "<group>"; };
264+
21230D341284C5080046E5A1 /* PBGitStash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitStash.m; sourceTree = "<group>"; };
265+
21230D4D1284C92E0046E5A1 /* PBPresentable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBPresentable.h; sourceTree = "<group>"; };
266+
21230D811284D1CC0046E5A1 /* stash-icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "stash-icon.png"; sourceTree = "<group>"; };
267+
21230D9A128552720046E5A1 /* PBCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBCommand.h; sourceTree = "<group>"; };
268+
21230D9B128552720046E5A1 /* PBCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBCommand.m; sourceTree = "<group>"; };
269+
21230D9D128552FA0046E5A1 /* PBStashCommandFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBStashCommandFactory.h; sourceTree = "<group>"; };
270+
21230D9E128552FA0046E5A1 /* PBStashCommandFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBStashCommandFactory.m; sourceTree = "<group>"; };
271+
21230DA0128553120046E5A1 /* PBCommandFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBCommandFactory.h; sourceTree = "<group>"; };
272+
21230DA81285550B0046E5A1 /* PBCommandMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBCommandMenuItem.h; sourceTree = "<group>"; };
273+
21230DA91285550B0046E5A1 /* PBCommandMenuItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBCommandMenuItem.m; sourceTree = "<group>"; };
274+
21230DEC12855A990046E5A1 /* PBStashCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBStashCommand.h; sourceTree = "<group>"; };
275+
21230DED12855A990046E5A1 /* PBStashCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBStashCommand.m; sourceTree = "<group>"; };
254276
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
255277
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
256278
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
@@ -544,6 +566,8 @@
544566
080E96DDFE201D6D7F000001 /* Classes */ = {
545567
isa = PBXGroup;
546568
children = (
569+
21230D991285524C0046E5A1 /* Commands */,
570+
21230D321284C4F10046E5A1 /* Model */,
547571
);
548572
name = Classes;
549573
sourceTree = "<group>";
@@ -584,6 +608,30 @@
584608
name = Products;
585609
sourceTree = "<group>";
586610
};
611+
21230D321284C4F10046E5A1 /* Model */ = {
612+
isa = PBXGroup;
613+
children = (
614+
21230D331284C5080046E5A1 /* PBGitStash.h */,
615+
21230D341284C5080046E5A1 /* PBGitStash.m */,
616+
21230D4D1284C92E0046E5A1 /* PBPresentable.h */,
617+
);
618+
path = Model;
619+
sourceTree = "<group>";
620+
};
621+
21230D991285524C0046E5A1 /* Commands */ = {
622+
isa = PBXGroup;
623+
children = (
624+
21230D9A128552720046E5A1 /* PBCommand.h */,
625+
21230D9B128552720046E5A1 /* PBCommand.m */,
626+
21230DEC12855A990046E5A1 /* PBStashCommand.h */,
627+
21230DED12855A990046E5A1 /* PBStashCommand.m */,
628+
21230D9D128552FA0046E5A1 /* PBStashCommandFactory.h */,
629+
21230D9E128552FA0046E5A1 /* PBStashCommandFactory.m */,
630+
21230DA0128553120046E5A1 /* PBCommandFactory.h */,
631+
);
632+
path = Commands;
633+
sourceTree = "<group>";
634+
};
587635
29B97314FDCFA39411CA2CEA /* GitTest */ = {
588636
isa = PBXGroup;
589637
children = (
@@ -629,6 +677,7 @@
629677
F56ADDD70ED19F9E002AC78F /* AddBranchTemplate.png */,
630678
F56ADDD80ED19F9E002AC78F /* AddLabelTemplate.png */,
631679
056438B60ED0C40B00985397 /* DetailViewTemplate.png */,
680+
21230D811284D1CC0046E5A1 /* stash-icon.png */,
632681
F57240BA0E9678EA00D8EE66 /* deleted_file.png */,
633682
F5E92A1A0E88550E00056E75 /* empty_file.png */,
634683
32CA4F630368D1EE00C91783 /* GitX_Prefix.pch */,
@@ -786,6 +835,8 @@
786835
D8FDDA63114335E8005647F6 /* PBGitSVRemoteBranchItem.m */,
787836
D8FDDA68114335E8005647F6 /* PBGitSVTagItem.h */,
788837
D8FDDA69114335E8005647F6 /* PBGitSVTagItem.m */,
838+
21230CAF1284B26A0046E5A1 /* PBGitSVStashItem.h */,
839+
21230CB01284B26A0046E5A1 /* PBGitSVStashItem.m */,
789840
D8FDDA60114335E8005647F6 /* PBGitSVOtherRevItem.h */,
790841
D8FDDA61114335E8005647F6 /* PBGitSVOtherRevItem.m */,
791842
D8FDDA5E114335E8005647F6 /* PBGitSVFolderItem.h */,
@@ -982,6 +1033,8 @@
9821033
F5FC43C30EBD050800191D80 /* PBRefContextDelegate.h */,
9831034
F5FC43FC0EBD08EE00191D80 /* PBRefMenuItem.h */,
9841035
F5FC43FD0EBD08EE00191D80 /* PBRefMenuItem.m */,
1036+
21230DA81285550B0046E5A1 /* PBCommandMenuItem.h */,
1037+
21230DA91285550B0046E5A1 /* PBCommandMenuItem.m */,
9851038
);
9861039
name = History;
9871040
sourceTree = "<group>";
@@ -1158,7 +1211,14 @@
11581211
isa = PBXProject;
11591212
buildConfigurationList = 26FC0A880875C7B200E6366F /* Build configuration list for PBXProject "GitX" */;
11601213
compatibilityVersion = "Xcode 3.1";
1214+
developmentRegion = English;
11611215
hasScannedForEncodings = 1;
1216+
knownRegions = (
1217+
English,
1218+
Japanese,
1219+
French,
1220+
German,
1221+
);
11621222
mainGroup = 29B97314FDCFA39411CA2CEA /* GitTest */;
11631223
projectDirPath = "";
11641224
projectRoot = "";
@@ -1228,6 +1288,7 @@
12281288
31460CD5124185BA00B90AED /* Source Code License.rtf in Resources */,
12291289
31460CD6124185BA00B90AED /* TODO in Resources */,
12301290
02B41A60123E307F00DFC531 /* PBCommitHookFailedSheet.xib in Resources */,
1291+
21230D821284D1CC0046E5A1 /* stash-icon.png in Resources */,
12311292
);
12321293
runOnlyForDeploymentPostprocessing = 0;
12331294
};
@@ -1381,6 +1442,12 @@
13811442
31460CD2124185BA00B90AED /* MGRecessedPopUpButtonCell.m in Sources */,
13821443
31460CD3124185BA00B90AED /* MGScopeBar.m in Sources */,
13831444
02B41A5E123E307200DFC531 /* PBCommitHookFailedSheet.m in Sources */,
1445+
21230CB11284B26A0046E5A1 /* PBGitSVStashItem.m in Sources */,
1446+
21230D351284C5080046E5A1 /* PBGitStash.m in Sources */,
1447+
21230D9C128552720046E5A1 /* PBCommand.m in Sources */,
1448+
21230D9F128552FA0046E5A1 /* PBStashCommandFactory.m in Sources */,
1449+
21230DAA1285550B0046E5A1 /* PBCommandMenuItem.m in Sources */,
1450+
21230DEE12855A990046E5A1 /* PBStashCommand.m in Sources */,
13841451
);
13851452
runOnlyForDeploymentPostprocessing = 0;
13861453
};

Model/PBGitStash.h

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// PBGitStash.h
3+
// GitX
4+
//
5+
// Created by Tomasz Krasnyk on 10-11-06.
6+
// Copyright 2010 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
#import "PBPresentable.h"
11+
12+
@interface PBGitStash : NSObject<PBPresentable> {
13+
NSString *stashRawString;
14+
15+
NSString *stashSourceMessage;
16+
NSString *name;
17+
NSString *message;
18+
}
19+
@property (nonatomic, retain, readonly) NSString *name;
20+
@property (nonatomic, retain, readonly) NSString *message;
21+
@property (nonatomic, retain, readonly) NSString *stashSourceMessage;
22+
@property (nonatomic, retain, readonly) NSString *stashRawString;
23+
24+
- initWithRawStashLine:(NSString *) stashLineFromStashListOutput;
25+
@end

0 commit comments

Comments
 (0)