Let the gitx CLI use our RevSpecification

This commit is contained in:
Pieter de Bie
2008-09-12 17:56:42 +02:00
parent dea6a77d02
commit 3c7a22ef56
5 changed files with 14 additions and 10 deletions
+3 -1
View File
@@ -8,6 +8,7 @@
#import "PBCLIProxy.h"
#import "PBRepositoryDocumentController.h"
#import "PBGitRevSpecifier.h"
@implementation PBCLIProxy
@synthesize connection;
@@ -32,7 +33,8 @@
// I am not familiar with GC though, so perhaps I was doing something wrong.
NSURL* url = [NSURL fileURLWithPath:[repositoryPath path]];
NSArray* arguments = [NSArray arrayWithArray:args];
if (id document = [[PBRepositoryDocumentController sharedDocumentController] openRepositoryAtLocation: url RevParseArgs: arguments]) {
PBGitRevSpecifier* rev = [[PBGitRevSpecifier alloc] initWithParameters:arguments];
if (id document = [[PBRepositoryDocumentController sharedDocumentController] openRepositoryAtLocation: url RevSpecifier: rev]) {
[NSApp activateIgnoringOtherApps:YES];
return YES;
}
+1 -1
View File
@@ -35,7 +35,7 @@ extern NSString* PBGitRepositoryErrorDomain;
+ (NSURL*)gitDirForURL:(NSURL*)repositoryURL;
+ (NSURL*)baseDirForURL:(NSURL*)repositoryURL;
- (id) initWithURL: (NSURL*) path andArguments:(NSArray*) array;
- (id) initWithURL: (NSURL*) path andRevSpecifier:(PBGitRevSpecifier*) rev;
@property (retain) PBGitRevList* revisionList;
@property (assign) NSMutableArray* branches;
+4 -3
View File
@@ -126,14 +126,15 @@ static NSString* gitPath;
return success;
}
- (id) initWithURL: (NSURL*) path andArguments:(NSArray*) array
- (id) initWithURL: (NSURL*) path andRevSpecifier:(PBGitRevSpecifier*) rev
{
self = [self init];
NSURL* gitDirURL = [PBGitRepository gitDirForURL:path];
[self setFileURL: gitDirURL];
[self readRefs];
[self readCurrentBranch];
revisionList = [[PBGitRevList alloc] initWithRepository:self andRevListParameters:array];
[self addBranch: rev];
[self selectBranch: rev];
revisionList = [[PBGitRevList alloc] initWithRepository:self andRevListParameters: rev];
return self;
}
// The fileURL the document keeps is to the .git dir, but thats pretty
+2 -1
View File
@@ -7,6 +7,7 @@
//
#import <Cocoa/Cocoa.h>
#import "PBGitRevSpecifier.h"
@interface PBRepositoryDocumentController : NSDocumentController
@@ -14,5 +15,5 @@
}
- (id) openRepositoryAtLocation:(NSURL*) url RevParseArgs:(NSArray*)args;
- (id) openRepositoryAtLocation:(NSURL*) url RevSpecifier:(PBGitRevSpecifier*) rev;
@end
+4 -4
View File
@@ -31,16 +31,16 @@
[super noteNewRecentDocumentURL:[PBGitRepository baseDirForURL:url]];
}
- (id) openRepositoryAtLocation:(NSURL*) url RevParseArgs:(NSArray*)args
- (id) openRepositoryAtLocation:(NSURL*) url RevSpecifier:(PBGitRevSpecifier*) rev
{
id document = [self documentForURL:url];
if (!document) {
document = [[PBGitRepository alloc] initWithURL:url andArguments:args];
document = [[PBGitRepository alloc] initWithURL:url andRevSpecifier:rev];
[self addDocument:document];
[document makeWindowControllers];
} else {
// TODO: Use a more decent approach for this
[document setValue: [[PBGitRevList alloc] initWithRepository:document andRevListParameters: args] forKey:@"revisionList"];
[document addBranch: rev];
[document selectBranch: rev];
}
[document showWindows];
return document;