/* 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 "PerforceDirectory.h" #import "PerforceActionDirsAndFstat.h" #import "PerforceActionDirs.h" #import "PerforceActionFstat.h" #import "PerforceActionSync.h" #import "PerforceActionEdit.h" #import "PerforceActionRevert.h" #import "PerforceActionDelete.h" #import "IconController.h" #import "IconDefs.h" #import "AppUtils.h" #import "MessageDefs.h" static NSString* kNibExt = @"nib"; static NSString* kPBExt = @"pbproj"; @implementation PerforceDirectory - (void) releaseChildren { [fChildren release]; fChildren = nil; } - (void) resultFromPerforceReleaseChildren: (id) nothing { [self releaseChildren]; SendNotificationWithObject (kDepotControllerChildChanged, self); } - (void) resultFromPerforceDirsAndFstat: (PerforceActionDirsAndFstat*) action { [fChildren release]; fChildren = [[action getDirsAndFiles] retain]; SendNotificationWithObject (kDepotControllerChildChanged, self); } - (void) buildChildren { NSMutableString* dirPath = [NSMutableString stringWithString:fDepotPath]; [dirPath appendString:@"/*"]; fChildren = [[NSMutableArray alloc] init]; [PerforceActionDirsAndFstat defaultRunFor:self selector:@selector(resultFromPerforceDirsAndFstat:) withPath:dirPath]; } - (void) dealloc { [fChildren release]; [fName release]; [fDepotPath release]; [fIcon release]; [super dealloc]; } - (id) initWithDir: (const char*) fullPath { if ( self = [super init] ) { fDepotPath = [[NSString alloc] initWithCString:fullPath]; fName = ExtractLastPathComponent (fDepotPath); [fName retain]; fChildren = nil; IconController* iconController = [IconController defaultIconController]; NSString* dirExtension = [fName pathExtension]; if ( dirExtension ) { if ( [dirExtension isEqualToString:kNibExt] ) { fIcon = [[iconController getIcon:kDirNibIcon] retain]; } else if ( [dirExtension isEqualToString:kPBExt] ) { fIcon = [[iconController getIcon:kDirPBIcon] retain]; } else { fIcon = [[iconController getIcon:kDirIcon] retain]; } } else { fIcon = [[iconController getIcon:kDirIcon] retain]; } } return self; } - (NSString*) getName { return fName; } - (int) getNumberOfChildren { if ( !fChildren ) { [self buildChildren]; } return [fChildren count]; } - (BOOL) hasChildren { // Depots always have children return YES; } - (id) getChildAtIndex: (int) index { if ( !fChildren ) { [self buildChildren]; } return [fChildren objectAtIndex:index]; } - (id) getCellText { return fName; } - (id) getCellImage { return fIcon; } - (NSString*) buildPath: (NSString*) extraPath { NSMutableString* depotPath = [[[NSMutableString alloc] initWithString:fDepotPath] autorelease]; [depotPath appendString:extraPath]; return depotPath; } // // Perforce Protocol // // // data // // // Enablement // - (BOOL) canSyncToHead { return YES; } - (BOOL) canSyncToNone { return YES; } - (BOOL) canEdit { return YES; } - (BOOL) canDelete { return YES; } - (BOOL) canRevert { return YES; } - (BOOL) canDiff { return NO; } - (BOOL) canGetRevisions { return NO; } - (BOOL) canViewInEditor { return NO; } // // Actions // - (void) syncToHead { [PerforceActionSync defaultRunFor:self selector:@selector(resultFromPerforceReleaseChildren:) withPath:[self buildPath:@"/..."]]; } - (void) syncToNone { [PerforceActionSync defaultRunFor:self selector:@selector(resultFromPerforceReleaseChildren:) withPath:[self buildPath:@"/...#none"]]; } - (void) syncTo: (NSString*) target { NSMutableString* revSpec = [NSMutableString stringWithString:@"/..."]; [revSpec appendString:target]; [PerforceActionSync defaultRunFor:self selector:@selector(resultFromPerforceReleaseChildren:) withPath:[self buildPath:revSpec]]; } - (void) showRevisionHistory { } - (void) edit { [PerforceActionEdit defaultRunFor:self selector:@selector(resultFromPerforceReleaseChildren:) withPath:[self buildPath:@"/..."]]; } - (void) delete { [PerforceActionDelete defaultRunFor:self selector:@selector(resultFromPerforceReleaseChildren:) withPath:[self buildPath:@"/..."]]; } - (void) revert { [PerforceActionRevert defaultRunFor:self selector:@selector(resultFromPerforceReleaseChildren:) withPath:[self buildPath:@"/..."]]; } - (void) diff { // do nothing } - (void) viewInEditor { // do nothing; } - (NSString*) getPasteboardData { NSMutableString* dragPath = [NSMutableString stringWithString:fDepotPath]; [dragPath appendString:@"/..."]; return dragPath; } - (void) fileChanged:(NSString*)depotPath { if ( !fChildren ) return; int myLen = [fDepotPath length]; int otherLen = [depotPath length]; if ( myLen < otherLen ) { NSString* subStr = [depotPath substringToIndex:myLen]; if ( [subStr isEqualToString:fDepotPath] ) { int numChildren = [fChildren count]; int n; for ( n = 0; n < numChildren; n++ ) { id<DepotViewProtocol> child = [fChildren objectAtIndex:n]; [child fileChanged:depotPath]; } } } } @end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#10 | 4225 | Jeff Argast |
Added resolve support, reveal in finder, drag and drop edit, show local files, and showing added files. |
||
#9 | 3984 | Jeff Argast | Updated version information | ||
#8 | 3980 | Jeff Argast | Added distributed protocol | ||
#7 | 3936 | Jeff Argast |
Integrated changes from Paul Ferguson's branch Fixed parse error in PerforceUser |
||
#6 | 3931 | Jeff Argast |
Fixed a hang when actin on large numbers of files Added an icon for xcode Switched to xcode Tweaked the icons in the tabs for panther |
||
#5 | 3147 | Jeff Argast | Testing std in blockage | ||
#4 | 3134 | Jeff Argast |
Added copy/paste support in the depot view Added expand path to depot view Added bookmarks |
||
#3 | 3113 | Jeff Argast |
Reduced the times the depot view completely collapses. Now it won't collapse on refresh views or submit, but still collapses when the defaults change. |
||
#2 | 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). |
||
#1 | 2732 | Jeff Argast | Initial submission of P4Cocoa |