Add a menu item and an action for pushing a repo up.

This commit is contained in:
Morgan Schweers
2009-10-23 23:57:30 -07:00
committed by André Berg
parent fa929eb7c9
commit cdc4f5208b
2 changed files with 21 additions and 2 deletions
+15 -1
View File
@@ -60,7 +60,21 @@
int ret = 1;
[historyController.repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"checkout", [[sender ref] shortName], nil] retValue: &ret];
if (ret) {
[[historyController.repository windowController] showMessageSheet:@"Checking out branch failed" infoText:@"There was an error checking out the branch. Perhaps your working directory is not clean?"];
NSString *info = [NSString stringWithFormat:@"There was an error checking out the branch. Perhaps your working directory is not clean?"];
[[historyController.repository windowController] showMessageSheet:@"Checking out branch failed" infoText:info];
return;
}
[historyController.repository reloadRefs];
[commitController rearrangeObjects];
}
- (void) pushRef:(PBRefMenuItem *)sender
{
int ret = 1;
NSString *rval = [historyController.repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"push", @"origin", [[sender ref] shortName], nil] retValue: &ret];
if (ret) {
NSString *info = [NSString stringWithFormat:@"There was an error pushing the branch to the origin.\n\n%d\n%@", ret, rval];
[[historyController.repository windowController] showMessageSheet:@"Pushing branch failed" infoText:info];
return;
}
[historyController.repository reloadRefs];
+6 -1
View File
@@ -28,7 +28,12 @@
[array addObject:[[PBRefMenuItem alloc] initWithTitle:@"Checkout branch"
action:@selector(checkoutRef:)
keyEquivalent: @""]];
if ([type isEqualToString:@"branch"])
[array addObject:[[PBRefMenuItem alloc] initWithTitle:@"Push branch"
action:@selector(pushRef:)
keyEquivalent: @""]];
if ([type isEqualToString:@"tag"])
[array addObject:[[PBRefMenuItem alloc] initWithTitle:@"View tag info"
action:@selector(tagInfo:)