Pass on arguments from the command line to the revwalk mechanism

This commit is contained in:
Pieter de Bie
2008-09-08 20:22:14 +02:00
parent 68bf7621ed
commit 42e8196e1f
5 changed files with 29 additions and 1 deletions
+2 -1
View File
@@ -31,7 +31,8 @@
// work around an apparent bug with GC and Distributed Objects
// I am not familiar with GC though, so perhaps I was doing something wrong.
NSURL* url = [NSURL fileURLWithPath:[repositoryPath path]];
if (id document = [[PBRepositoryDocumentController sharedDocumentController] openDocumentWithContentsOfURL:url display:YES error:nil]) {
NSArray* arguments = [NSArray arrayWithArray:args];
if (id document = [[PBRepositoryDocumentController sharedDocumentController] openRepositoryAtLocation: url RevParseArgs: arguments]) {
[NSApp activateIgnoringOtherApps:YES];
return YES;
}
+2
View File
@@ -32,6 +32,8 @@ extern NSString* PBGitRepositoryErrorDomain;
+ (NSURL*)gitDirForURL:(NSURL*)repositoryURL;
+ (NSURL*)baseDirForURL:(NSURL*)repositoryURL;
- (id) initWithURL: (NSURL*) path andArguments:(NSArray*) array;
@property (readonly) PBGitRevList* revisionList;
@property (assign) NSArray* branches;
@property (assign) NSString* currentBranch;
+10
View File
@@ -125,6 +125,16 @@ static NSString* gitPath;
return success;
}
- (id) initWithURL: (NSURL*) path andArguments:(NSArray*) array
{
self = [self init];
NSURL* gitDirURL = [PBGitRepository gitDirForURL:path];
[self setFileURL: gitDirURL];
[self readRefs];
[self readCurrentBranch];
revisionList = [[PBGitRevList alloc] initWithRepository:self andRevListParameters:array];
return self;
}
// The fileURL the document keeps is to the .git dir, but thats pretty
// useless for display in the window title bar, so we show the directory above
- (NSString*)displayName
+1
View File
@@ -14,4 +14,5 @@
}
- (id) openRepositoryAtLocation:(NSURL*) url RevParseArgs:(NSArray*)args;
@end
+14
View File
@@ -29,4 +29,18 @@
{
[super noteNewRecentDocumentURL:[PBGitRepository baseDirForURL:url]];
}
- (id) openRepositoryAtLocation:(NSURL*) url RevParseArgs:(NSArray*)args
{
id document = [self documentForURL:url];
if (!document) {
document = [[PBGitRepository alloc] initWithURL:url andArguments:args];
[self addDocument:document];
[document makeWindowControllers];
} else {
// TODO: Add another revwalk specifier and show that.
}
[document showWindows];
return document;
}
@end