home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-Developer.iso / NextLibrary / PrivateFrameworks / ProjectBuilderSCM.framework / Versions / A / Headers / SCMAdaptor.h < prev    next >
Encoding:
Text File  |  1997-02-25  |  13.4 KB  |  371 lines

  1. //--------------------------------------------------------------------------
  2. //  Copyright (c) 1996 Next Software, Inc., All Rights Reserved
  3. //
  4. //  No part of this code may be reproduced in any form, compiled
  5. //  or source code, nor used for any purpose without the express
  6. //  written permission of the copyright holder.
  7. //
  8. //  $Id: SCMAdaptor.h,v 1.2 1997/02/25 03:47:07 mmonegan Exp $
  9. //--------------------------------------------------------------------------
  10.  
  11. #import <AppKit/AppKit.h>
  12. #import <Apps/FileMergeProtocols.h>
  13.  
  14. #import "ProjectBuilderSCMDefines.h"
  15.  
  16. @class SCMFileStatus;
  17. @class PBProject;
  18.  
  19. @interface SCMAdaptor : NSObject
  20. {
  21.     PBProject               *_project;
  22.     NSString                *_workArea;
  23.     NSString                *_repository;
  24.     NSMutableDictionary     *_fileStats;
  25.  
  26.     int                     syncDisabled;
  27.     BOOL                    _dirty;
  28.     BOOL            finishCreation;
  29.  
  30.     // asynchronous operation (XXX release these)
  31.  
  32.     NSDictionary            *_asyncBinnedFiles;
  33.     NSEnumerator            *_asyncDirectory;
  34.     NSInvocation            *_asyncCommandHandler;
  35.     NSInvocation            *_asyncOutputHandler;
  36.     NSInvocation            *_asyncErrorHandler;
  37.     NSInvocation            *_asyncFinishedHandler;
  38.     
  39. @private
  40.     
  41.     // ivars for holding the FileMerge info
  42.     NSString                *_localFile;
  43.     NSString                *_repositoryHead;
  44. }
  45.  
  46. + (NSDictionary *)scmInfo;
  47. + (NSDictionary *)filterInfo;
  48. + (NSDictionary *)operationInfo;
  49.  
  50. + (NSString *)adaptorName;
  51.  
  52. - (NSString *) executeCommandSync: (NSString *) command
  53.     arguments: (NSArray *) arguments files: (NSArray *) files
  54.     workingDirectory: (NSString *) dir;
  55. - (NSString *) executeCommandSync: (NSString *) command
  56.     arguments: (NSArray *) arguments files: (NSArray *) files
  57.     workingDirectory: (NSString *) dir stdoutFile: (NSString *) stdoutFile;
  58. - (void) executeCommandASync: (NSString *) command
  59.     arguments: (NSArray *) arguments files: (NSArray *) files
  60.     workingDirectory: (NSString *) dir selector: (SEL) callWhenDone;
  61.  
  62. - (NSDictionary *) binFiles: (NSArray *) files;
  63.  
  64. - (PBProject *) project;
  65. - (void) setProject: (PBProject *) project;
  66.  
  67. @end
  68.  
  69. @interface SCMAdaptor (Creation)
  70. + (id) createWorkDirectory: (NSString *) path
  71.     repository: (NSString *) repository
  72.     options: (NSDictionary *) options adaptorType: (NSString *) adaptorType;
  73. + (id) adaptorWithProject: (PBProject *) project;
  74.  
  75. - (void) finishOpening;
  76.  
  77. // private
  78. + (NSString *) configDictPathForProject: (PBProject *) project;
  79.  
  80. - (id) initWithProject: (PBProject *) project
  81.     configuration: (NSDictionary *) config;
  82. - (id) initWithWorkDirectory: (NSString *) workDir
  83.     repository: (NSString *) repository options: (NSDictionary *) options;
  84.  
  85. - (void) createWorkAreaForFiles: (NSArray *) files;
  86. - (void) addWorkAreaForFiles: (NSArray *) files;
  87.  
  88.  
  89. @end
  90.  
  91. @interface SCMAdaptor (PublicPrimitives)
  92.  
  93. // public methods
  94.  
  95. - (void) createWorkDirectory: (NSString *) path
  96.     repository: (NSString *) repository options: (NSDictionary *) options;
  97. - (void) addWorkDirectory: (NSString *) path
  98.     repository: (NSString *) repository options: (NSDictionary *) options;
  99.  
  100. - (void) addFiles: (NSArray *) files options: (NSDictionary *) options;
  101. - (void) finishAddFiles: (NSArray *) files options: (NSDictionary *) options;
  102. - (void) removeFiles: (NSArray *) files
  103.     options: (NSDictionary *) options;
  104. - (void) finishRemoveFiles: (NSArray *) files
  105.     options: (NSDictionary *) options;
  106. //rename files dictionary contains old--->new file names
  107. - (void) renameFiles: (NSDictionary *) files;
  108. - (void) finishRenameFiles: (NSDictionary *) files;
  109.  
  110. - (void) checkOutFiles: (NSArray *) files options: (NSDictionary *) options;
  111. - (void) updateFiles: (NSArray *) files options: (NSDictionary *) options;
  112. - (void) checkInFiles: (NSArray *) files options: (NSDictionary *) options;
  113. - (void) diffFiles: (NSArray *) files options: (NSDictionary *) options;
  114. - (void) lockFiles: (NSArray *) files options: (NSDictionary *) options;
  115. - (void) unlockFiles: (NSArray *) files options: (NSDictionary *) options;
  116. // Subclasses should override invalidChars and return a string with additional
  117. // invalid chars appended onto default set (default string is @":").
  118. - (NSMutableString *)invalidChars;
  119. - (void) tagFiles: (NSArray *) files options: (NSDictionary *) options;
  120. - (void) historyFiles: (NSArray *) files options: (NSDictionary *) options;
  121. - (void) touchFiles: (NSArray *) files options: (NSDictionary *) options;
  122.  
  123. - (void) statusFiles: (NSArray *) files;
  124.  
  125. - (void) makeFilesWritable: (NSArray *) files;
  126.  
  127. // cover methods
  128.  
  129. - (void) addFile: (NSString *) filename;
  130. - (void) removeFile: (NSString *) filename;
  131. - (void) lockFile: (NSString *) filename;
  132. - (void) unlockFile: (NSString *) filename;
  133. - (void) touchFile: (NSString *) filename;
  134. - (void) makeFileWritable: (NSString *) filename;
  135.  
  136. @end
  137.  
  138. @interface SCMAdaptor (PrivatePrimitives)
  139.  
  140. // private methods (override in subclasses)
  141.  
  142. - (void) _createWorkDirectory: (NSString *) path
  143.     repository: (NSString *) repository options: (NSDictionary *) options;
  144. - (void) _addWorkDirectory: (NSString *) path
  145.     repository: (NSString *) repository options: (NSDictionary *) options;
  146.  
  147. - (void) _addFiles: (NSArray *) files options: (NSDictionary *) options;
  148. - (void) _removeFiles: (NSArray *) files
  149.     options: (NSDictionary *) options;
  150.  
  151. - (void) _checkOutFiles: (NSArray *) files options: (NSDictionary *) options;
  152. - (void) _updateFiles: (NSArray *) files options: (NSDictionary *) options;
  153. - (void) _checkInFiles: (NSArray *) files options: (NSDictionary *) options;
  154. - (void) _diffFiles: (NSArray *) files options: (NSDictionary *) options;
  155. - (void) _lockFiles: (NSArray *) files options: (NSDictionary *) options;
  156. - (void) _unlockFiles: (NSArray *) files options: (NSDictionary *) options;
  157. //invalid char set is created from the "invalidChars" string.  If you want to 
  158. //add additional invalid chars, you should add them to invalidString.  If you
  159. //want to add an entire character set, override this method and form a union
  160. //of your set with the default set returned by this superclass method and 
  161. //return that value.  Note that this cannot be a static variable since the 
  162. //"invalidChars" string is mutable and may change at any time, so you need to
  163. //create this character set every time this method is called.  Also note that
  164. //if you add characters to this set they won't be displayed to the user in
  165. //alert panels listing the invalid characters (the adaptor uses the "invalidChars"
  166. //string when displaying the invalid characters - there doesn't seem to be a
  167. //way to obtain an NSString description of an NSCharacterSet.  If there was we
  168. //could deal with just character sets and not have to mess with the invalidChars
  169. //NSString.
  170. - (NSCharacterSet *)_invalidCharSet;
  171. //don't need to override _verifyTag in subclasses, just override invalidChars
  172. //(above) and append your adaptor's invalid chars to the list.  If you need
  173. //to do complicated verification, then you can override this method, but don't
  174. //forget to call "super".  This method should return the tag if the tag is valid,
  175. //it should raise an exception is the tag is invalid, or it should return a new,
  176. //valid tag if it can "fix" the bad tag
  177. - (NSString *) _verifyTag:(NSString *)tag;
  178. - (void) _tagFiles: (NSArray *) files options: (NSDictionary *) options;
  179. - (void) _historyFiles: (NSArray *) files options: (NSDictionary *) options;
  180. - (void) _touchFiles: (NSArray *) files options: (NSDictionary *) options;
  181.  
  182. - (void) _statusFiles: (NSArray *) files;
  183.  
  184. // semi-private -- only the _methods above should call these
  185.  
  186. - (void) finishCheckOutFiles: (NSArray *) files
  187.     options: (NSDictionary *) options;
  188. - (void) finishUpdateFiles: (NSArray *) files 
  189.     options: (NSDictionary *) options;
  190. - (void) finishCheckInFiles: (NSArray *) files
  191.     options: (NSDictionary *) options;
  192. - (void) finishDiffFiles: (NSArray *) files options: (NSDictionary *) options;
  193. - (void) finishLockFiles: (NSArray *) files options: (NSDictionary *) options;
  194. - (void) finishUnlockFiles: (NSArray *) files 
  195.     options: (NSDictionary *) options;
  196. - (void) finishTagFiles: (NSArray *) files options: (NSDictionary *) options;
  197. - (void) finishHistoryFiles: (NSArray *) files
  198.     options: (NSDictionary *) options;
  199. - (void) finishTouchFiles: (NSArray *) files options: (NSDictionary *) options;
  200. - (void) finishStatusFiles: (NSArray *) files;
  201.  
  202. @end
  203.  
  204. @interface SCMAdaptor (PathUtilities)
  205.  
  206. - (BOOL) managesPath: (NSString *) path;
  207.  
  208. - (NSString *) canonicalPathForPath: (NSString *) path;
  209. - (NSString *) absolutePathForPath: (NSString *) path;
  210.  
  211. - (NSString *) repositoryForPath: (NSString *) path;
  212.  
  213. - (NSString *) forwardSlashPath: (NSString *) backwardSlashPath;
  214. - (NSString *) backSlashPath: (NSString *) forwardSlashPath;
  215.  
  216. - (void) setAttributesOfFiles: (NSArray *) files to: (NSDictionary *) dict;
  217.  
  218. @end
  219.  
  220. @interface SCMAdaptor (FileStatus)
  221.  
  222. // public
  223.  
  224. - (NSMutableArray *) filesWithFilter: (NSString *) filterName;
  225. - (NSMutableArray *) filesWithNames: (NSArray *) filenames;
  226. - (NSArray *) filenamesWithFiles: (NSArray *) files;
  227. - (NSArray *) absoluteFilenamesWithFiles: (NSArray *) files;
  228. - (void) updateStatusForFiles: (NSArray *) files;
  229.  
  230. // private
  231.  
  232. - (SCMFileStatus *) statusForFile: (NSString *) filename;
  233. - (void) removeStatusForFile: (NSString *) filename;
  234. - (Class) fileStatusClass;
  235.  
  236. - (void) disableSync;
  237. - (void) enableSync;
  238. - (void) dirty;
  239. - (void) sync;
  240. - (id) userInfo;
  241.  
  242. - (void) setFileStatusOr: (int) bitsOr and: (int) bitsAnd
  243.     directory: (NSString *) dir files: (NSArray *) files;
  244.  
  245. - (void) removeFilesWithStatus: (int) bits from: (NSMutableArray *) files;
  246. - (void) removeFilesWithStatusAny: (int) bits from: (NSMutableArray *) files;
  247. - (void) removeFilesNotWithStatus: (int) bits from: (NSMutableArray *) files;
  248. - (void) removeFilesNotWithStatusAny: (int) bits
  249.     from: (NSMutableArray *) files;
  250. - (BOOL) fileWithStatus: (int) bits from: (NSArray *) files;
  251.  
  252. // protected methods
  253.  
  254. - (NSMutableDictionary *) _fileStatuses;
  255. - (void) _setFileStatuses: (NSDictionary *) dict;
  256.  
  257. @end
  258.  
  259. @interface SCMAdaptor (PBProjectUtilities)
  260.  
  261. - (NSString *) workDirectory;
  262. - (NSString *) repository;
  263. - (NSArray *) allFiles;
  264.  
  265. @end
  266.  
  267. @interface SCMAdaptor (FileMergeUtilities)
  268.  
  269. - (BOOL) openFilesInFileMerge: (NSString *)localFile
  270.     : (NSString *)repositoryHead;
  271. @end
  272.  
  273. @interface SCMAdaptor (WrapperHandling)
  274.  
  275. - (NSDictionary *) wrapperExtensions;
  276.  
  277. - (void) checkWrapper: (NSString *) wrapper;
  278.  
  279. - (void) findWrappersForFiles: (NSArray *) files;
  280. - (void) findWrappersForFilenames: (NSArray *) filenames;
  281. - (NSMutableArray *) filenamesForWrapper: (NSString *) wrapper;
  282. - (void) lockWrapper: (NSString *) wrapper options: (NSDictionary *) options;
  283. - (void) unlockWrapper: (NSString *) wrapper options: (NSDictionary *) options;
  284. - (void) checkInWrapper: (NSString *) wrapper 
  285.     options: (NSDictionary *) options;
  286. - (void) checkOutWrapper: (NSString *) wrapper
  287.     options: (NSDictionary *) options;
  288. - (void) tagWrapper: (NSString *) wrapper options: (NSDictionary *) options;
  289. - (void) updateWrapper: (NSString *) wrapper options: (NSDictionary *) options;
  290. - (void) addWrapper: (NSString *) wrapper options: (NSDictionary *) options;
  291. - (void) removeWrapper: (NSString *) wrapper options: (NSDictionary *) options;
  292. - (void) touchWrapper: (NSString *) wrapper;
  293. - (SCMFileStatus *) statusWrapper: (NSString *) wrapper;
  294.  
  295. - (NSArray *) handleWrappers: (NSArray *) filenames
  296.     options: (NSDictionary *) options selector: (SEL) sel;
  297.  
  298. @end
  299.  
  300. @interface SCMAdaptor (ProjectHandling)
  301.  
  302. // public
  303.  
  304. - (void) addSubproject: (PBProject *) subproject;
  305. - (void) removeSubproject: (NSString *) subprojectFilename;
  306.  
  307. // private
  308.  
  309. - (NSArray *) allFilesForProject: (PBProject *) project
  310.     directory: (NSString *) dir;
  311.  
  312. - (void) projectChanged: (PBProject *) project;
  313.  
  314. @end
  315.  
  316. @interface SCMAdaptor (FileMergeProtocol) <FileMergeCopyProtocol>
  317. @end
  318.  
  319. // notifications
  320.  
  321. PBSCM_EXTERN NSString *SCMStatusesDidChangeNotification;
  322. PBSCM_EXTERN NSString *SCMOutputNewCommandNotification;
  323. PBSCM_EXTERN NSString *SCMOutputNotification;
  324.  
  325. PBSCM_EXTERN NSString *SCMWillPerformOperation;
  326. PBSCM_EXTERN NSString *SCMDidPerformOperation;
  327.  
  328. PBSCM_EXTERN NSString *SCMCreateWorkDirectoryOperation;
  329. PBSCM_EXTERN NSString *SCMAddFilesOperation;
  330. PBSCM_EXTERN NSString *SCMRemoveFilesOperation;
  331. PBSCM_EXTERN NSString *SCMRenameFilesOperation;
  332. PBSCM_EXTERN NSString *SCMCheckOutFilesOperation;
  333. PBSCM_EXTERN NSString *SCMUpdateFilesOperation;
  334. PBSCM_EXTERN NSString *SCMCheckInFilesOperation;
  335. PBSCM_EXTERN NSString *SCMDiffFilesOperation;
  336. PBSCM_EXTERN NSString *SCMLockFilesOperation;
  337. PBSCM_EXTERN NSString *SCMUnlockFilesOperation;
  338. PBSCM_EXTERN NSString *SCMTagFilesOperation;
  339. PBSCM_EXTERN NSString *SCMHistoryFilesOperation;
  340. PBSCM_EXTERN NSString *SCMStatusFilesOperation;
  341. PBSCM_EXTERN NSString *SCMTouchFilesOperation;
  342.  
  343. // filters
  344.  
  345. PBSCM_EXTERN NSString *SCMFilterAllFiles;
  346. PBSCM_EXTERN NSString *SCMFilterLockedFiles;
  347. PBSCM_EXTERN NSString *SCMFilterNotLockedFiles;
  348. PBSCM_EXTERN NSString *SCMFilterNeedUpdateFiles;
  349. PBSCM_EXTERN NSString *SCMFilterConflictsFiles;
  350. PBSCM_EXTERN NSString *SCMFilterUpToDateFiles;
  351. PBSCM_EXTERN NSString *SCMFilterAddedFiles;
  352. PBSCM_EXTERN NSString *SCMFilterRemovedFiles;
  353. PBSCM_EXTERN NSString *SCMFilterModifiedFiles;
  354. PBSCM_EXTERN NSString *SCMFilterCommitFiles;
  355.  
  356. // options
  357.  
  358. PBSCM_EXTERN NSString *SCMOptionComment;
  359. PBSCM_EXTERN NSString *SCMOptionTag;
  360. PBSCM_EXTERN NSString *SCMOptionAllFiles;
  361. PBSCM_EXTERN NSString *SCMOptionAsync;
  362.  
  363. // exceptions
  364.  
  365. PBSCM_EXTERN NSString *SCMCommandErrorException;
  366. PBSCM_EXTERN NSString *SCMInvalidOperationException;
  367.  
  368. // strings
  369.  
  370. #define SCM_CONFIGURATION_DICTIONARY_FILE @".scm.dict"
  371.