Permalink
Browse files

- Update "Revert to Default Choices" to use the current default choices

- Update the inclusion state after the Modify popup is used

git-svn-id: http://svn.textmate.org/trunk/Tools/CommitWindowProject@8014 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
1 parent 9a87b8b commit 97d1250969bb654503af896c7416ac2fae6a7cd3 Chris Thomas committed Aug 21, 2007
Showing with 33 additions and 16 deletions.
  1. +33 −16 CommitWindowController.m
View
@@ -2,7 +2,7 @@
// CommitWindowController.m
//
// Created by Chris Thomas on 2/6/05.
-// Copyright 2005-2006 Chris Thomas. All rights reserved.
+// Copyright 2005-2007 Chris Thomas. All rights reserved.
// MIT license.
//
@@ -74,6 +74,23 @@ - (void) addAction:(NSString *)name command:(NSArray *)arguments forStatus:(NSSt
[commandsForAction addObject:commandArguments];
}
+- (BOOL)standardChosenStateForStatus:(NSString *)status
+{
+ BOOL chosen = YES;
+
+ // Deselect external commits and files not added by default
+ // We intentionally do not deselect file conflicts by default
+ // -- those are most likely to be a problem.
+
+ if( [status hasPrefix:@"X"]
+ || [status hasPrefix:@"?"])
+ {
+ chosen = NO;
+ }
+
+ return chosen;
+}
+
// fFilesController and fFilesStatusStrings should be set up before calling setupUserInterface.
- (void) setupUserInterface
{
@@ -177,19 +194,7 @@ - (void) setupUserInterface
[dictionary setObject:status forKey:@"status"];
[dictionary setObject:[status attributedStatusString] forKey:@"attributedStatus"];
- // Deselect external commits by default
- // and files not added.
- // We intentionally do not deselect file conflicts by default
- // -- those are most likely to be a problem.
- if([status hasPrefix:@"X"]
- || [status hasPrefix:@"?"])
- {
- itemSelectedForCommit = NO;
- }
- else
- {
- itemSelectedForCommit = YES;
- }
+ itemSelectedForCommit = [self standardChosenStateForStatus:status];
[dictionary setObject:[NSNumber numberWithBool:itemSelectedForCommit] forKey:@"commit"];
}
@@ -476,8 +481,19 @@ - (IBAction) chooseNoFiles:(id)sender
- (IBAction) revertToStandardChosenState:(id)sender
{
- [self chooseAllItems:YES];
- [self choose:NO itemsWithStatus:@"X"];
+ NSArray * files = [fFilesController arrangedObjects];
+ int count = [files count];
+ int i;
+
+ for( i = 0; i < count; i += 1 )
+ {
+ NSMutableDictionary * dictionary = [files objectAtIndex:i];
+ BOOL itemChosen = YES;
+ NSString * status = [dictionary objectForKey:@"status"];
+
+ itemChosen = [self standardChosenStateForStatus:status];
+ [dictionary setObject:[NSNumber numberWithBool:itemChosen] forKey:@"commit"];
+ }
}
#if 0
@@ -591,6 +607,7 @@ - (void)chooseActionCommand:(id)sender
[fileDictionary setObject:newStatus forKey:@"status"];
[fileDictionary setObject:[newStatus attributedStatusString] forKey:@"attributedStatus"];
+ [fileDictionary setObject:[NSNumber numberWithBool:[self standardChosenStateForStatus:newStatus]] forKey:@"commit"];
[self resetStatusColumnSize];
}

0 comments on commit 97d1250

Please sign in to comment.