diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 98aafda08..e74e756b7 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -2,13 +2,13 @@ 1050 - 11C74 - 1938 - 1138.23 - 567.00 + 11D50 + 2182 + 1138.32 + 568.00 com.apple.InterfaceBuilder.CocoaPlugin - 1938 + 2182 YES @@ -680,7 +680,7 @@ YES - Create Tag + Create Tag… t 1048576 2147483647 @@ -689,7 +689,7 @@ - Create Branch + Create Branch… b 1048576 2147483647 @@ -698,7 +698,7 @@ - Add Remote + Add Remote… r 1572864 2147483647 @@ -2439,7 +2439,7 @@ 991.IBPluginDependency 992.IBPluginDependency - + YES com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2590,7 +2590,7 @@ showCloneRepository: showHelp: - + YES id id @@ -2613,7 +2613,7 @@ showCloneRepository: showHelp: - + YES installCliTool: @@ -2652,7 +2652,7 @@ firstResponder window - + YES id NSWindow @@ -2665,7 +2665,7 @@ firstResponder window - + YES firstResponder @@ -2693,7 +2693,7 @@ setRawView: setTreeView: - + YES id id @@ -2710,7 +2710,7 @@ setRawView: setTreeView: - + YES copySHA: @@ -2736,70 +2736,57 @@ - NSDocument - + PBCommitList + NSTableView + YES YES - printDocument: - revertDocumentToSaved: - runPageLayout: - saveDocument: - saveDocumentAs: - saveDocumentTo: + controller + searchController + webController + webView - + YES - id - id - id - id - id - id + PBGitHistoryController + PBHistorySearchController + PBWebHistoryController + WebView - + YES YES - printDocument: - revertDocumentToSaved: - runPageLayout: - saveDocument: - saveDocumentAs: - saveDocumentTo: + controller + searchController + webController + webView - + YES - - printDocument: - id - - - revertDocumentToSaved: - id - - - runPageLayout: - id + + controller + PBGitHistoryController - - saveDocument: - id + + searchController + PBHistorySearchController - - saveDocumentAs: - id + + webController + PBWebHistoryController - - saveDocumentTo: - id + + webView + WebView IBProjectSource - ./Classes/NSDocument.h + ./Classes/PBCommitList.h @@ -2812,7 +2799,7 @@ closeCreateBranchSheet: createBranch: - + YES id id @@ -2825,7 +2812,7 @@ closeCreateBranchSheet: createBranch: - + YES closeCreateBranchSheet: @@ -2844,7 +2831,7 @@ branchNameField errorMessageField - + YES NSTextField NSTextField @@ -2857,7 +2844,7 @@ branchNameField errorMessageField - + YES branchNameField @@ -2884,7 +2871,7 @@ closeCreateTagSheet: createTag: - + YES id id @@ -2897,7 +2884,7 @@ closeCreateTagSheet: createTag: - + YES closeCreateTagSheet: @@ -2917,7 +2904,7 @@ tagMessageText tagNameField - + YES NSTextField NSTextView @@ -2932,7 +2919,7 @@ tagMessageText tagNameField - + YES errorMessageField @@ -2965,7 +2952,7 @@ refresh: signOff: - + YES id id @@ -2982,7 +2969,7 @@ refresh: signOff: - + YES commit: @@ -3014,7 +3001,7 @@ unstagedFilesController webController - + YES NSArrayController NSButton @@ -3037,7 +3024,7 @@ unstagedFilesController webController - + YES cachedFilesController @@ -3098,7 +3085,7 @@ toggleQLPreviewPanel: updateSearch: - + YES id id @@ -3139,7 +3126,7 @@ toggleQLPreviewPanel: updateSearch: - + YES cherryPick: @@ -3207,6 +3194,52 @@ + + YES + + YES + commitController + historySplitView + refController + searchController + + + YES + NSArrayController + NSSplitView + PBRefController + PBHistorySearchController + + + + YES + + YES + commitController + historySplitView + refController + searchController + + + YES + + commitController + NSArrayController + + + historySplitView + NSSplitView + + + refController + PBRefController + + + searchController + PBHistorySearchController + + + IBProjectSource ./Classes/PBGitHistoryController.h @@ -3222,7 +3255,7 @@ rowClicked: tableClicked: - + YES NSCell NSTableView @@ -3235,7 +3268,7 @@ rowClicked: tableClicked: - + YES rowClicked: @@ -3257,7 +3290,7 @@ unstagedFilesController unstagedTable - + YES PBGitCommitController NSArrayController @@ -3276,7 +3309,7 @@ unstagedFilesController unstagedTable - + YES commitController @@ -3305,14 +3338,6 @@ ./Classes/PBGitIndexController.h - - PBGitRepository - NSDocument - - IBProjectSource - ./Classes/PBGitRepository.h - - PBGitWindowController NSWindowController @@ -3328,7 +3353,7 @@ showCommitView: showHistoryView: - + YES id id @@ -3351,7 +3376,7 @@ showCommitView: showHistoryView: - + YES changeLayout: @@ -3388,6 +3413,160 @@ ./Classes/PBGitWindowController.h + + PBHistorySearchController + NSObject + + YES + + YES + stepperPressed: + updateSearch: + + + YES + id + id + + + + YES + + YES + stepperPressed: + updateSearch: + + + YES + + stepperPressed: + id + + + updateSearch: + id + + + + + YES + + YES + commitController + historyController + numberOfMatchesField + progressIndicator + searchField + stepper + + + YES + NSArrayController + PBGitHistoryController + NSTextField + NSProgressIndicator + NSSearchField + NSSegmentedControl + + + + YES + + YES + commitController + historyController + numberOfMatchesField + progressIndicator + searchField + stepper + + + YES + + commitController + NSArrayController + + + historyController + PBGitHistoryController + + + numberOfMatchesField + NSTextField + + + progressIndicator + NSProgressIndicator + + + searchField + NSSearchField + + + stepper + NSSegmentedControl + + + + + IBProjectSource + ./Classes/PBHistorySearchController.h + + + + PBRefController + NSObject + + YES + + YES + branchPopUp + commitController + commitList + historyController + + + YES + NSPopUpButton + NSArrayController + PBCommitList + PBGitHistoryController + + + + YES + + YES + branchPopUp + commitController + commitList + historyController + + + YES + + branchPopUp + NSPopUpButton + + + commitController + NSArrayController + + + commitList + PBCommitList + + + historyController + PBGitHistoryController + + + + + IBProjectSource + ./Classes/PBRefController.h + + PBRepositoryDocumentController NSDocumentController @@ -3427,7 +3606,7 @@ indexController unstagedFilesController - + YES NSArrayController PBGitCommitController @@ -3444,7 +3623,7 @@ indexController unstagedFilesController - + YES cachedFilesController @@ -3469,39 +3648,37 @@ ./Classes/PBWebChangesController.h + + PBWebCommitController + PBWebController + + contextMenuDelegate + id + + + contextMenuDelegate + + contextMenuDelegate + id + + + + IBProjectSource + ./Classes/PBWebCommitController.h + + PBWebController NSObject - YES - - YES - repository - view - - - YES - PBGitRepository - WebView - + view + WebView - YES - - YES - repository - view - - - YES - - repository - PBGitRepository - - - view - WebView - + view + + view + WebView @@ -3509,6 +3686,25 @@ ./Classes/PBWebController.h + + PBWebHistoryController + PBWebCommitController + + historyController + PBGitHistoryController + + + historyController + + historyController + PBGitHistoryController + + + + IBProjectSource + ./Classes/PBWebHistoryController.h + + SUUpdater NSObject @@ -3539,24 +3735,6 @@ ./Classes/SUUpdater.h - - WebView - - reloadFromOrigin: - id - - - reloadFromOrigin: - - reloadFromOrigin: - id - - - - IBProjectSource - ./Classes/WebView.h - - 0 @@ -3578,10 +3756,10 @@ NSMenuCheckmark NSMenuMixedState - + YES - {9, 8} - {7, 2} + {11, 11} + {10, 3} diff --git a/English.lproj/PBCreateBranchSheet.xib b/English.lproj/PBCreateBranchSheet.xib index 270a7f179..4c5682a1e 100644 --- a/English.lproj/PBCreateBranchSheet.xib +++ b/English.lproj/PBCreateBranchSheet.xib @@ -2,13 +2,13 @@ 1070 - 11C74 - 1938 - 1138.23 - 567.00 + 11D50 + 2182 + 1138.32 + 568.00 com.apple.InterfaceBuilder.CocoaPlugin - 1938 + 2182 YES @@ -126,8 +126,9 @@ -1804468671 272630784 - topic + + Branch YES @@ -247,7 +248,7 @@ - {{0, 0}, {1920, 1058}} + {{0, 0}, {1680, 1028}} {480, 213} {2000, 213} YES @@ -500,7 +501,7 @@ 7.IBPluginDependency 8.IBPluginDependency - + YES com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -552,7 +553,7 @@ closeCreateBranchSheet: createBranch: - + YES id id @@ -565,7 +566,7 @@ closeCreateBranchSheet: createBranch: - + YES closeCreateBranchSheet: @@ -584,7 +585,7 @@ branchNameField errorMessageField - + YES NSTextField NSTextField @@ -597,7 +598,7 @@ branchNameField errorMessageField - + YES branchNameField diff --git a/English.lproj/PBCreateTagSheet.xib b/English.lproj/PBCreateTagSheet.xib index 00e4b74c4..6d345ca76 100644 --- a/English.lproj/PBCreateTagSheet.xib +++ b/English.lproj/PBCreateTagSheet.xib @@ -2,13 +2,13 @@ 1070 - 11C74 - 1938 - 1138.23 - 567.00 + 11D50 + 2182 + 1138.32 + 568.00 com.apple.InterfaceBuilder.CocoaPlugin - 1938 + 2182 YES @@ -17,6 +17,7 @@ NSWindowTemplate NSCustomObject NSScrollView + NSUserDefaultsController NSTextView NSButtonCell NSButton @@ -45,7 +46,7 @@ 9 2 - {{196, 233}, {462, 302}} + {{196, 233}, {462, 332}} 544736256 Window NSWindow @@ -60,7 +61,7 @@ 268 - {{17, 265}, {77, 17}} + {{17, 295}, {77, 17}} @@ -98,7 +99,7 @@ 268 - {{29, 229}, {71, 17}} + {{29, 259}, {71, 17}} @@ -120,7 +121,7 @@ 266 - {{105, 227}, {337, 22}} + {{105, 257}, {337, 22}} @@ -153,7 +154,7 @@ 268 - {{37, 197}, {63, 17}} + {{37, 227}, {63, 17}} @@ -239,7 +240,7 @@ NSBackgroundColor NSColor - + YES 6 @@ -264,7 +265,7 @@ NSCursor NSUnderline - + YES 1 @@ -327,7 +328,7 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA {{339, 1}, {15, 133}} - + _doScroller: 1 @@ -347,7 +348,7 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA 0.94565218687057495 - {{105, 84}, {337, 135}} + {{105, 114}, {337, 135}} @@ -424,7 +425,7 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA 268 - {{50, 182}, {46, 11}} + {{50, 212}, {46, 11}} @@ -443,17 +444,73 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA + + + 268 + {{103, 90}, {150, 18}} + + + + _NS:9 + YES + + 67239424 + 0 + Replace existing tag + + _NS:9 + + 1211912703 + 2 + + NSImage + NSSwitch + + + NSSwitch + + + + 200 + 25 + + + + + 268 + {{122, 72}, {278, 17}} + + + + YES + + 68288064 + 272761856 + (Not recommended if tag has already been pushed) + + LucidaGrande + 11 + 3100 + + + + + + - {462, 302} + {462, 332} - {{0, 0}, {1920, 1058}} + {{0, 0}, {1680, 1028}} {425, 299} {10000000000000, 10000000000000} YES + + YES + @@ -506,6 +563,30 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA 33 + + + replaceExistingCheckbox + + + + 40 + + + + value: replaceExisting + + + + + + value: replaceExisting + value + replaceExisting + 2 + + + 44 + @@ -559,6 +640,8 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA + + @@ -700,6 +783,39 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA + + 36 + + + YES + + + + + + 37 + + + + + 38 + + + YES + + + + + + 39 + + + + + 41 + + + @@ -728,13 +844,18 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA 26.IBPluginDependency 27.IBPluginDependency 3.IBPluginDependency + 36.IBPluginDependency + 37.IBPluginDependency + 38.IBPluginDependency + 39.IBPluginDependency 4.IBPluginDependency + 41.IBPluginDependency 5.IBPluginDependency 6.IBPluginDependency 7.IBPluginDependency 8.IBPluginDependency - + YES com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -763,6 +884,11 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin @@ -777,7 +903,7 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA - 33 + 44 @@ -792,7 +918,7 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA closeCreateTagSheet: createTag: - + YES id id @@ -805,7 +931,7 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA closeCreateTagSheet: createTag: - + YES closeCreateTagSheet: @@ -825,7 +951,7 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA tagMessageText tagNameField - + YES NSTextField NSTextView @@ -840,7 +966,7 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA tagMessageText tagNameField - + YES errorMessageField @@ -871,5 +997,9 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA YES 3 + + NSSwitch + {15, 15} + diff --git a/GLFileView.m b/GLFileView.m index 719bb43f3..a5185cbf1 100644 --- a/GLFileView.m +++ b/GLFileView.m @@ -550,6 +550,8 @@ - (NSString *) parseBlame:(NSString *)txt NSMutableDictionary *headers=[NSMutableDictionary dictionary]; NSMutableString *res=[NSMutableString string]; + NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] initWithDateFormat:@"%Y-%m-%d %H:%M:%S" allowNaturalLanguage:NO]; + [res appendString:@"\n"]; int i=0; while(i<[lines count]){ @@ -561,12 +563,32 @@ - (NSString *) parseBlame:(NSString *)txt [res appendFormat:@"\n",nLines]; line=[lines objectAtIndex:++i]; if([[[line componentsSeparatedByString:@" "] objectAtIndex:0] isEqual:@"author"]){ - NSString *author=[line stringByReplacingOccurrencesOfString:@"author" withString:@""]; + NSString *author=[line stringByReplacingOccurrencesOfString:@"author " withString:@""]; + + NSString *timestamp=nil; + while(timestamp==nil){ + line=[lines objectAtIndex:i++]; + if([[[line componentsSeparatedByString:@" "] objectAtIndex:0] isEqual:@"author-time"]){ + timestamp=[line stringByReplacingOccurrencesOfString:@"author-time " withString:@""]; + } + } + + NSString *timezone=nil; + while(timezone==nil){ + line=[lines objectAtIndex:i++]; + if([[[line componentsSeparatedByString:@" "] objectAtIndex:0] isEqual:@"author-tz"]){ + timezone=[line stringByReplacingOccurrencesOfString:@"author-tz " withString:@""]; + } + } + + NSDate *date = [NSDate dateWithTimeIntervalSince1970:[timestamp doubleValue]]; + NSString *dateString = [NSString stringWithFormat:@"%@ %@",[dateFormatter stringFromDate: date],timezone]; + NSString *summary=nil; while(summary==nil){ line=[lines objectAtIndex:i++]; if([[[line componentsSeparatedByString:@" "] objectAtIndex:0] isEqual:@"summary"]){ - summary=[line stringByReplacingOccurrencesOfString:@"summary" withString:@""]; + summary=[line stringByReplacingOccurrencesOfString:@"summary " withString:@""]; } } NSRange trunc_c={0,7}; @@ -583,7 +605,8 @@ - (NSString *) parseBlame:(NSString *)txt if([summary length]>30){ truncate_s=[summary substringWithRange:trunc]; } - NSString *block=[NSString stringWithFormat:@"\n\n

%@ %@

%@

\n",commitID,truncate_c,truncate_a,truncate_s]; + NSString *tooltip = [NSString stringWithFormat:@"%@\nAuthor: %@\nDate: %@\n\n%@",commitID,author,dateString,summary]; + NSString *block=[NSString stringWithFormat:@"

%@ %@

%@

\n",tooltip,commitID,truncate_c,truncate_a,truncate_s]; [headers setObject:block forKey:[header objectAtIndex:0]]; } [res appendString:[headers objectForKey:[header objectAtIndex:0]]]; @@ -703,7 +726,7 @@ - (NSString *)numberOfMatchesString - (void) updateSearch { - [view search:searchField update:YES direction:YES]; + [view search:searchField update:YES grabFocus:NO direction:YES]; [self updateSearchUI]; } @@ -725,7 +748,7 @@ - (IBAction)searchFieldChanged:(id)sender { BOOL update=[[searchField stringValue] isEqualToString:searchString]? NO: YES; searchString=[searchField stringValue]; - [view search:searchField update:update direction:YES]; + [view search:searchField update:update grabFocus:YES direction:YES]; [self updateSearchUI]; } @@ -734,9 +757,9 @@ - (IBAction)stepperPressed:(id)sender { NSInteger selectedSegment = [sender selectedSegment]; if (selectedSegment == 0) - [view search:searchField update:NO direction:NO]; + [view search:searchField update:NO grabFocus:YES direction:NO]; else - [view search:searchField update:NO direction:YES]; + [view search:searchField update:NO grabFocus:YES direction:YES]; } @end diff --git a/PBCreateTagSheet.h b/PBCreateTagSheet.h index 65e1f15ed..8175871a8 100644 --- a/PBCreateTagSheet.h +++ b/PBCreateTagSheet.h @@ -34,5 +34,6 @@ @property (strong) IBOutlet NSTextField *tagNameField; @property (strong) IBOutlet NSTextView *tagMessageText; @property (strong) IBOutlet NSTextField *errorMessageField; +@property (assign) BOOL replaceExisting; @end diff --git a/PBCreateTagSheet.m b/PBCreateTagSheet.m index a2a225a35..e487fef02 100644 --- a/PBCreateTagSheet.m +++ b/PBCreateTagSheet.m @@ -26,6 +26,7 @@ @implementation PBCreateTagSheet @synthesize tagNameField; @synthesize tagMessageText; @synthesize errorMessageField; +@synthesize replaceExisting; static PBCreateTagSheet *sheet; @@ -69,13 +70,13 @@ - (IBAction) createTag:(id)sender } NSString *refExistsReturnMessage; - if([self.repository refExists:ref checkOnRemotesWithoutBranches:NO resultMessage:&refExistsReturnMessage]) + if(!self.replaceExisting && [self.repository refExists:ref checkOnRemotesWithoutBranches:NO resultMessage:&refExistsReturnMessage]) { NSError *error = [NSError errorWithDomain:PBGitRepositoryErrorDomain code:0 userInfo:[NSDictionary dictionaryWithObjectsAndKeys: refExistsReturnMessage, NSLocalizedDescriptionKey, - @"Select other tagname.", NSLocalizedRecoverySuggestionErrorKey, + @"Enter another tag name.", NSLocalizedRecoverySuggestionErrorKey, nil] ]; [[NSAlert alertWithError:error]runModal]; @@ -89,7 +90,7 @@ - (IBAction) createTag:(id)sender defaultButton:@"Yes" alternateButton:@"No" otherButton:nil - informativeTextWithFormat:@"Still want to create the %@ %@?",[ref refishType],[ref shortName]] runModal]; + informativeTextWithFormat:@"Do you still want to create the %@ %@?",[ref refishType],[ref shortName]] runModal]; if (returnButton == NSAlertAlternateReturn) { @@ -101,7 +102,7 @@ - (IBAction) createTag:(id)sender [self closeCreateTagSheet:sender]; NSString *message = [self.tagMessageText string]; - [self.repository createTag:tagName message:message atRefish:self.targetRefish]; + [self.repository createTag:tagName message:message atRefish:self.targetRefish force:self.replaceExisting]; } diff --git a/PBGitRepository.h b/PBGitRepository.h index cd821b156..e55fc4d00 100644 --- a/PBGitRepository.h +++ b/PBGitRepository.h @@ -80,7 +80,7 @@ dispatch_queue_t PBGetWorkQueue(); - (BOOL) rebaseBranch:(id )branch onRefish:(id )upstream; - (BOOL) renameRef:(PBGitRef*)ref withNewName:(NSString *)newName; - (BOOL) createBranch:(NSString *)branchName atRefish:(id )ref; -- (BOOL) createTag:(NSString *)tagName message:(NSString *)message atRefish:(id )commitSHA; +- (BOOL) createTag:(NSString *)tagName message:(NSString *)message atRefish:(id )commitSHA force:(BOOL)force; - (BOOL) deleteRemote:(PBGitRef *)ref; - (BOOL) isRemoteConnected:(NSString*)remoteName; - (BOOL) deleteRemoteBranch:(PBGitRef *)ref; diff --git a/PBGitRepository.m b/PBGitRepository.m index d6d5027c7..f80ff1197 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -186,13 +186,13 @@ - (void) setup { config = [[PBGitConfig alloc] initWithRepositoryPath:[[self fileURL] path]]; self.branches = [NSMutableArray array]; - [self reloadRefs]; currentBranchFilter = [PBGitDefaults branchFilter]; revisionList = [[PBGitHistoryList alloc] initWithRepository:self]; - resetController = [[PBGitResetController alloc] initWithRepository:self]; stashController = [[PBStashController alloc] initWithRepository:self]; submoduleController = [[PBSubmoduleController alloc] initWithRepository:self]; + [self reloadRefs]; + [self readCurrentBranch]; } - (void)close @@ -614,7 +614,7 @@ - (BOOL)refExists:(PBGitRef *)ref checkOnRemotesWithoutBranches:(BOOL)remoteChec { if (result) { - *result = [NSString stringWithFormat:@"%@ exists already local as branch!",refShortName]; + *result = [NSString stringWithFormat:@"%@ already exists as local branch!",refShortName]; } return YES; } @@ -626,7 +626,7 @@ - (BOOL)refExists:(PBGitRef *)ref checkOnRemotesWithoutBranches:(BOOL)remoteChec { if (result) { - *result = [NSString stringWithFormat:@"%@ exists already local as tag!",refShortName]; + *result = [NSString stringWithFormat:@"%@ already exists as local tag!",refShortName]; } return YES; } @@ -637,7 +637,7 @@ - (BOOL)refExists:(PBGitRef *)ref checkOnRemotesWithoutBranches:(BOOL)remoteChec { if (result) { - *result = [NSString stringWithFormat:@"%@ exists already local as remotename!",refShortName]; + *result = [NSString stringWithFormat:@"%@ already exists as remote reference!",refShortName]; } return YES; } @@ -1257,8 +1257,8 @@ - (BOOL) cherryPickRefish:(id )ref NSArray *arguments = [NSArray arrayWithObjects:@"cherry-pick", refName, nil]; NSString *output = [self outputInWorkdirForArguments:arguments retValue:&retValue]; if (retValue) { - NSString *message = [NSString stringWithFormat:@"There was an error cherry picking the %@ '%@'.\n\nPerhaps your working directory is not clean?", [ref refishType], [ref shortName]]; - [self.windowController showErrorSheetTitle:@"Cherry pick failed!" message:message arguments:arguments output:output]; + NSString *message = [NSString stringWithFormat:@"There was an error cherry-picking the %@ '%@'.\n\nPerhaps your working directory is not clean?", [ref refishType], [ref shortName]]; + [self.windowController showErrorSheetTitle:@"Cherry-picking failed!" message:message arguments:arguments output:output]; return NO; } @@ -1284,7 +1284,7 @@ - (BOOL) rebaseBranch:(id )branch onRefish:(id )upstre if (branch) branchName = [NSString stringWithFormat:@"%@ '%@'", [branch refishType], [branch shortName]]; NSString *message = [NSString stringWithFormat:@"There was an error rebasing %@ with %@ '%@'.", branchName, [upstream refishType], [upstream shortName]]; - [self.windowController showErrorSheetTitle:@"Rebase failed!" message:message arguments:arguments output:output]; + [self.windowController showErrorSheetTitle:@"Rebasing failed!" message:message arguments:arguments output:output]; return NO; } @@ -1303,7 +1303,7 @@ - (BOOL) createBranch:(NSString *)branchName atRefish:(id )ref NSString *output = [self outputInWorkdirForArguments:arguments retValue:&retValue]; if (retValue) { NSString *message = [NSString stringWithFormat:@"There was an error creating the branch '%@' at %@ '%@'.", branchName, [ref refishType], [ref shortName]]; - [self.windowController showErrorSheetTitle:@"Create Branch failed!" message:message arguments:arguments output:output]; + [self.windowController showErrorSheetTitle:@"Branch creation failed!" message:message arguments:arguments output:output]; return NO; } @@ -1340,7 +1340,7 @@ - (BOOL) renameRef:(PBGitRef*)ref withNewName:(NSString *)newName; output = [self outputInWorkdirForArguments:arguments retValue:&gitRetValue]; if (gitRetValue) { NSString *message = [NSString stringWithFormat:@"There was an error renaming '%@ %@' to '%@'.", [ref refishType], [ref shortName], newName]; - [self.windowController showErrorSheetTitle:@"Rename failed!" message:message arguments:arguments output:output]; + [self.windowController showErrorSheetTitle:@"Renaming failed!" message:message arguments:arguments output:output]; retValue = NO; } @@ -1363,7 +1363,7 @@ - (BOOL) renameRef:(PBGitRef*)ref withNewName:(NSString *)newName; output = [self outputInWorkdirForArguments:arguments retValue:&gitRetValue]; if (gitRetValue) { NSString *message = [NSString stringWithFormat:@"There was an error checking out remotebranch %@ for renaming.", [ref shortName]]; - [self.windowController showErrorSheetTitle:@"Rename failed!" message:message arguments:arguments output:output]; + [self.windowController showErrorSheetTitle:@"Renaming failed!" message:message arguments:arguments output:output]; retValue = NO; } else @@ -1379,7 +1379,7 @@ - (BOOL) renameRef:(PBGitRef*)ref withNewName:(NSString *)newName; output = [self outputInWorkdirForArguments:arguments retValue:&gitRetValue]; if (gitRetValue) { NSString *message = [NSString stringWithFormat:@"There was an error creating the new local branch %@.", newName]; - [self.windowController showErrorSheetTitle:@"Rename failed!" message:message arguments:arguments output:output]; + [self.windowController showErrorSheetTitle:@"Renamining failed!" message:message arguments:arguments output:output]; retValue = NO; } } @@ -1391,7 +1391,7 @@ - (BOOL) renameRef:(PBGitRef*)ref withNewName:(NSString *)newName; output = [self outputInWorkdirForArguments:arguments retValue:&gitRetValue]; if (gitRetValue) { NSString *message = [NSString stringWithFormat:@"There was an error pushing the new local branch %@ to the remote %@.", newName, [ref remoteName]]; - [self.windowController showErrorSheetTitle:@"Rename failed!" message:message arguments:arguments output:output]; + [self.windowController showErrorSheetTitle:@"Renaming failed!" message:message arguments:arguments output:output]; retValue = NO; } } @@ -1408,7 +1408,7 @@ - (BOOL) renameRef:(PBGitRef*)ref withNewName:(NSString *)newName; output = [self outputInWorkdirForArguments:arguments retValue:&gitRetValue]; if (gitRetValue) { NSString *message = [NSString stringWithFormat:@"There was an error renaming %@ %@ to %@.", [ref refishType], [ref shortName], newName]; - [self.windowController showErrorSheetTitle:@"Rename failed!" message:message arguments:arguments output:output]; + [self.windowController showErrorSheetTitle:@"Renaming failed!" message:message arguments:arguments output:output]; retValue = NO; } } @@ -1419,7 +1419,7 @@ - (BOOL) renameRef:(PBGitRef*)ref withNewName:(NSString *)newName; output = [self outputInWorkdirForArguments:arguments retValue:&gitRetValue]; if (gitRetValue) { NSString *message = [NSString stringWithFormat:@"There was an error returning to Head %@.",actHeadSHA]; - [self.windowController showErrorSheetTitle:@"Rename failed!" message:message arguments:arguments output:output]; + [self.windowController showErrorSheetTitle:@"Renaming failed!" message:message arguments:arguments output:output]; retValue = NO; } } @@ -1428,7 +1428,7 @@ - (BOOL) renameRef:(PBGitRef*)ref withNewName:(NSString *)newName; return retValue; } -- (BOOL) createTag:(NSString *)tagName message:(NSString *)message atRefish:(id )target +- (BOOL) createTag:(NSString *)tagName message:(NSString *)message atRefish:(id )target force:(BOOL)force { if (!tagName) return NO; @@ -1441,6 +1441,10 @@ - (BOOL) createTag:(NSString *)tagName message:(NSString *)message atRefish:(id [arguments addObject:[@"-m" stringByAppendingString:message]]; } + if (force) { + [arguments addObject:@"-f"]; + } + [arguments addObject:tagName]; // if no refish then git will add it to HEAD @@ -1454,7 +1458,7 @@ - (BOOL) createTag:(NSString *)tagName message:(NSString *)message atRefish:(id if (target) targetName = [NSString stringWithFormat:@"%@ '%@'", [target refishType], [target shortName]]; NSString *message = [NSString stringWithFormat:@"There was an error creating the tag '%@' at %@.", tagName, targetName]; - [self.windowController showErrorSheetTitle:@"Create Tag failed!" message:message arguments:arguments output:output]; + [self.windowController showErrorSheetTitle:@"Tag creation failed!" message:message arguments:arguments output:output]; return NO; } diff --git a/PBGitSidebarController.h b/PBGitSidebarController.h index 22ec64494..4f3538bd5 100644 --- a/PBGitSidebarController.h +++ b/PBGitSidebarController.h @@ -46,7 +46,7 @@ - (void)setHistorySearch:(NSString *)searchString mode:(NSInteger)mode; --(NSNumber *)countCommintsOf:(NSString *)range; +-(NSNumber *)countCommitsOf:(NSString *)range; -(bool)remoteNeedFetch:(NSString *)remote; @property(strong, readonly) NSMutableArray *items; diff --git a/PBGitSidebarController.m b/PBGitSidebarController.m index 4fb44ad89..276f35157 100644 --- a/PBGitSidebarController.m +++ b/PBGitSidebarController.m @@ -84,6 +84,7 @@ - (void)awakeFromNib [sourceView setDoubleAction:@selector(outlineDoubleClicked)]; [sourceView setTarget:self]; + [self updateMetaDataForBranches]; } - (void)closeView @@ -162,21 +163,20 @@ - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:( for(PBGitSVRemoteItem* remote in [remotes children]){ [self performSelectorInBackground:@selector(evaluateRemoteBadge:) withObject:remote]; } - - [self updateMetaDataforBranches:branches]; + [self updateMetaDataForBranches]; }else{ [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } } --(void)updateMetaDataforBranches:(PBSourceViewItem *)theBranches +-(void)updateMetaDataForBranches:(PBSourceViewItem *)theBranches { for(PBGitSVBranchItem* branch in [theBranches children]){ if([branch isKindOfClass:[PBGitSVBranchItem class]]){ dispatch_async(PBGetWorkQueue(),^{ - id ahead = [self countCommintsOf:[NSString stringWithFormat:@"origin/%@..%@",branch.revSpecifier,branch.revSpecifier]]; - id behind = [self countCommintsOf:[NSString stringWithFormat:@"%@..origin/%@",branch.revSpecifier,branch.revSpecifier]]; + id ahead = [self countCommitsOf:[NSString stringWithFormat:@"origin/%@..%@",branch.revSpecifier,branch.revSpecifier]]; + id behind = [self countCommitsOf:[NSString stringWithFormat:@"%@..origin/%@",branch.revSpecifier,branch.revSpecifier]]; dispatch_async(dispatch_get_main_queue(),^{ [branch setAhead:ahead]; [branch setBehind:behind]; @@ -184,11 +184,15 @@ -(void)updateMetaDataforBranches:(PBSourceViewItem *)theBranches }); }); }else if ([branch isKindOfClass:[PBGitSVFolderItem class]]) { - [self updateMetaDataforBranches: branch]; + [self updateMetaDataForBranches: branch]; } } } +-(void)updateMetaDataForBranches +{ + [self updateMetaDataForBranches: branches]; +} #pragma mark Badges Methods @@ -205,7 +209,7 @@ -(void)evaluateRemoteBadge:(PBGitSVRemoteItem *)remote } } --(NSNumber *)countCommintsOf:(NSString *)range +-(NSNumber *)countCommitsOf:(NSString *)range { NSArray *args = [NSArray arrayWithObjects:@"rev-list", range, nil]; int ret; diff --git a/PBGitWindowController.m b/PBGitWindowController.m index 51ad6af1f..2730f0190 100644 --- a/PBGitWindowController.m +++ b/PBGitWindowController.m @@ -135,7 +135,6 @@ - (void) changeContentController:(PBViewController *)controller [self setNextResponder: contentController]; [[self window] makeFirstResponder:[contentController firstResponder]]; - [contentController updateView]; [contentController addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionInitial context:@"statusChange"]; } diff --git a/PBRefMenuItem.m b/PBRefMenuItem.m index 528875096..37ec8fc70 100644 --- a/PBRefMenuItem.m +++ b/PBRefMenuItem.m @@ -60,12 +60,12 @@ + (NSArray *) defaultMenuItemsForRef:(PBGitRef *)ref inRepository:(PBGitReposito [items addObject:[PBRefMenuItem itemWithTitle:checkoutTitle action:@selector(checkout:) enabled:!isHead]]; [items addObject:[PBRefMenuItem separatorItem]]; - NSString *resetTitle = [NSString stringWithFormat:@"Reset %@ to %@", headRefName, targetRefName]; + NSString *resetTitle = [NSString stringWithFormat:@"Reset %@ To %@…", headRefName, targetRefName]; [items addObject:[PBRefMenuItem itemWithTitle: resetTitle action:@selector(reset:) enabled:YES]]; [items addObject:[PBRefMenuItem separatorItem]]; // create branch - NSString *createBranchTitle = [ref isRemoteBranch] ? [NSString stringWithFormat:@"Create branch that tracks %@…", targetRefName] : @"Create branch…"; + 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 @@ -73,19 +73,19 @@ + (NSArray *) defaultMenuItemsForRef:(PBGitRef *)ref inRepository:(PBGitReposito // view tag info if ([ref isTag]) - [items addObject:[PBRefMenuItem itemWithTitle:@"View tag info…" action:@selector(showTagInfoSheet:) enabled:YES]]; + [items addObject:[PBRefMenuItem itemWithTitle:@"View Tag Info…" action:@selector(showTagInfoSheet:) enabled:YES]]; // Diff - NSString *diffTitle = [NSString stringWithFormat:@"Diff with %@", headRefName]; + NSString *diffTitle = [NSString stringWithFormat:@"Diff With %@", headRefName]; [items addObject:[PBRefMenuItem itemWithTitle:diffTitle action:@selector(diffWithHEAD:) enabled:!isHead]]; [items addObject:[PBRefMenuItem separatorItem]]; // merge ref - NSString *mergeTitle = isOnHeadBranch ? @"Merge" : [NSString stringWithFormat:@"Merge %@ into %@", targetRefName, headRefName]; + NSString *mergeTitle = isOnHeadBranch ? @"Merge" : [NSString stringWithFormat:@"Merge %@ Into %@", targetRefName, headRefName]; [items addObject:[PBRefMenuItem itemWithTitle:mergeTitle action:@selector(merge:) enabled:!isOnHeadBranch]]; // rebase - NSString *rebaseTitle = isOnHeadBranch ? @"Rebase" : [NSString stringWithFormat:@"Rebase %@ on %@", headRefName, targetRefName]; + NSString *rebaseTitle = isOnHeadBranch ? @"Rebase" : [NSString stringWithFormat:@"Rebase %@ On %@", headRefName, targetRefName]; [items addObject:[PBRefMenuItem itemWithTitle:rebaseTitle action:@selector(rebaseHeadBranch:) enabled:!isOnHeadBranch]]; [items addObject:[PBRefMenuItem separatorItem]]; @@ -96,13 +96,13 @@ + (NSArray *) defaultMenuItemsForRef:(PBGitRef *)ref inRepository:(PBGitReposito [items addObject:[PBRefMenuItem itemWithTitle:fetchTitle action:@selector(fetchRemote:) enabled:hasRemote]]; // pull - NSString *pullTitle = hasRemote ? [NSString stringWithFormat:@"Pull %@ and update %@", remoteName, headRefName] : @"Pull"; + NSString *pullTitle = hasRemote ? [NSString stringWithFormat:@"Pull %@ and Update %@", remoteName, headRefName] : @"Pull"; [items addObject:[PBRefMenuItem itemWithTitle:pullTitle action:@selector(pullRemote:) enabled:hasRemote]]; // push if (isRemote || [ref isRemoteBranch]) { // push updates to remote - NSString *pushTitle = [NSString stringWithFormat:@"Push updates to %@", remoteName]; + NSString *pushTitle = [NSString stringWithFormat:@"Push Updates To %@", remoteName]; [items addObject:[PBRefMenuItem itemWithTitle:pushTitle action:@selector(pushUpdatesToRemote:) enabled:YES]]; } else if (isDetachedHead) { @@ -113,14 +113,14 @@ + (NSArray *) defaultMenuItemsForRef:(PBGitRef *)ref inRepository:(PBGitReposito BOOL hasDefaultRemote = NO; if (![ref isTag] && hasRemote) { hasDefaultRemote = YES; - NSString *pushTitle = [NSString stringWithFormat:@"Push %@ to %@", targetRefName, remoteName]; + NSString *pushTitle = [NSString stringWithFormat:@"Push %@ To %@", targetRefName, remoteName]; [items addObject:[PBRefMenuItem itemWithTitle:pushTitle action:@selector(pushDefaultRemoteForRef:) enabled:YES]]; } // push to remotes submenu NSArray *remoteNames = [repo remotes]; if ([remoteNames count] && !(hasDefaultRemote && ([remoteNames count] == 1))) { - NSString *pushToTitle = [NSString stringWithFormat:@"Push %@ to", targetRefName]; + NSString *pushToTitle = [NSString stringWithFormat:@"Push %@ To", targetRefName]; PBRefMenuItem *pushToItem = [PBRefMenuItem itemWithTitle:pushToTitle action:nil enabled:YES]; NSMenu *remotesMenu = [[NSMenu alloc] initWithTitle:@"remotesMenu"]; for (NSString *remote in remoteNames) { @@ -172,7 +172,7 @@ + (NSArray *) defaultMenuItemsForCommit:(PBGitCommit *)commit target:(id)target [items addObject:[PBRefMenuItem itemWithTitle:@"Checkout Commit" action:@selector(checkout:) enabled:YES]]; [items addObject:[PBRefMenuItem separatorItem]]; - NSString *resetTitle = [NSString stringWithFormat:@"Reset %@ to here", headBranchName]; + NSString *resetTitle = [NSString stringWithFormat:@"Reset %@ to here…", headBranchName]; [items addObject:[PBRefMenuItem itemWithTitle: resetTitle action:@selector(reset:) enabled:YES]]; [items addObject:[PBRefMenuItem separatorItem]]; diff --git a/SearchWebView.h b/SearchWebView.h index 8083dd35e..d3d23f911 100644 --- a/SearchWebView.h +++ b/SearchWebView.h @@ -16,6 +16,6 @@ - (void)highlightAllOccurencesOfString:(NSString*)str direction:(BOOL)forward; - (void)highlightAllOccurencesOfString:(NSString*)str inNode:(DOMNode *)node; - (void)removeAllHighlights; -- (void)search:(NSSearchField *)sender update:(BOOL)update direction:(BOOL)forward; +- (void)search:(NSSearchField *)sender update:(BOOL)update grabFocus:(BOOL)grabFocus direction:(BOOL)forward; @end diff --git a/SearchWebView.m b/SearchWebView.m index 971ab5376..563545238 100644 --- a/SearchWebView.m +++ b/SearchWebView.m @@ -68,21 +68,26 @@ - (void)highlightAllOccurencesOfString:(NSString*)str update:(BOOL)update direct } } -- (void)search:(NSSearchField *)sender update:(BOOL)update direction:(BOOL)forward +- (void)search:(NSSearchField *)sender update:(BOOL)update grabFocus:(BOOL)grabFocus direction:(BOOL)forward { NSString *searchString = [sender stringValue]; DLog(@"searchString:%@",searchString); - - // Back-up the search field's caret position so we can restore it later - NSRange searchFieldSelectedRange = [[sender currentEditor] selectedRange]; + + NSRange searchFieldSelectedRange; + if (grabFocus) { + // Back-up the search field's caret position so we can restore it later + searchFieldSelectedRange = [[sender currentEditor] selectedRange]; + } if([searchString length]>0){ [self highlightAllOccurencesOfString:searchString update:update direction:forward]; - // Bring the search field back in focus and restore its caret position - [[sender window] makeFirstResponder:sender]; - [[sender currentEditor] setSelectedRange:searchFieldSelectedRange]; + if (grabFocus) { + // Bring the search field back in focus and restore its caret position + [[sender window] makeFirstResponder:sender]; + [[sender currentEditor] setSelectedRange:searchFieldSelectedRange]; + } if(result!=nil) { [self setSelectedDOMRange:result affinity:NSSelectionAffinityDownstream];