From 0377181bbf82cf0ed72d15eb50e6ccab270cd1ba Mon Sep 17 00:00:00 2001 From: brotherbard Date: Sat, 7 Nov 2009 22:31:14 -0700 Subject: [PATCH] Disable the Checkout menu item when the branch is the current branch. --- PBRefMenuItem.m | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/PBRefMenuItem.m b/PBRefMenuItem.m index 95ed0bf..a534669 100644 --- a/PBRefMenuItem.m +++ b/PBRefMenuItem.m @@ -44,12 +44,15 @@ [array addObject:[self addRemoteMethod:hasRemote title:[NSString stringWithFormat:@"Push %@ to remote", targetRef] action:@selector(pushRef:)]]; [array addObject:[self addRemoteMethod:hasRemote title:[NSString stringWithFormat:@"Pull down latest"] action:@selector(pullRef:)]]; [array addObject:[self addRemoteMethod:hasRemote title:[NSString stringWithFormat:@"Rebase local changes with latest"] action:@selector(rebaseRef:)]]; - } - - if ([type isEqualToString:@"branch"]) - [array addObject:[[PBRefMenuItem alloc] initWithTitle:[@"Checkout " stringByAppendingString:targetRef] - action:@selector(checkoutRef:) - keyEquivalent: @""]]; + + PBRefMenuItem *item = [[PBRefMenuItem alloc] initWithTitle:[@"Checkout " stringByAppendingString:targetRef] + action:@selector(checkoutRef:) + keyEquivalent: @""]; + if ([targetRef isEqualToString:[[commit repository] currentBranch].description]) + [item setEnabled:NO]; + + [array addObject:item]; + } [array addObject:[[PBRefMenuItem alloc] initWithTitle:[@"Delete " stringByAppendingString:targetRef] action:@selector(removeRef:)