mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
merger brotherbard:experimetal
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
/* End PBXAggregateTarget section */
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
02B41A5E123E307200DFC531 /* PBCommitHookFailedSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 02B41A5D123E307200DFC531 /* PBCommitHookFailedSheet.m */; };
|
||||
02B41A60123E307F00DFC531 /* PBCommitHookFailedSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 02B41A5F123E307F00DFC531 /* PBCommitHookFailedSheet.xib */; };
|
||||
056438B70ED0C40B00985397 /* DetailViewTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = 056438B60ED0C40B00985397 /* DetailViewTemplate.png */; };
|
||||
310DC1D81240599E0017A0F7 /* GLFileView.m in Sources */ = {isa = PBXBuildFile; fileRef = 310DC1D71240599E0017A0F7 /* GLFileView.m */; };
|
||||
31460CD2124185BA00B90AED /* MGRecessedPopUpButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 31460CA7124185BA00B90AED /* MGRecessedPopUpButtonCell.m */; };
|
||||
@@ -243,6 +245,9 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
02B41A5C123E307200DFC531 /* PBCommitHookFailedSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBCommitHookFailedSheet.h; sourceTree = "<group>"; };
|
||||
02B41A5D123E307200DFC531 /* PBCommitHookFailedSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBCommitHookFailedSheet.m; sourceTree = "<group>"; };
|
||||
02B41A5F123E307F00DFC531 /* PBCommitHookFailedSheet.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PBCommitHookFailedSheet.xib; sourceTree = "<group>"; };
|
||||
056438B60ED0C40B00985397 /* DetailViewTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = DetailViewTemplate.png; path = Images/DetailViewTemplate.png; sourceTree = "<group>"; };
|
||||
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
|
||||
@@ -637,6 +642,7 @@
|
||||
29B97317FDCFA39411CA2CEA /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
02B41A5F123E307F00DFC531 /* PBCommitHookFailedSheet.xib */,
|
||||
F5F7D0641062E7940072C81C /* UpdateKey.pem */,
|
||||
F50A41130EBB872D00208746 /* Widgets */,
|
||||
47DBDB920E94F47200671A1E /* Preference Icons */,
|
||||
@@ -733,6 +739,8 @@
|
||||
D82F435F111B9C6D00A25A39 /* Sheets */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
02B41A5C123E307200DFC531 /* PBCommitHookFailedSheet.h */,
|
||||
02B41A5D123E307200DFC531 /* PBCommitHookFailedSheet.m */,
|
||||
D854948410D5C01B0083B917 /* PBCreateBranchSheet.h */,
|
||||
D854948510D5C01B0083B917 /* PBCreateBranchSheet.m */,
|
||||
D8E3B34B10DCA958001096A3 /* PBCreateTagSheet.h */,
|
||||
@@ -1219,6 +1227,7 @@
|
||||
31460CD4124185BA00B90AED /* ReadMe.txt in Resources */,
|
||||
31460CD5124185BA00B90AED /* Source Code License.rtf in Resources */,
|
||||
31460CD6124185BA00B90AED /* TODO in Resources */,
|
||||
02B41A60123E307F00DFC531 /* PBCommitHookFailedSheet.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -1371,6 +1380,7 @@
|
||||
310DC1D81240599E0017A0F7 /* GLFileView.m in Sources */,
|
||||
31460CD2124185BA00B90AED /* MGRecessedPopUpButtonCell.m in Sources */,
|
||||
31460CD3124185BA00B90AED /* MGScopeBar.m in Sources */,
|
||||
02B41A5E123E307200DFC531 /* PBCommitHookFailedSheet.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// PBCommitHookFailedSheet.h
|
||||
// GitX
|
||||
//
|
||||
// Created by Sebastian Staudt on 9/12/10.
|
||||
// Copyright 2010 Sebastian Staudt. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#import "PBGitCommitController.h"
|
||||
#import "PBGitXMessageSheet.h"
|
||||
|
||||
|
||||
@interface PBCommitHookFailedSheet : PBGitXMessageSheet
|
||||
{
|
||||
PBGitCommitController *commitController;
|
||||
}
|
||||
|
||||
+ (void)beginMessageSheetForWindow:(NSWindow *)parentWindow withMessageText:(NSString *)message infoText:(NSString *)info commitController:(PBGitCommitController *)controller;
|
||||
|
||||
- (id)initWithWindowNibName:(NSString *)windowNibName andController:(PBGitCommitController *)controller;
|
||||
- (IBAction)forceCommit:(id)sender;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// PBCommitHookFailedSheet.m
|
||||
// GitX
|
||||
//
|
||||
// Created by Sebastian Staudt on 9/12/10.
|
||||
// Copyright 2010 Sebastian Staudt. All rights reserved.
|
||||
//
|
||||
|
||||
#import "PBCommitHookFailedSheet.h"
|
||||
#import "PBGitWindowController.h"
|
||||
|
||||
|
||||
@implementation PBCommitHookFailedSheet
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark PBCommitHookFailedSheet
|
||||
|
||||
+ (void)beginMessageSheetForWindow:(NSWindow *)parentWindow withMessageText:(NSString *)message infoText:(NSString *)info commitController:(PBGitCommitController *)controller
|
||||
{
|
||||
PBCommitHookFailedSheet *sheet = [[self alloc] initWithWindowNibName:@"PBCommitHookFailedSheet" andController:controller];
|
||||
[sheet beginMessageSheetForWindow:parentWindow withMessageText:message infoText:info];
|
||||
}
|
||||
|
||||
- (id)initWithWindowNibName:(NSString *)windowNibName andController:(PBGitCommitController *)controller;
|
||||
{
|
||||
self = [self initWithWindowNibName:windowNibName];
|
||||
commitController = controller;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (IBAction)forceCommit:(id)sender
|
||||
{
|
||||
[self closeMessageSheet:self];
|
||||
[commitController forceCommit:sender];
|
||||
}
|
||||
|
||||
@end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -51,6 +51,16 @@
|
||||
[self.errorMessageField setStringValue:@""];
|
||||
self.shouldCheckoutBranch = [PBGitDefaults shouldCheckoutBranch];
|
||||
|
||||
// when creating a local branch tracking a remote branch preset the branch name to the name of the remote branch
|
||||
if ([self.startRefish refishType] == kGitXRemoteBranchType) {
|
||||
NSMutableArray *components = [[[self.startRefish shortName] componentsSeparatedByString:@"/"] mutableCopy];
|
||||
if ([components count] > 1) {
|
||||
[components removeObjectAtIndex:0];
|
||||
NSString *branchName = [components componentsJoinedByString:@"/"];
|
||||
[self.branchNameField setStringValue:branchName];
|
||||
}
|
||||
}
|
||||
|
||||
[NSApp beginSheet:[self window] modalForWindow:[self.repository.windowController window] modalDelegate:self didEndSelector:nil contextInfo:NULL];
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#import "PBDiffWindowController.h"
|
||||
#import "PBGitRepository.h"
|
||||
#import "PBGitCommit.h"
|
||||
#import "PBGitDefaults.h"
|
||||
|
||||
|
||||
@implementation PBDiffWindowController
|
||||
@@ -34,6 +35,10 @@
|
||||
|
||||
NSString *commitSelector = [NSString stringWithFormat:@"%@..%@", [startCommit realSha], [diffCommit realSha]];
|
||||
NSMutableArray *arguments = [NSMutableArray arrayWithObjects:@"diff", commitSelector, nil];
|
||||
|
||||
if (![PBGitDefaults showWhitespaceDifferences])
|
||||
[arguments insertObject:@"-w" atIndex:1];
|
||||
|
||||
if (filePaths) {
|
||||
[arguments addObject:@"--"];
|
||||
[arguments addObjectsFromArray:filePaths];
|
||||
|
||||
@@ -29,5 +29,6 @@
|
||||
|
||||
- (IBAction) refresh:(id) sender;
|
||||
- (IBAction) commit:(id) sender;
|
||||
- (IBAction) forceCommit:(id) sender;
|
||||
- (IBAction)signOff:(id)sender;
|
||||
@end
|
||||
|
||||
+23
-1
@@ -14,9 +14,11 @@
|
||||
|
||||
@interface PBGitCommitController ()
|
||||
- (void)refreshFinished:(NSNotification *)notification;
|
||||
- (void)commitWithVerification:(BOOL) doVerify;
|
||||
- (void)commitStatusUpdated:(NSNotification *)notification;
|
||||
- (void)commitFinished:(NSNotification *)notification;
|
||||
- (void)commitFailed:(NSNotification *)notification;
|
||||
- (void)commitHookFailed:(NSNotification *)notification;
|
||||
- (void)amendCommit:(NSNotification *)notification;
|
||||
- (void)indexChanged:(NSNotification *)notification;
|
||||
- (void)indexOperationFailed:(NSNotification *)notification;
|
||||
@@ -38,6 +40,7 @@
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(commitStatusUpdated:) name:PBGitIndexCommitStatus object:index];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(commitFinished:) name:PBGitIndexFinishedCommit object:index];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(commitFailed:) name:PBGitIndexCommitFailed object:index];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(commitHookFailed:) name:PBGitIndexCommitHookFailed object:index];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(amendCommit:) name:PBGitIndexAmendMessageAvailable object:index];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(indexChanged:) name:PBGitIndexIndexUpdated object:index];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(indexOperationFailed:) name:PBGitIndexOperationFailed object:index];
|
||||
@@ -106,6 +109,16 @@
|
||||
}
|
||||
|
||||
- (IBAction) commit:(id) sender
|
||||
{
|
||||
[self commitWithVerification:YES];
|
||||
}
|
||||
|
||||
- (IBAction) forceCommit:(id) sender
|
||||
{
|
||||
[self commitWithVerification:NO];
|
||||
}
|
||||
|
||||
- (void) commitWithVerification:(BOOL) doVerify
|
||||
{
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:[repository.fileURL.path stringByAppendingPathComponent:@"MERGE_HEAD"]]) {
|
||||
[[repository windowController] showMessageSheet:@"Cannot commit merges" infoText:@"GitX cannot commit merges yet. Please commit your changes from the command line."];
|
||||
@@ -129,7 +142,7 @@
|
||||
self.isBusy = YES;
|
||||
[commitMessageView setEditable:NO];
|
||||
|
||||
[index commitWithMessage:commitMessage];
|
||||
[index commitWithMessage:commitMessage andVerify:doVerify];
|
||||
}
|
||||
|
||||
|
||||
@@ -161,6 +174,15 @@
|
||||
[[repository windowController] showMessageSheet:@"Commit failed" infoText:reason];
|
||||
}
|
||||
|
||||
- (void)commitHookFailed:(NSNotification *)notification
|
||||
{
|
||||
self.isBusy = NO;
|
||||
NSString *reason = [[notification userInfo] objectForKey:@"description"];
|
||||
self.status = [@"Commit hook failed: " stringByAppendingString:reason];
|
||||
[commitMessageView setEditable:YES];
|
||||
[[repository windowController] showCommitHookFailedSheet:@"Commit hook failed" infoText:reason commitController:self];
|
||||
}
|
||||
|
||||
- (void)amendCommit:(NSNotification *)notification
|
||||
{
|
||||
// Replace commit message with the old one if it's less than 3 characters long.
|
||||
|
||||
@@ -672,10 +672,8 @@
|
||||
|
||||
- (IBAction) rebase:(id)sender
|
||||
{
|
||||
if (selectedCommit) {
|
||||
PBGitRef *headRef = [[repository headRef] ref];
|
||||
[repository rebaseBranch:headRef onRefish:selectedCommit];
|
||||
}
|
||||
if (selectedCommit)
|
||||
[repository rebaseBranch:nil onRefish:selectedCommit];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
+2
-1
@@ -26,6 +26,7 @@ extern NSString *PBGitIndexIndexUpdated;
|
||||
// Committing files
|
||||
extern NSString *PBGitIndexCommitStatus;
|
||||
extern NSString *PBGitIndexCommitFailed;
|
||||
extern NSString *PBGitIndexCommitHookFailed;
|
||||
extern NSString *PBGitIndexFinishedCommit;
|
||||
|
||||
// Changing to amend
|
||||
@@ -66,7 +67,7 @@ extern NSString *PBGitIndexOperationFailed;
|
||||
// Refresh the index
|
||||
- (void)refresh;
|
||||
|
||||
- (void)commitWithMessage:(NSString *)commitMessage;
|
||||
- (void)commitWithMessage:(NSString *)commitMessage andVerify:(BOOL) doVerify;
|
||||
|
||||
// Inter-file changes:
|
||||
- (BOOL)stageFiles:(NSArray *)stageFiles;
|
||||
|
||||
+30
-7
@@ -21,6 +21,7 @@ NSString *PBGitIndexIndexUpdated = @"GBGitIndexIndexUpdated";
|
||||
|
||||
NSString *PBGitIndexCommitStatus = @"PBGitIndexCommitStatus";
|
||||
NSString *PBGitIndexCommitFailed = @"PBGitIndexCommitFailed";
|
||||
NSString *PBGitIndexCommitHookFailed = @"PBGitIndexCommitHookFailed";
|
||||
NSString *PBGitIndexFinishedCommit = @"PBGitIndexFinishedCommit";
|
||||
|
||||
NSString *PBGitIndexAmendMessageAvailable = @"PBGitIndexAmendMessageAvailable";
|
||||
@@ -48,6 +49,7 @@ NSString *PBGitIndexOperationFailed = @"PBGitIndexOperationFailed";
|
||||
- (NSString *) parentTree;
|
||||
- (void)postCommitUpdate:(NSString *)update;
|
||||
- (void)postCommitFailure:(NSString *)reason;
|
||||
- (void)postCommitHookFailure:(NSString *)reason;
|
||||
- (void)postIndexChange;
|
||||
- (void)postOperationFailed:(NSString *)description;
|
||||
@end
|
||||
@@ -145,7 +147,7 @@ NSString *PBGitIndexOperationFailed = @"PBGitIndexOperationFailed";
|
||||
}
|
||||
|
||||
// TODO: make Asynchronous
|
||||
- (void)commitWithMessage:(NSString *)commitMessage
|
||||
- (void)commitWithMessage:(NSString *)commitMessage andVerify:(BOOL) doVerify
|
||||
{
|
||||
NSMutableString *commitSubject = [@"commit: " mutableCopy];
|
||||
NSRange newLine = [commitMessage rangeOfString:@"\n"];
|
||||
@@ -176,12 +178,26 @@ NSString *PBGitIndexOperationFailed = @"PBGitIndexOperationFailed";
|
||||
[self postCommitUpdate:@"Creating commit"];
|
||||
int ret = 1;
|
||||
|
||||
[self postCommitUpdate:@"Running hooks"];
|
||||
if (![repository executeHook:@"pre-commit" output:nil])
|
||||
return [self postCommitFailure:@"Pre-commit hook failed"];
|
||||
|
||||
if (![repository executeHook:@"commit-msg" withArgs:[NSArray arrayWithObject:commitMessageFile] output:nil])
|
||||
return [self postCommitFailure:@"Commit-msg hook failed"];
|
||||
if (doVerify) {
|
||||
[self postCommitUpdate:@"Running hooks"];
|
||||
NSString *hookFailureMessage = nil;
|
||||
NSString *hookOutput = nil;
|
||||
if (![repository executeHook:@"pre-commit" output:&hookOutput]) {
|
||||
hookFailureMessage = [NSString stringWithFormat:@"Pre-commit hook failed%@%@",
|
||||
[hookOutput length] > 0 ? @":\n" : @"",
|
||||
hookOutput];
|
||||
}
|
||||
|
||||
if (![repository executeHook:@"commit-msg" withArgs:[NSArray arrayWithObject:commitMessageFile] output:nil]) {
|
||||
hookFailureMessage = [NSString stringWithFormat:@"Commit-msg hook failed%@%@",
|
||||
[hookOutput length] > 0 ? @":\n" : @"",
|
||||
hookOutput];
|
||||
}
|
||||
|
||||
if (hookFailureMessage != nil) {
|
||||
return [self postCommitHookFailure:hookFailureMessage];
|
||||
}
|
||||
}
|
||||
|
||||
commitMessage = [NSString stringWithContentsOfFile:commitMessageFile encoding:NSUTF8StringEncoding error:nil];
|
||||
|
||||
@@ -242,6 +258,13 @@ NSString *PBGitIndexOperationFailed = @"PBGitIndexOperationFailed";
|
||||
userInfo:[NSDictionary dictionaryWithObject:reason forKey:@"description"]];
|
||||
}
|
||||
|
||||
- (void)postCommitHookFailure:(NSString *)reason
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:PBGitIndexCommitHookFailed
|
||||
object:self
|
||||
userInfo:[NSDictionary dictionaryWithObject:reason forKey:@"description"]];
|
||||
}
|
||||
|
||||
- (void)postOperationFailed:(NSString *)description
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:PBGitIndexOperationFailed
|
||||
|
||||
+18
-30
@@ -625,24 +625,7 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
|
||||
NSString *remoteName = [remoteRef remoteName];
|
||||
[arguments addObject:remoteName];
|
||||
|
||||
NSString *branchName = nil;
|
||||
NSString *refSpec = nil;
|
||||
if ([ref isRemoteBranch]) {
|
||||
branchName = [ref shortName];
|
||||
refSpec = [ref remoteBranchName];
|
||||
}
|
||||
else if ([ref isRemote] || !ref) {
|
||||
branchName = @"all tracking branches";
|
||||
}
|
||||
else {
|
||||
branchName = [ref shortName];
|
||||
refSpec = [NSString stringWithFormat:@"%@:%@", branchName, branchName];
|
||||
}
|
||||
if (refSpec)
|
||||
[arguments addObject:refSpec];
|
||||
|
||||
NSString *headRefName = [[[self headRef] ref] shortName];
|
||||
NSString *description = [NSString stringWithFormat:@"Pulling %@ from %@ and updating %@", branchName, remoteName, headRefName];
|
||||
NSString *description = [NSString stringWithFormat:@"Pulling all tracking branches from %@", remoteName];
|
||||
NSString *title = @"Pulling from remote";
|
||||
[PBRemoteProgressSheet beginRemoteProgressSheetForArguments:arguments title:title description:description inRepository:self];
|
||||
}
|
||||
@@ -905,7 +888,7 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
|
||||
|
||||
#pragma mark GitX Scripting
|
||||
|
||||
- (void)handleRevListArguments:(NSArray *)arguments
|
||||
- (void)handleRevListArguments:(NSArray *)arguments inWorkingDirectory:(NSURL *)workingDirectory
|
||||
{
|
||||
if (![arguments count])
|
||||
return;
|
||||
@@ -915,19 +898,23 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
|
||||
// the argument may be a branch or tag name but will probably not be the full reference
|
||||
if ([arguments count] == 1) {
|
||||
PBGitRef *refArgument = [self refForName:[arguments lastObject]];
|
||||
if (refArgument)
|
||||
if (refArgument) {
|
||||
revListSpecifier = [[PBGitRevSpecifier alloc] initWithRef:refArgument];
|
||||
revListSpecifier.workingDirectory = workingDirectory;
|
||||
}
|
||||
}
|
||||
|
||||
if (!revListSpecifier)
|
||||
if (!revListSpecifier) {
|
||||
revListSpecifier = [[PBGitRevSpecifier alloc] initWithParameters:arguments];
|
||||
revListSpecifier.workingDirectory = workingDirectory;
|
||||
}
|
||||
|
||||
self.currentBranch = [self addBranch:revListSpecifier];
|
||||
[PBGitDefaults setShowStageView:NO];
|
||||
[self.windowController showHistoryView:self];
|
||||
}
|
||||
|
||||
- (void)handleBranchFilterEventForFilter:(PBGitXBranchFilterType)filter additionalArguments:(NSMutableArray *)arguments
|
||||
- (void)handleBranchFilterEventForFilter:(PBGitXBranchFilterType)filter additionalArguments:(NSMutableArray *)arguments inWorkingDirectory:(NSURL *)workingDirectory
|
||||
{
|
||||
self.currentBranchFilter = filter;
|
||||
[PBGitDefaults setShowStageView:NO];
|
||||
@@ -936,11 +923,11 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
|
||||
// treat any additional arguments as a rev-list specifier
|
||||
if ([arguments count] > 1) {
|
||||
[arguments removeObjectAtIndex:0];
|
||||
[self handleRevListArguments:arguments];
|
||||
[self handleRevListArguments:arguments inWorkingDirectory:workingDirectory];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handleGitXScriptingArguments:(NSAppleEventDescriptor *)argumentsList
|
||||
- (void)handleGitXScriptingArguments:(NSAppleEventDescriptor *)argumentsList inWorkingDirectory:(NSURL *)workingDirectory
|
||||
{
|
||||
NSMutableArray *arguments = [NSMutableArray array];
|
||||
uint argumentsIndex = 1; // AppleEvent list descriptor's are one based
|
||||
@@ -964,22 +951,22 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
|
||||
}
|
||||
|
||||
if ([firstArgument isEqualToString:@"--all"]) {
|
||||
[self handleBranchFilterEventForFilter:kGitXAllBranchesFilter additionalArguments:arguments];
|
||||
[self handleBranchFilterEventForFilter:kGitXAllBranchesFilter additionalArguments:arguments inWorkingDirectory:workingDirectory];
|
||||
return;
|
||||
}
|
||||
|
||||
if ([firstArgument isEqualToString:@"--local"]) {
|
||||
[self handleBranchFilterEventForFilter:kGitXLocalRemoteBranchesFilter additionalArguments:arguments];
|
||||
[self handleBranchFilterEventForFilter:kGitXLocalRemoteBranchesFilter additionalArguments:arguments inWorkingDirectory:workingDirectory];
|
||||
return;
|
||||
}
|
||||
|
||||
if ([firstArgument isEqualToString:@"--branch"]) {
|
||||
[self handleBranchFilterEventForFilter:kGitXSelectedBranchFilter additionalArguments:arguments];
|
||||
[self handleBranchFilterEventForFilter:kGitXSelectedBranchFilter additionalArguments:arguments inWorkingDirectory:workingDirectory];
|
||||
return;
|
||||
}
|
||||
|
||||
// if the argument is not a known command then treat it as a rev-list specifier
|
||||
[self handleRevListArguments:arguments];
|
||||
[self handleRevListArguments:arguments inWorkingDirectory:workingDirectory];
|
||||
}
|
||||
|
||||
// see if the current appleEvent has the command line arguments from the gitx cli
|
||||
@@ -996,9 +983,10 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
|
||||
// on app launch there may be many repositories opening, so double check that this is the right repo
|
||||
NSString *path = [[eventRecord paramDescriptorForKeyword:typeFileURL] stringValue];
|
||||
if (path) {
|
||||
if ([[PBGitRepository gitDirForURL:[NSURL URLWithString:path]] isEqual:[self fileURL]]) {
|
||||
NSURL *workingDirectory = [NSURL URLWithString:path];
|
||||
if ([[PBGitRepository gitDirForURL:workingDirectory] isEqual:[self fileURL]]) {
|
||||
NSAppleEventDescriptor *argumentsList = [eventRecord paramDescriptorForKeyword:kGitXAEKeyArgumentsList];
|
||||
[self handleGitXScriptingArguments:argumentsList];
|
||||
[self handleGitXScriptingArguments:argumentsList inWorkingDirectory:workingDirectory];
|
||||
|
||||
// showWindows may be called more than once during app launch so remove the CLI data after we handle the event
|
||||
[currentAppleEvent removeDescriptorWithKeyword:keyAEPropData];
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ using namespace std;
|
||||
std::map<string, NSStringEncoding> encodingMap;
|
||||
NSThread *currentThread = [NSThread currentThread];
|
||||
|
||||
NSString *formatString = @"--pretty=format:%H\01%e\01%an\01%cn\01%s\01%P\01%at";
|
||||
NSString *formatString = @"--pretty=format:%H\01%e\01%aN\01%cN\01%s\01%P\01%at";
|
||||
BOOL showSign = [rev hasLeftRight];
|
||||
|
||||
if (showSign)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "PBGitRepository.h"
|
||||
|
||||
@class PBViewController, PBGitSidebarController;
|
||||
@class PBViewController, PBGitSidebarController, PBGitCommitController;
|
||||
|
||||
@interface PBGitWindowController : NSWindowController {
|
||||
__weak PBGitRepository* repository;
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
- (void)changeContentController:(PBViewController *)controller;
|
||||
|
||||
- (void)showCommitHookFailedSheet:(NSString *)messageText infoText:(NSString *)infoText commitController:(PBGitCommitController *)controller;
|
||||
- (void)showMessageSheet:(NSString *)messageText infoText:(NSString *)infoText;
|
||||
- (void)showErrorSheet:(NSError *)error;
|
||||
- (void)showErrorSheetTitle:(NSString *)title message:(NSString *)message arguments:(NSArray *)arguments output:(NSString *)output;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#import "PBGitCommitController.h"
|
||||
#import "Terminal.h"
|
||||
#import "PBCloneRepsitoryToSheet.h"
|
||||
#import "PBCommitHookFailedSheet.h"
|
||||
#import "PBGitXMessageSheet.h"
|
||||
#import "PBGitSidebarController.h"
|
||||
|
||||
@@ -109,6 +110,11 @@
|
||||
[sidebarController selectCurrentBranch];
|
||||
}
|
||||
|
||||
- (void)showCommitHookFailedSheet:(NSString *)messageText infoText:(NSString *)infoText commitController:(PBGitCommitController *)controller
|
||||
{
|
||||
[PBCommitHookFailedSheet beginMessageSheetForWindow:[self window] withMessageText:messageText infoText:infoText commitController:controller];
|
||||
}
|
||||
|
||||
- (void)showMessageSheet:(NSString *)messageText infoText:(NSString *)infoText
|
||||
{
|
||||
[PBGitXMessageSheet beginMessageSheetForWindow:[self window] withMessageText:messageText infoText:infoText];
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
+ (void)beginMessageSheetForWindow:(NSWindow *)parentWindow withError:(NSError *)error;
|
||||
|
||||
|
||||
- (void)beginMessageSheetForWindow:(NSWindow *)parentWindow withMessageText:(NSString *)message infoText:(NSString *)info;
|
||||
- (IBAction)closeMessageSheet:(id)sender;
|
||||
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
|
||||
@interface PBGitXMessageSheet ()
|
||||
|
||||
- (void)beginMessageSheetForWindow:(NSWindow *)parentWindow withMessageText:(NSString *)message infoText:(NSString *)info;
|
||||
|
||||
- (void)setInfoString:(NSString *)info;
|
||||
- (void)resizeWindow;
|
||||
|
||||
|
||||
+1
-2
@@ -147,9 +147,8 @@
|
||||
- (void) rebaseHeadBranch:(PBRefMenuItem *)sender
|
||||
{
|
||||
id <PBGitRefish> refish = [sender refish];
|
||||
PBGitRef *headRef = [[historyController.repository headRef] ref];
|
||||
|
||||
[historyController.repository rebaseBranch:headRef onRefish:refish];
|
||||
[historyController.repository rebaseBranch:nil onRefish:refish];
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -59,7 +59,8 @@
|
||||
[items addObject:[PBRefMenuItem separatorItem]];
|
||||
|
||||
// create branch
|
||||
[items addObject:[PBRefMenuItem itemWithTitle:@"Create branch…" action:@selector(createBranch:) enabled:YES]];
|
||||
NSString *createBranchTitle = [ref isRemoteBranch] ? [NSString stringWithFormat:@"Create branch that tracks %@…", targetRefName] : @"Create branch…";
|
||||
[items addObject:[PBRefMenuItem itemWithTitle:createBranchTitle action:@selector(createBranch:) enabled:YES]];
|
||||
|
||||
// create tag
|
||||
[items addObject:[PBRefMenuItem itemWithTitle:@"Create Tag…" action:@selector(createTag:) enabled:YES]];
|
||||
@@ -89,8 +90,7 @@
|
||||
[items addObject:[PBRefMenuItem itemWithTitle:fetchTitle action:@selector(fetchRemote:) enabled:hasRemote]];
|
||||
|
||||
// pull
|
||||
NSString *pullRemoteName = [ref isRemoteBranch] ? [ref shortName] : remoteName;
|
||||
NSString *pullTitle = hasRemote ? [NSString stringWithFormat:@"Pull %@ and update %@", pullRemoteName, headRefName] : @"Pull";
|
||||
NSString *pullTitle = hasRemote ? [NSString stringWithFormat:@"Pull %@ and update %@", remoteName, headRefName] : @"Pull";
|
||||
[items addObject:[PBRefMenuItem itemWithTitle:pullTitle action:@selector(pullRemote:) enabled:hasRemote]];
|
||||
|
||||
// push
|
||||
|
||||
@@ -120,9 +120,8 @@ void handleSTDINDiff()
|
||||
if (diff && [diff length] > 0) {
|
||||
GitXApplication *gitXApp = [SBApplication applicationWithBundleIdentifier:kGitXBundleIdentifier];
|
||||
[gitXApp showDiff:diff];
|
||||
exit(0);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void handleDiffWithArguments(NSURL *repositoryURL, NSMutableArray *arguments)
|
||||
|
||||
@@ -26,12 +26,21 @@ body {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#gist {
|
||||
-webkit-appearance: button;
|
||||
font: 13px bold 'Lucida Grande';
|
||||
width: 80px;
|
||||
height: 23px;
|
||||
margin-right: 5px;
|
||||
a.servicebutton {
|
||||
display: block;
|
||||
width: 80px;
|
||||
padding: 2px;
|
||||
margin-bottom: 4px;
|
||||
|
||||
border: 1px solid #3465a4;
|
||||
background-color: #cce5ff;
|
||||
color: #204a87;
|
||||
|
||||
font-size: 65%;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
|
||||
-webkit-border-radius: 2px;
|
||||
}
|
||||
|
||||
.gravatar {
|
||||
@@ -130,7 +139,7 @@ a.showdiff {
|
||||
font-size: 9px;
|
||||
font-family: Helvetica;
|
||||
border: 1px solid black;
|
||||
margin-right: 5px;
|
||||
margin-right: 2px;
|
||||
padding: 1px 3px 1px 3px;
|
||||
-webkit-border-radius: 2px;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ var showRefs = function() {
|
||||
refs.innerHTML = "";
|
||||
for (var i = 0; i < commit.refs.length; i++) {
|
||||
var ref = commit.refs[i];
|
||||
refs.innerHTML += '<span class="refs ' + ref.type() + (commit.currentRef == ref.ref ? ' currentBranch' : '') + '">' + ref.shortName() + '</span>';
|
||||
refs.innerHTML += '<span class="refs ' + ref.type() + (commit.currentRef == ref.ref ? ' currentBranch' : '') + '">' + ref.shortName() + '</span> ';
|
||||
}
|
||||
} else
|
||||
refs.parentNode.style.display = "none";
|
||||
@@ -219,6 +219,8 @@ var loadCommit = function(commitObject, currentRef) {
|
||||
|
||||
var showDiff = function() {
|
||||
|
||||
$("files").innerHTML = "";
|
||||
|
||||
// Callback for the diff highlighter. Used to generate a filelist
|
||||
var newfile = function(name1, name2, id, mode_change, old_mode, new_mode) {
|
||||
var img = document.createElement("img");
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
<body style="padding: 0px; border: 0px">
|
||||
<div id="rightcontent">
|
||||
<div id="buttons">
|
||||
<button id="gist" onClick="confirm_gist();return false" style="display:none">Gist it</button>
|
||||
<a class="servicebutton" id="gist" onclick="confirm_gist();return false" href="#">
|
||||
Gist it
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<table id="commit_header">
|
||||
|
||||
Reference in New Issue
Block a user