/* 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" @interface PerforceSubmittedChange(Private) - (NSComparisonResult) comparegetChangeNumberAscending: (PerforceSubmittedChange*) rhs; - (NSComparisonResult) comparegetChangeNumberDescending: (PerforceSubmittedChange*) rhs; - (NSComparisonResult) comparegetChangeDateAscending: (PerforceSubmittedChange*) rhs; - (NSComparisonResult) comparegetChangeDateDescending: (PerforceSubmittedChange*) rhs; - (NSComparisonResult) comparegetChangeUserAscending: (PerforceSubmittedChange*) rhs; - (NSComparisonResult) comparegetChangeUserDescending: (PerforceSubmittedChange*) rhs; - (NSComparisonResult) comparegetChangeDescriptionAscending: (PerforceSubmittedChange*) rhs; - (NSComparisonResult) comparegetChangeDescriptionDescending: (PerforceSubmittedChange*) rhs; @end @implementation PerforceSubmittedChange + (id) submittedChangeWithString: (NSString *) string // convenience is king... { return [[[PerforceSubmittedChange alloc] initWithString: string] autorelease]; } - (id) initWithString: (NSString *) string { if (self = [super init]) { NSScanner * scanner = [NSScanner scannerWithString: string]; if ([scanner scanString: @"Change " intoString: nil] && [scanner scanInt: &fNumber] && [scanner scanString: @"on " intoString: nil] && [scanner scanUpToString: @" " intoString: &fDate] && [scanner scanString: @"by " intoString: nil] && [scanner scanUpToString: @" " intoString: &fUser] && [scanner scanString: @"'" intoString: nil]) { NSRange range; range.location = [scanner scanLocation]; range.length = [string length] - range.location - 1; fDescription = [string substringWithRange: range]; } [fUser retain]; [fDate retain]; [fDescription retain]; } return self; } - (void) dealloc { [fDate release]; [fUser release]; [fDescription release]; [super dealloc]; } - (NSNumber *) getChangeNumber { return [NSNumber numberWithInt: fNumber]; } - (NSString*) getChangeDate { return fDate; } - (NSString*) getChangeUser { return fUser; } - (NSString*) getChangeDescription { return fDescription; } - (NSComparisonResult) comparegetChangeNumberAscending: (PerforceSubmittedChange*) rhs { if (fNumber < rhs->fNumber) return NSOrderedAscending; else if (fNumber > rhs->fNumber) return NSOrderedDescending; else return NSOrderedSame; } - (NSComparisonResult) comparegetChangeNumberDescending: (PerforceSubmittedChange*) rhs { if (fNumber < rhs->fNumber) return NSOrderedDescending; else if (fNumber > rhs->fNumber) return NSOrderedAscending; else return NSOrderedSame; } - (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) canDescribe { return YES; } - (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: [NSString stringWithFormat: @"%d", fNumber]]; } - (void) doDelete { } - (void) doSubmit { } - (void) doRevert { } - (void) doSyncTo { [PerforceActionSync defaultRun:nil revision: [NSString stringWithFormat: @"%d", fNumber]]; } - (void) doSyncOnly { [PerforceActionSync defaultRun:nil revision: [NSString stringWithFormat: @"%d,%d", fNumber, fNumber]]; } @end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 3391 | Paul Ferguson | More memory leak fixes, other code cleanup | ||
#1 | 3210 | Paul Ferguson | Initial branch | ||
//guest/jeff_argast/P4Cocoa/source/Perforce/PerforceSubmittedChange.m | |||||
#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 |