diff --git a/PBRefController.m b/PBRefController.m index 31c5590..d4ac81e 100644 --- a/PBRefController.m +++ b/PBRefController.m @@ -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]; diff --git a/PBRefMenuItem.m b/PBRefMenuItem.m index 22aaae5..a711370 100644 --- a/PBRefMenuItem.m +++ b/PBRefMenuItem.m @@ -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:)