/* Copyright (C) 2002-2003, Jeffrey D. Argast. The authors make NO WARRANTY or representation, either express or implied, with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose. This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy. Permission is hereby granted to use, copy, modify, and distribute this software or portions thereof for any purpose, without fee, subject to these conditions: (1) If any part of the source code is distributed, then this statement must be included, with this copyright and no-warranty notice unaltered. (2) Permission for use of this software is granted only if the user accepts full responsibility for any undesirable consequences; the authors accept NO LIABILITY for damages of any kind. */ #import "PerforceSubmittedChange.h" #import "ReadOnlyEditorController.h" #import "PerforceActionDescribe.h" #import "PerforceActionSync.h" #import "MessageDefs.h" #import "AppUtils.h" const static int kNumDigits = 6; static NSString* kFiveZeros = @"00000"; static NSString* kFourZeros = @"0000"; static NSString* kThreeZeros = @"000"; static NSString* kTwoZeros = @"00"; static NSString* kOneZero = @"0"; @implementation PerforceSubmittedChange - (id) initWithNumber: (NSString*) changeNumber withDate: (NSString*) changeDate withUser: (NSString*) changeUser withDesc: (NSString*) changeDesc { int numLen = [changeNumber length]; self = [super init]; // display at least kNumDigits digits if ( numLen < kNumDigits ) { int numToPrepend = kNumDigits - numLen; NSMutableString* numString = [NSMutableString stringWithCapacity:kNumDigits]; switch ( numToPrepend ) { case 5: [numString appendString:kFiveZeros]; break; case 4: [numString appendString:kFourZeros]; break; case 3: [numString appendString:kThreeZeros]; break; case 2: [numString appendString:kTwoZeros]; break; case 1: [numString appendString:kOneZero]; break; } [numString appendString:changeNumber]; fNumber = [[NSString stringWithCString:[numString cString]] retain]; } else { fNumber = [changeNumber copy]; } fDate = [changeDate copy]; fUser = [changeUser copy]; fDescription = [changeDesc copy]; return self; } - (void) dealloc { [fNumber release]; [fDate release]; [fUser release]; [fDescription release]; [super dealloc]; } - (NSString*) getChangeNumber { return fNumber; } - (NSString*) getChangeDate { return fDate; } - (NSString*) getChangeUser { return fUser; } - (NSString*) getChangeDescription { return fDescription; } - (NSComparisonResult) comparegetChangeNumberAscending: (PerforceSubmittedChange*) rhs { return [fNumber caseInsensitiveCompare:rhs->fNumber]; } - (NSComparisonResult) comparegetChangeNumberDescending: (PerforceSubmittedChange*) rhs { return [rhs->fNumber caseInsensitiveCompare:fNumber]; } - (NSComparisonResult) comparegetChangeDateAscending: (PerforceSubmittedChange*) rhs { return [fDate caseInsensitiveCompare:rhs->fDate]; } - (NSComparisonResult) comparegetChangeDateDescending: (PerforceSubmittedChange*) rhs { return [rhs->fDate caseInsensitiveCompare:fDate]; } - (NSComparisonResult) comparegetChangeUserAscending: (PerforceSubmittedChange*) rhs { return [fUser caseInsensitiveCompare:rhs->fUser]; } - (NSComparisonResult) comparegetChangeUserDescending: (PerforceSubmittedChange*) rhs { return [rhs->fUser caseInsensitiveCompare:fUser]; } - (NSComparisonResult) comparegetChangeDescriptionAscending: (PerforceSubmittedChange*) rhs { return [fDescription caseInsensitiveCompare:rhs->fDescription]; } - (NSComparisonResult) comparegetChangeDescriptionDescending: (PerforceSubmittedChange*) rhs { return [rhs->fDescription caseInsensitiveCompare:fDescription]; } // ///// // // The enablement - (BOOL) canEdit { return NO; } - (BOOL) canDescribe { return YES; } - (BOOL) canDelete { return NO; } - (BOOL) canSubmit { return NO; } - (BOOL) canRevert { return NO; } - (BOOL) canSyncTo { return YES; } - (BOOL) canSyncOnly { return YES; } - (void) resultFromDescribe:(PerforceActionDescribe*)action { if ( [action wasSuccess] ) { NSMutableString* titleString = [NSMutableString stringWithString:@"Description of Changelist "]; [titleString appendString:[action getChangeNum]]; [ReadOnlyEditorController showWindowWith:[action getOutput] title:titleString]; } } // // The actions - (void) doEdit { } - (void) doDescribe { [PerforceActionDescribe defaultRunFor:self selector:@selector(resultFromDescribe:) changeNum:fNumber]; } - (void) doDelete { } - (void) doSubmit { } - (void) doRevert { } - (void) doSyncTo { NSMutableString* syncPath = [NSMutableString stringWithString:@"@"]; [syncPath appendString:fNumber]; [PerforceActionSync defaultRunFor:self selector:@selector(resultFromSync:) withPath:syncPath]; } - (void) doSyncOnly { NSMutableString* syncPath = [NSMutableString stringWithString:@"@"]; [syncPath appendString:fNumber]; [syncPath appendString:@","]; [syncPath appendString:fNumber]; [PerforceActionSync defaultRunFor:self selector:@selector(resultFromSync:) withPath:syncPath]; } - (void) resultFromSync:(PerforceActionSync*) action { if ( [action wasSuccess] ) { SendNotification (kGlobalSyncComplete); } } // // // @end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#6 | 3938 | Jeff Argast | Fixed broken sync up to changelist and sync only changelist actions | ||
#5 | 3937 | Jeff Argast |
Added transparency to the XCode icon Put back the leading zeros for the submitted change number in the submitted change view Enabled perforce integration in my xcode project |
||
#4 | 3936 | Jeff Argast |
Integrated changes from Paul Ferguson's branch Fixed parse error in PerforceUser |
||
#3 | 3111 | Jeff Argast |
Made multiple selection smarter by operating on the entire selection as an atomic operation with the server. Also partially fixed the read only window to not wrap at the window boundary. I did the same for the editable window, but now the problem appears to be that p4 change -o is breaking its output at some character location before the string gets into the editor (at least I think that is the problem). |
||
#2 | 2737 | Jeff Argast | Added several 0.15 revision functionality | ||
#1 | 2732 | Jeff Argast | Initial submission of P4Cocoa |