From 0d8ba8c2632e129fe7627f86d907c8b470c1bf20 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Thu, 28 May 2009 17:40:17 +0100 Subject: [PATCH] Rename 'CachedChanges" to "StagedChanges" for greater consistency --- PBChangedFile.h | 4 ++-- PBChangedFile.m | 2 +- PBGitCommitController.m | 30 +++++++++++++++--------------- PBGitIndexController.m | 4 ++-- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/PBChangedFile.h b/PBChangedFile.h index 7453db3..bffc110 100644 --- a/PBChangedFile.h +++ b/PBChangedFile.h @@ -17,7 +17,7 @@ typedef enum { @interface PBChangedFile : NSObject { NSString *path; - BOOL hasCachedChanges; + BOOL hasStagedChanges; BOOL hasUnstagedChanges; // Index and HEAD stuff, to be used to revert changes @@ -30,7 +30,7 @@ typedef enum { @property (copy) NSString *path, *commitBlobSHA, *commitBlobMode; @property (assign) PBChangedFileStatus status; -@property (assign) BOOL hasCachedChanges, hasUnstagedChanges; +@property (assign) BOOL hasStagedChanges, hasUnstagedChanges; - (NSImage *)icon; - (NSString *)indexInfo; diff --git a/PBChangedFile.m b/PBChangedFile.m index e2bb7e8..4cbeabb 100644 --- a/PBChangedFile.m +++ b/PBChangedFile.m @@ -11,7 +11,7 @@ @implementation PBChangedFile -@synthesize path, status, hasCachedChanges, hasUnstagedChanges, commitBlobSHA, commitBlobMode; +@synthesize path, status, hasStagedChanges, hasUnstagedChanges, commitBlobSHA, commitBlobMode; - (id) initWithPath:(NSString *)p { diff --git a/PBGitCommitController.m b/PBGitCommitController.m index 282a59a..a546881 100644 --- a/PBGitCommitController.m +++ b/PBGitCommitController.m @@ -16,7 +16,7 @@ - (NSArray *) linesFromNotification:(NSNotification *)notification; - (void) doneProcessingIndex; - (NSMutableDictionary *)dictionaryForLines:(NSArray *)lines; -- (void) addFilesFromDictionary:(NSMutableDictionary *)dictionary cached:(BOOL)cached tracked:(BOOL)tracked; +- (void) addFilesFromDictionary:(NSMutableDictionary *)dictionary staged:(BOOL)staged tracked:(BOOL)tracked; @end @implementation PBGitCommitController @@ -32,7 +32,7 @@ [commitMessageView setTypingAttributes:[NSDictionary dictionaryWithObject:[NSFont fontWithName:@"Monaco" size:12.0] forKey:NSFontAttributeName]]; [unstagedFilesController setFilterPredicate:[NSPredicate predicateWithFormat:@"hasUnstagedChanges == 1"]]; - [cachedFilesController setFilterPredicate:[NSPredicate predicateWithFormat:@"hasCachedChanges == 1"]]; + [cachedFilesController setFilterPredicate:[NSPredicate predicateWithFormat:@"hasStagedChanges == 1"]]; [unstagedFilesController setSortDescriptors:[NSArray arrayWithObjects: [[NSSortDescriptor alloc] initWithKey:@"status" ascending:false], @@ -148,7 +148,7 @@ if (!--self.busy) { self.status = @"Ready"; for (PBChangedFile *file in files) { - if (!file.hasCachedChanges && !file.hasUnstagedChanges) { + if (!file.hasStagedChanges && !file.hasUnstagedChanges) { NSLog(@"Deleting file: %@", [file path]); [files removeObject:file]; } @@ -169,7 +169,7 @@ continue; [dictionary setObject:fileStatus forKey:path]; } - [self addFilesFromDictionary:dictionary cached:NO tracked:NO]; + [self addFilesFromDictionary:dictionary staged:NO tracked:NO]; [self doneProcessingIndex]; } @@ -193,7 +193,7 @@ return dictionary; } -- (void) addFilesFromDictionary:(NSMutableDictionary *)dictionary cached:(BOOL)cached tracked:(BOOL)tracked +- (void) addFilesFromDictionary:(NSMutableDictionary *)dictionary staged:(BOOL)staged tracked:(BOOL)tracked { // Iterate over all existing files for (PBChangedFile *file in files) { @@ -204,22 +204,22 @@ NSString *mode = [[fileStatus objectAtIndex:0] substringFromIndex:1]; NSString *sha = [fileStatus objectAtIndex:2]; - if (cached) { - file.hasCachedChanges = YES; + if (staged) { + file.hasStagedChanges = YES; file.commitBlobSHA = sha; file.commitBlobMode = mode; } else file.hasUnstagedChanges = YES; } else { // Untracked file, set status to NEW, only unstaged changes - file.hasCachedChanges = NO; + file.hasStagedChanges = NO; file.hasUnstagedChanges = YES; file.status = NEW; } [dictionary removeObjectForKey:file.path]; } else { // Object not found, let's remove it from the changes - if (cached) - file.hasCachedChanges = NO; + if (staged) + file.hasStagedChanges = NO; else if (tracked && file.status != NEW) // Only remove it if it's not an untracked file. We handle that with the other thing file.hasUnstagedChanges = NO; else if (!tracked && file.status == NEW) @@ -239,13 +239,13 @@ else file.status = MODIFIED; - if (cached) { + if (staged) { file.commitBlobSHA = [[fileStatus objectAtIndex:0] substringFromIndex:1]; file.commitBlobMode = [fileStatus objectAtIndex:2]; } - file.hasCachedChanges = cached; - file.hasUnstagedChanges = !cached; + file.hasStagedChanges = staged; + file.hasUnstagedChanges = !staged; [files addObject: file]; } @@ -255,7 +255,7 @@ { NSArray *lines = [self linesFromNotification:notification]; NSMutableDictionary *dic = [self dictionaryForLines:lines]; - [self addFilesFromDictionary:dic cached:NO tracked:YES]; + [self addFilesFromDictionary:dic staged:NO tracked:YES]; [self doneProcessingIndex]; } @@ -263,7 +263,7 @@ { NSArray *lines = [self linesFromNotification:notification]; NSMutableDictionary *dic = [self dictionaryForLines:lines]; - [self addFilesFromDictionary:dic cached:YES tracked:YES]; + [self addFilesFromDictionary:dic staged:YES tracked:YES]; [self doneProcessingIndex]; } diff --git a/PBGitIndexController.m b/PBGitIndexController.m index 84da6ca..dab2cd6 100644 --- a/PBGitIndexController.m +++ b/PBGitIndexController.m @@ -58,7 +58,7 @@ for (PBChangedFile *file in files) { file.hasUnstagedChanges = NO; - file.hasCachedChanges = YES; + file.hasStagedChanges = YES; } [self resumeTrackingIndex]; } @@ -85,7 +85,7 @@ for (PBChangedFile *file in files) { file.hasUnstagedChanges = YES; - file.hasCachedChanges = NO; + file.hasStagedChanges = NO; } [self resumeTrackingIndex]; }