From d4cb11bb8b14707c87475e7e7fd4a98ef267f5a0 Mon Sep 17 00:00:00 2001 From: Marc Liyanage Date: Wed, 11 Aug 2010 23:42:37 -0700 Subject: [PATCH] Add "Copy SHA" alternate menu item to main menu, with default binding Cmd-Option-C. It copies just the leading 7 characters of the SHA instead of the whole commit info. --- English.lproj/MainMenu.xib | 1232 +++++++++++++++++++++++++++++++----- PBCommitList.m | 5 + PBGitHistoryController.h | 1 + PBGitHistoryController.m | 13 + 4 files changed, 1094 insertions(+), 157 deletions(-) diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index a70e278..df9ae8e 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -2,30 +2,25 @@ 1050 - 10C540 - 740 - 1038.25 - 458.00 + 10F569 + 804 + 1038.29 + 461.00 com.apple.InterfaceBuilder.CocoaPlugin - 740 + 804 YES - + YES com.apple.InterfaceBuilder.CocoaPlugin - YES - - YES - - - YES - + PluginDependencyRecalculationVersion + YES @@ -423,6 +418,16 @@ + + + YES + Copy SHA + c + 1572864 + 2147483647 + + + Paste @@ -1355,13 +1360,23 @@ 963 + + + copySHA: + + + + 966 + YES 0 - + + YES + @@ -1646,6 +1661,7 @@ + @@ -2058,6 +2074,11 @@ + + 964 + + + @@ -2258,6 +2279,8 @@ 951.IBPluginDependency 954.IBPluginDependency 956.IBPluginDependency + 964.IBPluginDependency + 964.ImportedFromIB2 YES @@ -2326,7 +2349,7 @@ com.apple.InterfaceBuilder.CocoaPlugin - {{522, 787}, {240, 243}} + {{522, 767}, {240, 263}} com.apple.InterfaceBuilder.CocoaPlugin {{455, 493}, {243, 243}} @@ -2455,6 +2478,8 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + @@ -2473,7 +2498,7 @@ - 963 + 966 @@ -2502,6 +2527,45 @@ id + + YES + + YES + installCliTool: + openPreferencesWindow: + saveAction: + showAboutPanel: + showCloneRepository: + showHelp: + + + YES + + installCliTool: + id + + + openPreferencesWindow: + id + + + saveAction: + id + + + showAboutPanel: + id + + + showCloneRepository: + id + + + showHelp: + id + + + YES @@ -2515,6 +2579,25 @@ NSWindow + + YES + + YES + firstResponder + window + + + YES + + firstResponder + id + + + window + NSWindow + + + IBProjectSource ApplicationController.h @@ -2535,6 +2618,7 @@ YES YES + copySHA: setDetailedView: setRawView: setTreeView: @@ -2544,6 +2628,36 @@ id id id + id + + + + YES + + YES + copySHA: + setDetailedView: + setRawView: + setTreeView: + + + YES + + copySHA: + id + + + setDetailedView: + id + + + setRawView: + id + + + setTreeView: + id + @@ -2584,6 +2698,30 @@ WebView + + YES + + YES + controller + webController + webView + + + YES + + controller + PBGitHistoryController + + + webController + PBWebHistoryController + + + webView + WebView + + + IBProjectSource PBCommitList.h @@ -2605,6 +2743,25 @@ id + + YES + + YES + closeCreateBranchSheet: + createBranch: + + + YES + + closeCreateBranchSheet: + id + + + createBranch: + id + + + YES @@ -2620,6 +2777,30 @@ id + + YES + + YES + branchNameField + errorMessageField + startRefish + + + YES + + branchNameField + NSTextField + + + errorMessageField + NSTextField + + + startRefish + id + + + IBProjectSource PBCreateBranchSheet.h @@ -2641,6 +2822,25 @@ id + + YES + + YES + closeCreateTagSheet: + createTag: + + + YES + + closeCreateTagSheet: + id + + + createTag: + id + + + YES @@ -2658,6 +2858,35 @@ id + + YES + + YES + errorMessageField + tagMessageText + tagNameField + targetRefish + + + YES + + errorMessageField + NSTextField + + + tagMessageText + NSTextView + + + tagNameField + NSTextField + + + targetRefish + id + + + IBProjectSource PBCreateTagSheet.h @@ -2681,6 +2910,30 @@ id + + YES + + YES + commit: + refresh: + signOff: + + + YES + + commit: + id + + + refresh: + id + + + signOff: + id + + + YES @@ -2702,6 +2955,45 @@ PBWebChangesController + + YES + + YES + cachedFilesController + commitButton + commitMessageView + indexController + unstagedFilesController + webController + + + YES + + cachedFilesController + NSArrayController + + + commitButton + NSButton + + + commitMessageView + NSTextView + + + indexController + PBGitIndexController + + + unstagedFilesController + NSArrayController + + + webController + PBWebChangesController + + + IBProjectSource PBGitCommitController.h @@ -2757,6 +3049,90 @@ id + + YES + + YES + cherryPick: + createBranch: + createTag: + merge: + openFilesAction: + openSelectedFile: + rebase: + refresh: + setBranchFilter: + setDetailedView: + setTreeView: + showAddRemoteSheet: + showCommitsFromTree: + showInFinderAction: + toggleQLPreviewPanel: + + + YES + + cherryPick: + id + + + createBranch: + id + + + createTag: + id + + + merge: + id + + + openFilesAction: + id + + + openSelectedFile: + id + + + rebase: + id + + + refresh: + id + + + setBranchFilter: + id + + + setDetailedView: + id + + + setTreeView: + id + + + showAddRemoteSheet: + id + + + showCommitsFromTree: + id + + + showInFinderAction: + id + + + toggleQLPreviewPanel: + id + + + YES @@ -2776,6 +3152,7 @@ selectedBranchFilterItem treeController upperToolbarView + webHistoryController webView @@ -2783,7 +3160,7 @@ NSButton NSButton NSArrayController - NSTableView + PBCommitList NSOutlineView PBCollapsibleSplitView NSButton @@ -2795,9 +3172,104 @@ NSButton NSTreeController PBGitGradientBarView + PBWebHistoryController id + + YES + + YES + allBranchesFilterItem + cherryPickButton + commitController + commitList + fileBrowser + historySplitView + localRemoteBranchesFilterItem + mergeButton + rebaseButton + refController + scopeBarView + searchField + selectedBranchFilterItem + treeController + upperToolbarView + webHistoryController + webView + + + YES + + allBranchesFilterItem + NSButton + + + cherryPickButton + NSButton + + + commitController + NSArrayController + + + commitList + PBCommitList + + + fileBrowser + NSOutlineView + + + historySplitView + PBCollapsibleSplitView + + + localRemoteBranchesFilterItem + NSButton + + + mergeButton + NSButton + + + rebaseButton + NSButton + + + refController + PBRefController + + + scopeBarView + PBGitGradientBarView + + + searchField + NSSearchField + + + selectedBranchFilterItem + NSButton + + + treeController + NSTreeController + + + upperToolbarView + PBGitGradientBarView + + + webHistoryController + PBWebHistoryController + + + webView + id + + + IBProjectSource PBGitHistoryController.h @@ -2819,6 +3291,25 @@ NSTableView + + YES + + YES + rowClicked: + tableClicked: + + + YES + + rowClicked: + NSCell + + + tableClicked: + NSTableView + + + YES @@ -2838,6 +3329,40 @@ NSTableView + + YES + + YES + commitController + stagedFilesController + stagedTable + unstagedFilesController + unstagedTable + + + YES + + commitController + PBGitCommitController + + + stagedFilesController + NSArrayController + + + stagedTable + NSTableView + + + unstagedFilesController + NSArrayController + + + unstagedTable + NSTableView + + + IBProjectSource PBGitIndexController.h @@ -2867,6 +3392,45 @@ id + + YES + + YES + cloneTo: + openInTerminal: + refresh: + revealInFinder: + showCommitView: + showHistoryView: + + + YES + + cloneTo: + id + + + openInTerminal: + id + + + refresh: + id + + + revealInFinder: + id + + + showCommitView: + id + + + showHistoryView: + id + + + YES @@ -2892,6 +3456,55 @@ NSToolbarItem + + YES + + YES + contentSplitView + finderItem + progressIndicator + sourceListControlsView + sourceSplitView + splitView + statusField + terminalItem + + + YES + + contentSplitView + NSView + + + finderItem + NSToolbarItem + + + progressIndicator + NSProgressIndicator + + + sourceListControlsView + NSView + + + sourceSplitView + NSView + + + splitView + NSSplitView + + + statusField + NSTextField + + + terminalItem + NSToolbarItem + + + IBProjectSource PBGitWindowController.h @@ -2919,6 +3532,40 @@ id + + YES + + YES + openSelectedFile: + setDetailedView: + setRawView: + setTreeView: + toggleQuickView: + + + YES + + openSelectedFile: + id + + + setDetailedView: + id + + + setRawView: + id + + + setTreeView: + id + + + toggleQuickView: + id + + + YES @@ -2936,6 +3583,35 @@ NSTreeController + + YES + + YES + commitController + commitList + fileBrowser + treeController + + + YES + + commitController + NSArrayController + + + commitList + NSTableView + + + fileBrowser + NSOutlineView + + + treeController + NSTreeController + + + IBUserSource @@ -2991,6 +3667,90 @@ PBRefMenuItem + + YES + + YES + checkout: + cherryPick: + copyPatch: + copySHA: + createBranch: + createTag: + diffWithHEAD: + fetchRemote: + merge: + pullRemote: + pushDefaultRemoteForRef: + pushToRemote: + pushUpdatesToRemote: + rebaseHeadBranch: + showTagInfoSheet: + + + YES + + checkout: + PBRefMenuItem + + + cherryPick: + PBRefMenuItem + + + copyPatch: + PBRefMenuItem + + + copySHA: + PBRefMenuItem + + + createBranch: + PBRefMenuItem + + + createTag: + PBRefMenuItem + + + diffWithHEAD: + PBRefMenuItem + + + fetchRemote: + PBRefMenuItem + + + merge: + PBRefMenuItem + + + pullRemote: + PBRefMenuItem + + + pushDefaultRemoteForRef: + PBRefMenuItem + + + pushToRemote: + PBRefMenuItem + + + pushUpdatesToRemote: + PBRefMenuItem + + + rebaseHeadBranch: + PBRefMenuItem + + + showTagInfoSheet: + PBRefMenuItem + + + YES @@ -2999,9 +3759,6 @@ commitController commitList historyController - pullItem - pushItem - rebaseItem YES @@ -3009,9 +3766,35 @@ NSArrayController PBCommitList PBGitHistoryController - KBPopUpToolbarItem - KBPopUpToolbarItem - KBPopUpToolbarItem + + + + YES + + YES + branchPopUp + commitController + commitList + historyController + + + YES + + branchPopUp + NSPopUpButton + + + commitController + NSArrayController + + + commitList + PBCommitList + + + historyController + PBGitHistoryController + @@ -3026,6 +3809,13 @@ refish id + + refish + + refish + id + + IBProjectSource PBRefMenuItem.h @@ -3034,34 +3824,6 @@ PBRepositoryDocumentController NSDocumentController - - YES - - YES - cloneURL: - hideClone: - showClone: - - - YES - id - id - id - - - - YES - - YES - cloneURLField - cloneWindow - - - YES - NSTextField - NSWindow - - IBProjectSource PBRepositoryDocumentController.h @@ -3082,6 +3844,13 @@ refresh: id + + refresh: + + refresh: + id + + IBProjectSource PBViewController.h @@ -3107,6 +3876,35 @@ NSArrayController + + YES + + YES + cachedFilesController + controller + indexController + unstagedFilesController + + + YES + + cachedFilesController + NSArrayController + + + controller + PBGitCommitController + + + indexController + PBGitIndexController + + + unstagedFilesController + NSArrayController + + + IBProjectSource PBWebChangesController.h @@ -3128,6 +3926,25 @@ WebView + + YES + + YES + repository + view + + + YES + + repository + id + + + view + WebView + + + IBProjectSource PBWebController.h @@ -3149,6 +3966,25 @@ PBGitHistoryController + + YES + + YES + contextMenuDelegate + historyController + + + YES + + contextMenuDelegate + id + + + historyController + PBGitHistoryController + + + IBProjectSource PBWebHistoryController.h @@ -3171,10 +4007,24 @@ checkForUpdates: id + + checkForUpdates: + + checkForUpdates: + id + + delegate id + + delegate + + delegate + id + + @@ -3295,6 +4145,45 @@ id + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + + printDocument: + id + + + revertDocumentToSaved: + id + + + runPageLayout: + id + + + saveDocument: + id + + + saveDocumentAs: + id + + + saveDocumentTo: + id + + + IBFrameworkSource AppKit.framework/Headers/NSDocument.h @@ -3327,6 +4216,35 @@ id + + YES + + YES + clearRecentDocuments: + newDocument: + openDocument: + saveAllDocuments: + + + YES + + clearRecentDocuments: + id + + + newDocument: + id + + + openDocument: + id + + + saveAllDocuments: + id + + + IBFrameworkSource AppKit.framework/Headers/NSDocumentController.h @@ -3624,55 +4542,6 @@ Foundation.framework/Headers/NSURLDownload.h - - NSObject - - IBFrameworkSource - ImageKit.framework/Headers/IKImageBrowserView.h - - - - NSObject - - IBFrameworkSource - ImageKit.framework/Headers/ImageKitDeprecated.h - - - - NSObject - - IBFrameworkSource - PDFKit.framework/Headers/PDFDocument.h - - - - NSObject - - IBFrameworkSource - PDFKit.framework/Headers/PDFView.h - - - - NSObject - - IBFrameworkSource - QuartzComposer.framework/Headers/QCCompositionParameterView.h - - - - NSObject - - IBFrameworkSource - QuartzComposer.framework/Headers/QCCompositionPickerView.h - - - - NSObject - - IBFrameworkSource - QuartzFilters.framework/Headers/QuartzFilterManager.h - - NSObject @@ -3897,6 +4766,13 @@ view NSView + + view + + view + NSView + + IBFrameworkSource AppKit.framework/Headers/NSViewController.h @@ -3931,68 +4807,18 @@ showWindow: id + + showWindow: + + showWindow: + id + + IBFrameworkSource AppKit.framework/Headers/NSWindowController.h - - PDFView - NSView - - YES - - YES - goBack: - goForward: - goToFirstPage: - goToLastPage: - goToNextPage: - goToPreviousPage: - selectAll: - takeBackgroundColorFrom: - zoomIn: - zoomOut: - - - YES - id - id - id - id - id - id - id - id - id - id - - - - - - QCView - NSView - - YES - - YES - play: - start: - stop: - - - YES - id - id - id - - - - IBFrameworkSource - QuartzComposer.framework/Headers/QCView.h - - SUUpdater NSObject @@ -4000,10 +4826,24 @@ checkForUpdates: id + + checkForUpdates: + + checkForUpdates: + id + + delegate id + + delegate + + delegate + id + + @@ -4040,6 +4880,70 @@ id + + YES + + YES + goBack: + goForward: + makeTextLarger: + makeTextSmaller: + makeTextStandardSize: + reload: + reloadFromOrigin: + stopLoading: + takeStringURLFrom: + toggleContinuousSpellChecking: + toggleSmartInsertDelete: + + + YES + + goBack: + id + + + goForward: + id + + + makeTextLarger: + id + + + makeTextSmaller: + id + + + makeTextStandardSize: + id + + + reload: + id + + + reloadFromOrigin: + id + + + stopLoading: + id + + + takeStringURLFrom: + id + + + toggleContinuousSpellChecking: + id + + + toggleSmartInsertDelete: + id + + + IBFrameworkSource WebKit.framework/Headers/WebView.h @@ -4048,6 +4952,7 @@ 0 + IBCocoaFramework com.apple.InterfaceBuilder.CocoaPlugin.macosx @@ -4063,5 +4968,18 @@ YES ../GitX.xcodeproj 3 + + YES + + YES + NSMenuCheckmark + NSMenuMixedState + + + YES + {9, 8} + {7, 2} + + diff --git a/PBCommitList.m b/PBCommitList.m index 0060a07..d5ea35d 100644 --- a/PBCommitList.m +++ b/PBCommitList.m @@ -51,6 +51,11 @@ [controller copyCommitInfo]; } +- (void) copySHA:(id)sender +{ + [controller copyCommitSHA]; +} + // !!! Andre Berg 20100330: Used from -scrollSelectionToTopOfViewFrom: of PBGitHistoryController // so that when the history controller udpates the branch filter the origin of the superview gets // shifted into multiples of the row height. Otherwise the top selected row will always be off by diff --git a/PBGitHistoryController.h b/PBGitHistoryController.h index 8bc0388..f848c4c 100644 --- a/PBGitHistoryController.h +++ b/PBGitHistoryController.h @@ -83,6 +83,7 @@ - (IBAction) rebase:(id)sender; - (void) copyCommitInfo; +- (void) copyCommitSHA; - (BOOL) hasNonlinearPath; diff --git a/PBGitHistoryController.m b/PBGitHistoryController.m index 6db7c75..640c892 100644 --- a/PBGitHistoryController.m +++ b/PBGitHistoryController.m @@ -304,6 +304,19 @@ } +- (void) copyCommitSHA +{ + PBGitCommit *commit = [[commitController selectedObjects] objectAtIndex:0]; + if (!commit) + return; + NSString *info = [[commit realSha] substringWithRange:NSMakeRange(0, 7)]; + + NSPasteboard *a =[NSPasteboard generalPasteboard]; + [a declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:self]; + [a setString:info forType: NSStringPboardType]; + +} + - (IBAction) toggleQLPreviewPanel:(id)sender { if ([[QLPreviewPanel sharedPreviewPanel] respondsToSelector:@selector(setDataSource:)]) {