Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions GitUpKit/Views/GIMapViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ - (NSMenu*)graphView:(GIGraphView*)graphView willShowContextualMenuForNode:(GINo
for (GCHistoryLocalBranch* branch in node.commit.localBranches) {
GCBranch* upstream = branch.upstream;
NSMenu* menu = [[NSMenu alloc] init];

item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Copy Name", nil) action:@selector(_copyBranchName:) keyEquivalent:@""];
item.representedObject = branch;
[menu addItem:item];

item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Rename…", nil) action:@selector(_renameLocalBranch:) keyEquivalent:@""];
item.representedObject = branch;
Expand Down Expand Up @@ -420,6 +424,11 @@ - (NSMenu*)graphView:(GIGraphView*)graphView willShowContextualMenuForNode:(GINo
break;
}
}

item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Copy Name", nil) action:@selector(_copyBranchName:) keyEquivalent:@""];
item.representedObject = branch;
[menu addItem:item];

if (!found) {
item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Checkout New Tracking Local Branch", nil) action:@selector(_checkoutRemoteBranch:) keyEquivalent:@""];
item.representedObject = branch;
Expand Down Expand Up @@ -1109,6 +1118,13 @@ - (IBAction)_renameLocalBranch:(id)sender {
}];
}

- (IBAction)_copyBranchName:(id)sender {
GCBranch* branch = [(NSMenuItem*)sender representedObject];
NSPasteboard* pasteboard = NSPasteboard.generalPasteboard;
[pasteboard clearContents];
[pasteboard setString:branch.name forType:NSPasteboardTypeString];
}

- (IBAction)_deleteLocalBranch:(id)sender {
GCHistoryLocalBranch* branch = [(NSMenuItem*)sender representedObject];
[self deleteLocalBranch:branch];
Expand Down