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.

This commit is contained in:
Marc Liyanage
2010-08-11 23:42:37 -07:00
committed by Nathan Kinsinger
parent caa6ed01f9
commit d4cb11bb8b
4 changed files with 1094 additions and 157 deletions
+1075 -157
View File
File diff suppressed because it is too large Load Diff
+5
View File
@@ -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
+1
View File
@@ -83,6 +83,7 @@
- (IBAction) rebase:(id)sender;
- (void) copyCommitInfo;
- (void) copyCommitSHA;
- (BOOL) hasNonlinearPath;
+13
View File
@@ -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:)]) {